vlc --intf=cvlc “这里填写url” :sout=#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:file{dst=这里填写文件路径,no-overwrite} :no-sout-all :no-sout-keep
在末尾追加 vlc://quit 可以在播放结束直接退出,有无界面可以使用–extraintf=logger 或 --intf=cvlc
如:无界面
vlc --intf=cvlc "http://123.60.223.219:7083/dev_vod/vod.m3u8?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NfbW9kZSI6IkhPTE8iLCJjaGFubmVsX2lkIjo2LCJkZXZpY2VfaWQiOiIyMTk4MDYxMjQwNlJNQjAwMDA2NyIsImVuZF90aW1lIjoiMjAyMjA3MTkxNzE1MzAiLCJlbnRlcnByaXNlX2lkIjoiIiwiZXhwaXJlX3RpbWVfY3VzdG9tIjoxNjU4MjY3MjUzLCJsaW5rX2tleSI6IjE2NTgyODYwNTMzMTA3MTYxNjdjNzIxYjg5YyIsInJlY29yZF90eXBlIjoiYWxsIiwicmVxdWVzdF9pZCI6IjJhYWVkNmI2LTA3ZDgtMTFlZC05NDA5LWZhMTYzZWFlZWFmZCIsInN0YXJ0X3RpbWUiOiIyMDIyMDcxOTE3MTQzMCIsInVzZXJfaWQiOiIxMjEzNDE3Mjc3MjAyMjA1MzAwOTU4MDYifQ.RKL8RzWlAFy0jJjv3BdDlxog7xH3FJwVSvaZlqpuBO4&device_id=21980612406RMB000067&channel_id=6&stream_type=0" :sout=#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:file{dst=video2.mp4,no-overwrite} :no-sout-all :no-sout-keep
有界面
vlc --extraintf=logger "http://123.60.223.219:7083/dev_vod/vod.m3u8?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NfbW9kZSI6IkhPTE8iLCJjaGFubmVsX2lkIjo2LCJkZXZpY2VfaWQiOiIyMTk4MDYxMjQwNlJNQjAwMDA2NyIsImVuZF90aW1lIjoiMjAyMjA3MTkxNzE1MzAiLCJlbnRlcnByaXNlX2lkIjoiIiwiZXhwaXJlX3RpbWVfY3VzdG9tIjoxNjU4MjY3MjUzLCJsaW5rX2tleSI6IjE2NTgyODYwNTMzMTA3MTYxNjdjNzIxYjg5YyIsInJlY29yZF90eXBlIjoiYWxsIiwicmVxdWVzdF9pZCI6IjJhYWVkNmI2LTA3ZDgtMTFlZC05NDA5LWZhMTYzZWFlZWFmZCIsInN0YXJ0X3RpbWUiOiIyMDIyMDcxOTE3MTQzMCIsInVzZXJfaWQiOiIxMjEzNDE3Mjc3MjAyMjA1MzAwOTU4MDYifQ.RKL8RzWlAFy0jJjv3BdDlxog7xH3FJwVSvaZlqpuBO4&device_id=21980612406RMB000067&channel_id=6&stream_type=0" :sout=#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:file{dst=video2.mp4,no-overwrite} :no-sout-all :no-sout-keep
结束后立即退出:
vlc --intf=cvlc "http://123.60.223.219:7083/dev_vod/vod.m3u8?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NfbW9kZSI6IkhPTE8iLCJjaGFubmVsX2lkIjo2LCJkZXZpY2VfaWQiOiIyMTk4MDYxMjQwNlJNQjAwMDA2NyIsImVuZF90aW1lIjoiMjAyMjA3MTkxNzE1MzAiLCJlbnRlcnByaXNlX2lkIjoiIiwiZXhwaXJlX3RpbWVfY3VzdG9tIjoxNjU4MjY3MjUzLCJsaW5rX2tleSI6IjE2NTgyODYwNTMzMTA3MTYxNjdjNzIxYjg5YyIsInJlY29yZF90eXBlIjoiYWxsIiwicmVxdWVzdF9pZCI6IjJhYWVkNmI2LTA3ZDgtMTFlZC05NDA5LWZhMTYzZWFlZWFmZCIsInN0YXJ0X3RpbWUiOiIyMDIyMDcxOTE3MTQzMCIsInVzZXJfaWQiOiIxMjEzNDE3Mjc3MjAyMjA1MzAwOTU4MDYifQ.RKL8RzWlAFy0jJjv3BdDlxog7xH3FJwVSvaZlqpuBO4&device_id=21980612406RMB000067&channel_id=6&stream_type=0" :sout=#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:file{dst=video2.mp4,no-overwrite} :no-sout-all :no-sout-keep vlc://quit
cvlc “url” --sout “#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100}:file{dst=文件名路径,no-overwrite}” --no-sout-all --sout-keep vlc://quit
同上述一样,vlc://quit 代表结束即退出
cvlc "http://122.9.45.24:7083/dev_vod/vod.m3u8?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NfbW9kZSI6IkhPTE8iLCJjaGFubmVsX2lkIjowLCJkZXZpY2VfaWQiOiIyMTk4MDYxMjM1NlJNNjAwMDAxMCIsImVuZF90aW1lIjoiMjAyMjA4MDExMzI5NDUiLCJlbnRlcnByaXNlX2lkIjoiIiwiZXhwaXJlX3RpbWVfY3VzdG9tIjoxNjU5NDE3NTk5LCJsaW5rX2tleSI6IjE2NTk0MzYzOTk2MDY3MzkyMjhkMzZkM2RmZSIsInJlY29yZF90eXBlIjoiYWxsIiwicmVxdWVzdF9pZCI6Ijg2OWIwMTlkLTEyNGUtMTFlZC05NDA5LWZhMTYzZWFlZWFmZCIsInN0YXJ0X3RpbWUiOiIyMDIyMDgwMTEzMjkzOSIsInVzZXJfaWQiOiIxODg3NDA0MDEzMjAyMjA0MTkxOTU0NTYifQ.bfpSlGu4u7KjmtzAa1QOumFC6Col3JGhRJ45lUDazKs&device_id=21980612356RM6000010&channel_id=0&stream_type=0" --sout "#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100}:file{dst=./videos/MicroEdge_.mp4,no-overwrite}" --no-sout-all --sout-keep vlc://quit
cvlc 是无界面的,如果你的想使用有界面的且你的linux支持界面,可以使用 vlc
vlc "http://122.9.45.24:7083/dev_vod/vod.m3u8?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NfbW9kZSI6IkhPTE8iLCJjaGFubmVsX2lkIjowLCJkZXZpY2VfaWQiOiIyMTk4MDYxMjM1NlJNNjAwMDAxMCIsImVuZF90aW1lIjoiMjAyMjA4MDExMzI5NDUiLCJlbnRlcnByaXNlX2lkIjoiIiwiZXhwaXJlX3RpbWVfY3VzdG9tIjoxNjU5NDE3NTk5LCJsaW5rX2tleSI6IjE2NTk0MzYzOTk2MDY3MzkyMjhkMzZkM2RmZSIsInJlY29yZF90eXBlIjoiYWxsIiwicmVxdWVzdF9pZCI6Ijg2OWIwMTlkLTEyNGUtMTFlZC05NDA5LWZhMTYzZWFlZWFmZCIsInN0YXJ0X3RpbWUiOiIyMDIyMDgwMTEzMjkzOSIsInVzZXJfaWQiOiIxODg3NDA0MDEzMjAyMjA0MTkxOTU0NTYifQ.bfpSlGu4u7KjmtzAa1QOumFC6Col3JGhRJ45lUDazKs&device_id=21980612356RM6000010&channel_id=0&stream_type=0" --sout "#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100}:file{dst=./videos/MicroEdge_.mp4,no-overwrite}" --no-sout-all --sout-keep vlc://quit