我正在尝试使用 gstreamer 为某个 url 录制视频流,https://csm-e-nineau2-eb.bln1.yospace.com/csm/extlive/nnaprd01,prod-simulcast-mel-ch9-hls-r13.m3u8
我已经通过测试流做到了这一点,http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8,在 gstreamer 示例页面上使用以下命令(这里使用 fakesink 进行测试)
gst-launch-1.0 souphttpsrc location=http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8 \
! hlsdemux \
! tsdemux \
! queue \
! video/x-h264 \
! h264parse \
! fakesink
当我尝试对我想要的流执行完全相同的命令时,收到以下错误:
ERROR: from element /GstPipeline:pipeline0/GstHLSDemux:hlsdemux0: Internal data stream error.
Additional debug info:
../gst-libs/gst/adaptivedemux/gstadaptivedemux.c(3891): gst_adaptive_demux_stream_download_loop (): /GstPipeline:pipeline0/GstHLSDemux:hlsdemux0:
streaming stopped, reason not-linked (-1)
ERROR: from element /GstPipeline:pipeline0/GstHLSDemux:hlsdemux0: Internal data stream error.
Additional debug info:
../gst-libs/gst/adaptivedemux/gstadaptivedemux.c(3891): gst_adaptive_demux_stream_download_loop (): /GstPipeline:pipeline0/GstHLSDemux:hlsdemux0:
streaming stopped, reason not-linked (-1)
我正在努力弄清楚这里的问题出在流上,以及我应该将 hlsdemux 链接到哪里。在 URL 上运行 get-discover 会得到以下结果:
gst-discoverer-1.0 -v https://csm-e-nineau2-eb.bln1.yospace.com/csm/extlive/nnaprd01,prod-simulcast-mel-ch9-hls-r13.m3u8
Analyzing https://csm-e-nineau2-eb.bln1.yospace.com/csm/extlive/nnaprd01,prod-simulcast-mel-ch9-hls-r13.m3u8
Done discovering https://csm-e-nineau2-eb.bln1.yospace.com/csm/extlive/nnaprd01,prod-simulcast-mel-ch9-hls-r13.m3u8
Properties:
Duration: 99:99:99.999999999
Seekable: yes
Live: no
Tags:
private-data: buffer of 8 bytes
nominal bitrate: 128025
audio codec: MPEG-4 AAC
video codec: H.264
container #0: application/x-hls
Tags:
None
container #-1: video/mpegts, systemstream=(boolean)true, packetsize=(int)188
Tags:
None
video #1: video/x-h264, stream-format=(string)avc, pixel-aspect-ratio=(fraction)1/1, width=(int)854, height=(int)480, framerate=(fraction)25/1, coded-picture-structure=(string)frame, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, colorimetry=(string)bt709, parsed=(boolean)true, alignment=(string)au, profile=(string)high, level=(string)3, codec_data=(buffer)0164001effe100272764001eac72100d83de6f016a020202800000030080000019747003a9801d4d7bdc07c201092001000428fb8f2c
Tags:
video codec: H.264
Codec:
video/x-h264, stream-format=(string)avc, pixel-aspect-ratio=(fraction)1/1, width=(int)854, height=(int)480, framerate=(fraction)25/1, coded-picture-structure=(string)frame, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, colorimetry=(string)bt709, parsed=(boolean)true, alignment=(string)au, profile=(string)high, level=(string)3, codec_data=(buffer)0164001effe100272764001eac72100d83de6f016a020202800000030080000019747003a9801d4d7bdc07c201092001000428fb8f2c
Stream ID: a4b40f2cfad0e90e410cdb6ae232e3f77caacc14e61a67041b21641c1866aa91/src_0:1/000001e1
Width: 854
Height: 480
Depth: 24
Frame rate: 25/1
Pixel aspect ratio: 1/1
Interlaced: false
Bitrate: 0
Max bitrate: 0
container #-1: audio/mpeg, framed=(boolean)false, mpegversion=(int)4, stream-format=(string)adts, level=(string)2, base-profile=(string)lc, profile=(string)lc, channels=(int)2, rate=(int)48000
Tags:
None
audio #2: audio/mpeg, framed=(boolean)true, mpegversion=(int)4, level=(string)2, base-profile=(string)lc, profile=(string)lc, rate=(int)48000, channels=(int)2, stream-format=(string)adts
Tags:
private-data: buffer of 8 bytes
nominal bitrate: 128025
audio codec: MPEG-4 AAC
Codec:
audio/mpeg, framed=(boolean)true, mpegversion=(int)4, level=(string)2, base-profile=(string)lc, profile=(string)lc, rate=(int)48000, channels=(int)2, stream-format=(string)adts
Stream ID: a4b40f2cfad0e90e410cdb6ae232e3f77caacc14e61a67041b21641c1866aa91/src_1
Language: <unknown>
Channels: 2 (front-left, front-right)
Sample rate: 48000
Depth: 32
Bitrate: 128025
Max bitrate: 0
编辑:hlsdemux 似乎由于存在多个视频流而失败。将连接速度选项设置为最大值 (4294967) 就可以解决问题,我猜是因为它没有尝试将视频流切换到质量较低的视频流
gst-launch-1.0 souphttpsrc location=https://csm-e-nineau2-eb.bln1.yospace.com/csm/extlive/nnaprd01,prod-simulcast-mel-ch9-hls-r13.m3u8 \
! hlsdemux connection-speed=4294967 \
! tsdemux \
! h264parse \
! video/x-h264 \
! fakesink