VLC命令行模式使用大全
VLC命令行模式使用大全
一Receive and save a stream
1.1 Receive a stream with VLC
1.1.1 Receive an unicast stream(接收单播流)
vlc -vvv udp://10.1.14.18
注释:10.1.14.18为目标计算机的IP地址
1.1.2 Receive a multicast stream
vlc -vvv udp://239.255.255.1:1234
1.1.3 Receive an HTTP/FTP/MMS stream
vlc -vvv http://example/stream.xyz
vlc -vvv ftp://example/stream.xyz
vlc -vvv rtsp://https://www.360docs.net/doc/6413448767.html,/tonbeme.mov
1.2 Save a stream with VLC
vlc stream --sout file/muxer:stream.xyz
注释:
stream:指网络流;
muxer:指ps,ts,avi,ogg等封装形式;
stream.xyz:存储文件的名字,前面需要加存储路径如:vlc udp://@239.255.255.1:1234 –sout file/ps:/home/youxr/movie.mpg 二Stream a file
这里主要介绍视频文件如何以流的形式发出,给出下面的命令。2.1 单播输出
vlc -vvv video1.xyz --sout udp:192.168.0.42 --ttl 12
2.2 多播输出
vlc -vvv video1.xyz --sout udp://@239.255.255.1:1234 --ttl 12
2.3 Http输出
vlc -vvv video1.xyz --sout http/muxer:本机地址:端口号--ttl 12
注释:
muxer为ps、ts等封装形式。
客户端接收为:vlc http://服务器地址:端口号
三高级应用
3.1 Transcoding(转码)
①Transcode the input stream and send it to a multicast IP address with the associated SAP announce:
vlc -vvv input_stream --sout '#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128,
deinterlace}:standard{access=udp,mux=ts,url=239.255.12.42,sap,name="TestStream"}'
注释:SAP可不要
②Display the input stream, transcode it and send it to a multicast IP address with the associated SAP announce:
vlc -vvv input_stream --sout '#duplicate{dst=display,dst="transcode{vcodec=mp4v,
acodec=mpga,vb=800,ab=128,deinterlace}:standard{access=udp,mux=ts,url=239.255.12.42,sap,n ame="TestStream"}"}'
③Transcode the input stream, display the transcoded stream and send it to a multicast IP address with the associated SAP announce:
vlc -vvv input_stream --sout '#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128,
deinterlace}:duplicate{dst=display,dst=standard{access=udp,mux=ts,url=239.255.12.42,sap,name ="TestStream"}}'
3.2 Multiple streaming(多个流输出)
①Send a stream to a multicast IP address and a unicast IP address:
vlc -vvv input_stream --sout '#duplicate{dst=standard{access=udp,mux=ts,
url=239.255.12.42,sap,name="TestStream"},dst=standard{access=udp,mux=ts,url=192.168.1 .2}}'
②Display the stream and send it to two unicast IP addresses:
vlc -vvv input_stream --sout '#duplicate{dst=display,dst=standard{access=udp,mux=ts,
url=192.168.1.12},dst=standard{access=udp,mux=ts,url=192.168.1.42}}'
③Send parts of a multiple program input stream:
vlc -vvv multiple_program_input_stream --sout '#duplicate{dst=standard{access=udp,
mux=ts,url=239.255.12.42},select="program=12345",dst=standard{access=udp,mux=ts,url=239.2 55.12.43}, select="video,program=1234-2345"}'
3.3 Transcoding and multiple streaming(转码且多流输出)
①Transcode the input stream, display the transcoded stream and send it to a multicast IP address with the associated SAP announce and an unicast IP address:
vlc -vvv input_stream --sout '#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128,
deinterlace}:duplicate{dst=display,dst=standard{access=udp,mux=ts,url=239.255.12.42,sap,name ="TestStream"},dst=standard{access=udp,mux=ts,url=192.168.1.2}}'
②Display the input stream, transcode it and send it to two unicast IP addresses:
vlc -vvv input_stream --sout '#duplicate{dst=display,dst="transcode{vcodec=mp4v,
acodec=mpga,vb=800,ab=128}:duplicate{dst=standard{access=udp,mux=ts,url=192.168.1.2},dst =standard{access=udp,mux=ts,url=192.168.1.12}"}'
③Send the input stream to a multicast IP address and the transcoded stream to another multicast IP address with the associated SAP announces:
vlc -vvv input_stream --sout '#duplicate{dst=standard{access=udp,mux=ts,
url=239.255.1.2,sap,name="OriginalStream"},dst="transcode{vcodec=mp4v,acodec=mpga,vb=80 0,ab=128}:standard{access=udp,mux=ts,url=239.255.1.3,sap,name="TranscodedStream"}"}'
④转码且存储
vlc -vvv input_stream --sout '#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128, deinterlace}:duplicate{dst=display,dst=standard{access=file,mux=ps,url=./movie.mpg}}'
3.4 HTTP streaming
① streaming in http (和2.3类似)
服务器端运行:
vlc -vvv input_stream --sout '#standard{access=http,mux=ogg,url=https://www.360docs.net/doc/6413448767.html,:8080}' 客户端运行:--sout '#standard{access=http,mux=ogg,url=192.168.1.101:8080}'
vlc https://www.360docs.net/doc/6413448767.html,:8080
C:\Program Files\VideoLAN\VLC>vlc -vvv H:\VIDEO\gg.mpg :sout=#standard{access=ht
tp,mux=ogg,dst=192.168.1.102:9898}'
②转码并且http方式输出
vlc -vvv input_stream --sout '#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128}: standard{access=http,mux=ogg,url=https://www.360docs.net/doc/6413448767.html,:8080}'
例如:if you want to stream an audio CD in Ogg/Vorbis over HTTP:
vlc -vvv cdda:/dev/cdrom --sout '#transcode{acodec=vorb,ab=128}:standard{access=http, mux=ogg,url=https://www.360docs.net/doc/6413448767.html,:8080}'
3.5 RTP streaming
Stream in RTP:
on the server, run:
vlc -vvv input_stream --sout '#rtp{dst=192.168.0.12,port=1234,
sdp=https://www.360docs.net/doc/6413448767.html,:8080/test.sdp}'
on the client(s), run:
vlc https://www.360docs.net/doc/6413448767.html,:8080/test.sdp
3.6 Use the es module
① Separate audio and video in two PS files:
vlc -vvv input_stream --sout'#es{access=file,mux=ps,url_audio=audio-%c.%m,
url_video=video-%c.%m}'
② Extract the audio track of the input stream to a TS file:
vlc -vvv input_stream --sout '#es{access_audio=file,mux_audio=ts,
url_audio=audio-%c.%m}'
③ Stream in unicast the audio track on a port and the video track on another port:
on the server side:
vlc -vvv input_stream –sout '#es{access=rtp,mux=ts,url_audio=192.168.1.2:1212,
url_video=192.168.1.2:1213}'
on the client side: to receive the audio:
vlc udp:@:1212
to receive the video:
vlc udp:@:1213
④ Stream in multicast the video and dump the audio in a file:
vlc -vvv input_stream --sout '#es{access_video=udp,mux_video=ts,
url_video=239.255.12.42,access_audio=file,mux_audio=ps,url_audio=audio-%c.%m}'