我正在尝试使用 LibVLC 和 --sout-all 选项流式传输带有 2 个音轨的视频。我知道电影中有两个音轨,但我似乎无法正确选择,所以 Vlc 只播放一个。
(vlc 版本 2.0.5/2.0.8 ubuntu 12.0.4 在不太快的 intel atom nettop 上)
def change_media(instance, player, video_port, item, multicast_address, video_offset=0.0):
"""
Change video
"""
param=[
"%s" % item
,"start-time=%d" % video_offset
,"sout-all"
,"sout-udp-ttl=1"
,"ttl=1"
,"sout=#standard{access=udp,dst=%s:%d,mux=ts{pid-video=68,pid-audio=70}}"%(
multicast_address,
video_port
)
]
media = instance.media_new(*param)
player.set_media(media)
从命令行尝试时,我似乎并不擅长让 --sout-all 选项工作。
vlc -vvv land.mp4 --sout-all --sout=#standard{access=udp,dst=224.1.1.1:5555,mux=ts{pid-video=68,pid-audio=70}}
以下是日志中的一些行 - 我希望它足够了 - 请参阅(禁用)
[0x853c498] mp4 demux debug: adding track[Id 0x1] video (enable) language undef
[0x853c498] mp4 demux debug: track[Id 0x2] read 26658 chunk
[0x853c498] mp4 demux debug: track[Id 0x2] read 213263 samples length:4549s
[0x853c498] mp4 demux debug: adding track[Id 0x2] audio (enable) language eng
[0x853c498] mp4 demux debug: track[Id 0x3] read 26658 chunk
[0x853c498] mp4 demux debug: track[Id 0x3] read 213263 samples length:4549s
[0x853c498] mp4 demux debug: adding track[Id 0x3] audio (disable) language fra
这仅显示两条轨道:
[0x85494b8] main stream output debug: adding a new sout input (sout_input:0xb5003c70)
[0x853de98] main mux debug: adding a new input
[0x853de98] mux_ts mux debug: adding input codec=h264 pid=68
[0x853de98] mux_ts mux debug: new PCR PID is 68
[0x85494b8] main stream output debug: adding a new sout input (sout_input:0xb042f630)
[0x853de98] main mux debug: adding a new input
[0x853de98] mux_ts mux debug: adding input codec=mp4a pid=70
[0x853de98] mux_ts mux debug: - lang=eng