VLC(VideoLan)是一个开源播放器,可以播放本地文件,接受UDP,HTTP,RTP等流媒体数据,同时也可以作为流媒体服务器,将本地媒体文件流化成流媒体数据流,
具体命令总结如下:
1. one stream input
vlc -vvv sport.mp4 --input-repeat=2 --sout udp://192.168.0.1:1234
将本地文件sport.mp4流化成流媒体数据,通过UDP发送到192.168.0.1的1234端口
2. two streams input
vlc -vvv test.mp4 sport.mp4 --no-repeat --sout udp://192.168.0.1:1234
将本地文件test.mp4和sport.mp4先后流化成流媒体数据,通过UDP发送到192.168.0.1的1234端口
3. start-time - set start position of playing
stop-time - set stop position of playing
no-repeat - play one time
play-and-exit - exit after playing
vlc -vvv test.mp4 --start-time 0s --stop-time 10s --no-repeat --play-and-exit --sout udp://192.168.0.1:1234
4. receive data and save into a ts file
vlc -vvv udp://@:1234 --sout '#std{access=file,mux=ts,dst=test.ts}'
从本地UDP的1234端口接受数据流,通过UDP发送到192.168.0.1的1234端口
5. 使用VLC做转码,然后发送到不同的地址端口去
vlc -vvv /home/ss/test.ts --network-caching=10 --sout '#transcode{vcodec=h264,venc=x264{keyint=25,idrinit=25,bframes=0,ref=1,hrd=cbr,crf=28,vb=4500,preset=ultrafast,tune=zerolatency,vbv-maxrate=1234},fps=25.00,threads=48,deinterlace,audio-sync}:duplicate{dst=std{access=udp,dst=192.168.0.108:1234},dst=udp{caching=10,mux=ts,dst=192.168.0.116:5500,name="testTS2"}}'