我需要在 rtmp 流中添加时间覆盖,并保存到磁盘。以下管道,没有覆盖,工作正常:
gst-launch-1.0 -v \
rtmpsrc location=rtmp://192.168.x.x/live/0 do-timestamp=true ! queue2 ! flvdemux name=demux \
flvmux name=mux \
demux.video ! queue ! decodebin \
! nvvidconv \
! 'video/x-raw(memory:NVMM),width=1920,height=1080, format=(string)I420, framerate=50/1' \
! nvv4l2h264enc ! h264parse \
! mux.video \
demux.audio ! queue name="dmx_aud_q" ! mux.audio \
mux.src ! queue name="mux_q" ! filesink location="rtmp.flv"
一旦我添加了时间覆盖(甚至时钟覆盖),管道就不会运行:
gst-launch-1.0 -v \
rtmpsrc location=rtmp://192.168.0.168/x.x do-timestamp=true ! queue2 ! flvdemux name=demux \
flvmux name=mux \
demux.video ! queue ! decodebin \
! timeoverlay \
! nvvidconv \
! 'video/x-raw(memory:NVMM),width=1920,height=1080, format=(string)I420, framerate=50/1' \
! nvv4l2h264enc ! h264parse \
! mux.video \
demux.audio ! queue name="dmx_aud_q" ! mux.audio \
mux.src ! queue name="mux_q" ! filesink location="rtmp.flv"
GST_DEBUG=3 日志在最后添加。管道图如下。
据我了解,在decodebin
移交给的timeoverlay
时候,上限谈判存在一些问题。我无法弄清楚如何以管道可以继续复用的方式使 timeoverlay 接受或输出数据。任何有助于了解这里发生的事情以及如何找到解决方案的帮助都会很棒。
这是在运行 Ubuntu 18.0 的 Nvidia Jetson Nano 板上。(以“nv”开头的插件通常可以替换为其他系统上的常规插件,我相信 - nvvidconv
with videoconvert
,nvv4l2h264enc
withomxh264enc
等。
Setting pipeline to PAUSED ... Opening in BLOCKING MODE 0:00:00.119491546 834 0x55b9d05600 WARN v4l2 gstv4l2object.c:2370:gst_v4l2_object_add_interlace_mode:0x55b9cf2360 Failed to determine interlace mode 0:00:00.119570298 834
0x55b9d05600 WARN v4l2 gstv4l2object.c:2370:gst_v4l2_object_add_interlace_mode :0x55b9cf2360 无法确定隔行扫描模式 0:00:00.119623164 834
0x55b9d05600 WARN v4l2 gstv4l2object.c:2370:gst_v4l2_object_add_interlace_mode:0x55b9cf2360 无法确定隔行扫描模式 0:050:020.119
0x55b9d05600 WARN v4l2 gstv4l2object.c:4408:gst_v4l2_object_probe_caps: Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1 Pipeline is PREROLLING ... 0:00:00.406155973 834 0x55b9a72370 WARN flvdemux gstflvdemux.c:659:gst_flv_demux_parse_tag_script: failed reading a标签,跳过 /GstPipeline:pipeline0/GstQueue:dmx_aud_q.GstPad:sink: caps = audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, rate=(int) 44100,通道=(int)2,codec_data=(缓冲区)1210 /GstPipeline:pipeline0/GstQueue:dmx_aud_q.GstPad:src: caps = audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-格式=(字符串)原始,速率=(整数)44100,通道=(整数)2,编解码器数据=(缓冲区)1210 /GstPipeline:pipeline0/GstFlvMux:mux.GstFlvMuxPad:sink_1:caps = 音频/mpeg,mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, rate=(int)44100, channels=(int)2, codec_data=(buffer)1210 /GstPipeline:pipeline0/GstQueue: queue0.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, width=(int)1920, height=(int)1080, codec_data=(buffer)0142002affe100166742002a95a81e0089f96100000300010000030064840100048/Gstpipeline: queue0.gstpad:src:caps =视频/x-h264,stream-format =(string)avc,width =(int)1920,height =(int)1080,codeec_data =(buffer)0142002AFFE1002AFFE1001666742002A95A95A89F95A89F96111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111MENTER MELTEN; decodebin0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/x-h264, stream-format=(string)avc, width=(int)1920, height=(int)1080,codec_data=(buffer)0142002affe100166742002a95a81e0089f961000003000100000300648401000468ce3c80 /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = video/x-h264, stream-format=(string)avc, width=(int)1920, height=( int)1080, codec_data=(buffer)0142002affe100166742002a95a81e0089f961000003000100000300648401000468ce3c80 /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstH264Parse:h264parse1.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, width=(int)1920 , height=(int)1080, codec_data=(buffer)0142002affe100166742002a95a81e0089f961000003000100000300648401000468ce3c80 /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, width= (int)1920, 高度=(int)1080,codec_data=(buffer)0142002affe100166742002a95a81e0089f961000003000100000300648401000468ce3c80 /GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:sink: caps = video/x-h264, stream-format=(string)avc, width=(int)1920, height=(int)1080, codec_data=(buffer)0142002affe100166742002a95a81e0089f961000003000100000300648401000468ce3c80 /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstH264Parse:h264parse1.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, width=(int)1920, height =(int)1080, framerate=(fraction)50/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit- depth-chroma=(uint)8, parsed=(boolean)true, alignment=(string)au, profile=(string)baseline, level=(string)4.2 在阻塞模式下打开 0:00:00.823485062 834823485062 834823485062 834CAPS =视频/X-H264,流式=(字符串)AVC,width =(int)1920,高度=(int)1080,codec_data =(buffer)014200200166742002A95A95A8141441449F96100000300010001000100010001000100010001000100010001MENTENL: GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, width=(int)1920, height=(int)1080, framerate=(fraction)50/1, interlace-mode= (string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, alignment=( string)au, profile=(string)baseline, level=(string)4.2 在阻塞模式下打开 0:00:00.823485062 834CAPS =视频/X-H264,流式=(字符串)AVC,width =(int)1920,高度=(int)1080,codec_data =(buffer)014200200166742002A95A95A8141441449F96100000300010001000100010001000100010001000100010001MENTENL: GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, width=(int)1920, height=(int)1080, framerate=(fraction)50/1, interlace-mode= (string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, alignment=( string)au, profile=(string)baseline, level=(string)4.2 在阻塞模式下打开 0:00:00.823485062 834decodebin0/GstH264Parse:h264parse1.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, width=(int)1920, height=(int)1080, framerate=(fraction)50/ 1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean )true, alignment=(string)au, profile=(string)baseline, level=(string)4.2 在阻塞模式下打开 0:00:00.823485062 834decodebin0/GstH264Parse:h264parse1.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, width=(int)1920, height=(int)1080, framerate=(fraction)50/ 1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean )true, alignment=(string)au, profile=(string)baseline, level=(string)4.2 在阻塞模式下打开 0:00:00.823485062 834
0x55b9ce8a30 WARN v4l2 gstv4l2object.c:4408:gst_v4l2_object_probe_caps: Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1 0:00:00.823543397 834 0x55b9ce8a30 WARN v4l2 gstv4l2object.c:2370:gst_v4l2_object_add_interlace_mode:0x7f6807a640 Failed to determine interlace mode NvMMLiteOpen : Block :BlockType = 261 NVMEDIA:读取 vendor.tegra.display-size:状态:6 NvMMLiteBlockCreate:块:BlockType = 261 /GstPipeline:pipeline0/GstDecodeBin:decodebin0/nvv4l2decoder:nvv4l2decoder0.GstPad:sink: caps = video/x-h264,流格式=(字符串)字节流,宽度=(整数)1920,高度=(整数)1080,帧率=(分数)50/1,隔行模式=(字符串)渐进式,色度格式=(字符串) 4:2:0,位深度亮度=(uint)8,位深度色度=(uint)8,解析=(布尔)真,对齐=(字符串)au,配置文件=(字符串)基线,级别=(字符串)4.2 /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstCapsFilter:capsfilter1.GstPad:src:caps = video/x-h264,流格式=(字符串)字节流,宽度=(整数)1920,高度=(整数)1080,帧率=(分数)50/1,隔行模式=(字符串)渐进式,色度格式=(字符串)4:2:0 , bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, alignment=(string)au, profile=(string)baseline, level=(string)4.2 /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstCapsFilter:capsfilter1.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, width=(int)1920, height=(int)1080, framerate=(fraction)50/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint )8, 已解析=(boolean)true,对齐=(字符串)au,配置文件=(字符串)基线,级别=(字符串)4.2 0:00:00.932089228 834 0x55b9ce8a30 WARN
v4l2 gstv4l2object.c:4408:gst_v4l2_object_probe_caps: Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1 0:00:00.932560124 834 0x55b9ce8a30 WARN v4l2 gstv4l2object.c:2370:gst_v4l2_object_add_interlace_mode:0x7f6807a640 Failed to determine interlace mode /GstPipeline:pipeline0/ GstDecodeBin:decodebin0/nvv4l2decoder:nvv4l2decoder0.GstPad:src: caps = video/x-raw(memory:NVMM), format=(string)NV12, width=(int)1920, height=(int)1080, 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-纵横比/混合单声道,像素纵横比=(分数)1/1,色度站点=(字符串)mpeg2,色度=(字符串)bt709,帧率=(分数)50/1(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.065:gst_mini_object_copy:断言'mini_object!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.066:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.066:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.066:gst_caps_append_structure_full:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.066:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.066:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.067:gst_caps_append_structure_full:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.067:gst_mini_object_copy:断言'mini_object!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.068:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.068:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.068:gst_caps_append_structure_full:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.068:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.068:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834): GStreamer-CRITICAL **: 14:19:35.069: gst_caps_append_structure_full: 断言'GST_IS_CAPS (caps)' 失败 0:00:00.942959420 834 0x55b9ce8a30 WARN GST_PADS gstpad.c:42_26:gst_pad 可以: not send sticky events 0:00:00.943568965 834 0x55b9ce8a30 WARN
v4l2videodec gstv4l2videodec.c:1433:gst_v4l2_video_dec_decide_allocation: Duration invalid, not setting latency 0:00:00.944316482 834
0x55b9ce8a30 WARN v4l2bufferpool gstv4l2bufferpool.c:1054:gst_v4l2_buffer_pool_start: Uncertain or not enough buffers,启用复制阈值(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.073:gst_mini_object_copy:断言'mini_object!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.074:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.074:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.074:gst_caps_append_structure_full:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.074:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.074:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834): GStreamer-CRITICAL **: 14:19:35.074: gst_caps_append_structure_full: 断言 'GST_IS_CAPS (caps)' 失败 0:00:00.948613871 834 0x55b9ce8a30 WARN basetransform gstbasetransform.c:1355:transformset无法转换视频/x-h264,流格式=(字符串)字节流,宽度=(整数)1920,高度=(整数)1080,帧率=(分数)50/1,隔行模式=(字符串)渐进式,色度格式=(字符串)4:2:0,位深度亮度=(uint)8,位深度色度=(uint)8,解析=(布尔)真,对齐=(字符串)au , profile=(string)baseline, level=(string)4.2 在我们支持的任何东西中 0:00:00.948674601 834 0x55b9ce8a30 WARN basetransform gstbasetransform.c:1415:gst_base_transform_reconfigure: 警告:未协商 0:00:00.948709446 834 0x55b9ce8a30
basetransform gstbasetransform.c:1415:gst_base_transform_reconfigure:警告:未协商警告:来自元素 /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstCapsFilter:capsfilter1:未协商附加调试信息:gstbasetransform.c(1415):gst_base_transform_reconfigure ():/GstPipeline: pipeline0/GstDecodeBin:decodebin0/GstCapsFilter:capsfilter1: 未协商 0:00:00.971426937 834 0x7f70004a80 WARN
basesrc gstbasesrc.c:3055:gst_base_src_loop: error: 内部数据流错误。0:00:00.971545793 834 0x7f70004a80 警告
basesrc gstbasesrc.c:3055:gst_base_src_loop: 错误:流停止,原因未协商 (-4) 0:00:00.978535326 834 0x7f6807c8f0 WARN v4l2bufferpool gstv4l2bufferpool.c:1518:gst_v4l2_buffer_pool_dqbuf:驱动程序不应该设置 v4l2_buffer。(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.105:gst_mini_object_copy:断言'mini_object!= NULL'失败
(gst-launch-1.0:834): GStreamer-CRITICAL **: 14:19:35.105: gst_caps_get_structure: 断言'GST_IS_CAPS (caps)' 失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.105:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834): GStreamer-CRITICAL **: 14:19:35.105: gst_caps_append_structure_full: 断言'GST_IS_CAPS (caps)' 失败
(gst-launch-1.0:834): GStreamer-CRITICAL **: 14:19:35.105: gst_caps_get_structure: 断言'GST_IS_CAPS (caps)' 失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.105:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834): GStreamer-CRITICAL **: 14:19:35.105: gst_caps_append_structure_full: 断言'GST_IS_CAPS (caps)' 失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.106:gst_mini_object_copy:断言'mini_object!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.106:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.106:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.106:gst_caps_append_structure_full:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.106:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.106:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.106:gst_caps_append_structure_full:断言'GST_IS_CAPS(caps)'失败错误:来自元素/GstPipeline:pipeline0/GstRTMPSrc:rtmpsrc0:内部数据流错误。
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.106:gst_mini_object_copy:断言'mini_object!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.106:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.106:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.106:gst_caps_append_structure_full:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.107:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.107:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834): GStreamer-CRITICAL **: 14:19:35.107: gst_caps_append_structure_full: 断言 'GST_IS_CAPS (caps)' 失败附加调试信息: gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline: pipeline0/GstRTMPSrc:rtmpsrc0:流媒体停止,原因未协商 (-4) 错误:管道不想预卷。将管道设置为 NULL ...
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.107:gst_mini_object_copy:断言'mini_object!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.108:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.108:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834): GStreamer-CRITICAL **: 14:19:35.108: gst_caps_append_structure_full: 断言'GST_IS_CAPS (caps)' 失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.108:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.108:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834): GStreamer-CRITICAL **: 14:19:35.108: gst_caps_append_structure_full: 断言'GST_IS_CAPS (caps)' 失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.108:gst_mini_object_copy:断言'mini_object!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.108:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.108:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834): GStreamer-CRITICAL **: 14:19:35.108: gst_caps_append_structure_full: 断言'GST_IS_CAPS (caps)' 失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.108:gst_caps_get_structure:断言'GST_IS_CAPS(caps)'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.109:gst_structure_copy:断言'结构!= NULL'失败
(gst-launch-1.0:834):GStreamer-CRITICAL **:14:19:35.109:gst_caps_append_structure_full:断言'GST_IS_CAPS(caps)'失败释放管道......