首页 > 解决方案 > gstreamer hls 流和接收

问题描述

问题

我需要如何调整 gstreamer 管道以在我的应用程序中接收 HLS 流。

设置

到目前为止,流媒体部分看起来像这样

$ gst-launch-1.0 videotestsrc is-live=true ! x264enc ! mpegtsmux ! hlssink &
$ python -m SimpleHTTPServer 5000

我可以确认流媒体使用 VLC 和 gstreamer fakesink

# See end of post for output of this command
$ gst-launch-1.0 -v souphttpsrc is-live=true location=http://localhost:5000/playlist.m3u8 ! hlsdemux ! tsdemux ! h264parse ! avdec_h264 ! videoconvert ! fakesink dump=1

但是,当尝试使用appsink而不是将流绑定到我的暗网时,fakesink我没有得到任何图像。

调试暗网

appsink暗网本身似乎与使用管道的 as 文件输入配合得很好

some_file_name.mp4

和 USB 网络摄像头使用

v4l2src device=/dev/video1 ! video/x-raw, framerate=30/1, width=640, height=360 ! videoconvert ! appsink

工作得很好。

的输出fakesink

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Got context from element 'souphttpsrc0': gst.soup.session=context, session=(SoupSession)NULL, force=(boolean)false;
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstTSDemux:tsdemux0.GstPad:sink: caps = video/mpegts, systemstream=(boolean)true, packetsize=(int)188
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)nal
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240, framerate=(fraction)30/1, interlace-mode=(string)progressive, chroma-format=(string)4:4:4, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, profile=(string)high-4:4:4, level=(string)1.3, codec_data=(buffer)01f4000dffe1001d67f4000d919b28283f602d41804150000003001000000303c8f142996001000568ebec4480
Redistribute latency...
/GstPipeline:pipeline0/avdec_h264:avdec_h264-0.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240, framerate=(fraction)30/1, interlace-mode=(string)progressive, chroma-format=(string)4:4:4, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, profile=(string)high-4:4:4, level=(string)1.3, codec_data=(buffer)01f4000dffe1001d67f4000d919b28283f602d41804150000003001000000303c8f142996001000568ebec4480
/GstPipeline:pipeline0/avdec_h264:avdec_h264-0.GstPad:src: caps = video/x-raw, format=(string)Y444, width=(int)320, height=(int)240, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, format=(string)Y444, width=(int)320, height=(int)240, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-raw, format=(string)Y444, width=(int)320, height=(int)240, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)Y444, width=(int)320, height=(int)240, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)30/1
Redistribute latency...
00000000 (0x7f402d2220): eb eb eb eb eb eb eb eb eb eb eb eb eb eb eb eb  ................
00000010 (0x7f402d2230): eb eb eb eb eb eb eb eb eb eb eb eb eb eb eb eb  ................
00000020 (0x7f402d2240): eb eb eb eb eb eb eb eb eb eb eb eb eb d2 d2 d2  ................
00000030 (0x7f402d2250): d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2  ................
00000040 (0x7f402d2260): d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2  ................
00000050 (0x7f402d2270): d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 aa aa aa aa aa  ................
00000060 (0x7f402d2280): aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa  ................
00000070 (0x7f402d2290): aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa  ................
00000080 (0x7f402d22a0): aa aa aa aa aa aa aa aa aa 91 91 91 91 91 91 91  ................
00000090 (0x7f402d22b0): 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91  ................
000000a0 (0x7f402d22c0): 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91  ................
000000b0 (0x7f402d22d0): 91 91 91 91 91 91 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a  ......jjjjjjjjjj
000000c0 (0x7f402d22e0): 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a  jjjjjjjjjjjjjjjj
000000d0 (0x7f402d22f0): 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a 6a  jjjjjjjjjjjjjjjj
000000e0 (0x7f402d2300): 6a 6a 6a 6a 51 51 51 51 51 51 51 51 51 51 51 51  jjjjQQQQQQQQQQQQ
000000f0 (0x7f402d2310): 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51  QQQQQQQQQQQQQQQQ
00000100 (0x7f402d2320): 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51  QQQQQQQQQQQQQQQQ

标签: opencvgstreamerhttp-live-streaming

解决方案


推荐阅读