拆分多个视频流并将其叠加到Gstreamer中的一个视频输出中

时间:2017-11-29 13:35:59

标签: video gstreamer

我有两台RTSP摄像机的设置,我将两个同步视频流记录到一个容器文件中,两个流都是4K。我这样做是为了让流之间有时间同步。这很有效。

现在什么不起作用:

我想拍摄这两个视频流,将它们垂直堆叠在一起,然后将它们写成两个输出文件。我可以在两个单独的管道中执行此操作 - 一个将流分成两个单独的文件,然后我可以将其输入到堆叠管道中,但我需要在一个管道中执行此操作。

在FFMPEG中,我可以通过以下方式完成此任务:

filter_complex "[1][0]scale2ref[2nd][ref];[ref][2nd]vstack"

但就我目前的目的而言,我想与Gstreamer一起做。我能来的最近的是:

gst-launch-1.0 -e \
videomixer name=mix \
sink_0::xpos=0 sink_0::ypos=0 \
sink_1::xpos=0 sink_1::ypos=2160 \
sink_2::xpos=0 sink_2::ypos=0 \
! videoconvert ! x264enc ! h264parse ! mp4mux \
! filesink location=output.mp4 \
videotestsrc pattern=3 \
! "video/x-raw,format=AYUV,width=3840,height=4320,framerate=(fraction)30/1" \
! queue \
! mix.sink_0 \
filesrc location=input.mp4 \
! qtdemux name=demux \
demux.video_0 \
! h264parse ! avdec_h264 ! queue ! mix.sink_1 \
demux.video_1 \
! h264parse ! avdec_h264 ! queue ! mix.sink_2

但这只会生成一个空文件,命令行只会永久挂起。我已经尝试了许多不同的元素和组合,但没有真正得到回报。我希望输出是一个mp2文件,用h265编码,但这对我来说也是失败的。

GST_DEBUG = 2 out是:

Setting pipeline to PAUSED ...
0:00:00.018321312 15536 0x5645703a90c0 WARN                 basesrc     gstbasesrc.c:3480:gst_base_src_start_complete:<filesrc0> pad not activated yet
Pipeline is PREROLLING ...
0:00:00.018448918 15536 0x5645703954a0 WARN                 qtdemux     qtdemux_types.c:228:qtdemux_type_get: unknown QuickTime node type pasp
0:00:00.018463999 15536 0x5645703954a0 WARN                 qtdemux qtdemux_types.c:228:qtdemux_type_get: unknown QuickTime node type pasp
0:00:00.018505858 15536 0x5645703954a0 WARN                 qtdemux qtdemux.c:3008:qtdemux_parse_trex:<demux> failed to find fragment defaults for stream 1
0:00:00.018573441 15536 0x5645703954a0 WARN                 qtdemux qtdemux.c:3008:qtdemux_parse_trex:<demux> failed to find fragment defaults for stream 2
0:00:00.018599207 15536 0x5645703954a0 WARN                 basesrc     gstbasesrc.c:2389:gst_base_src_update_length:<filesrc0> processing at or     past EOS
Redistribute latency...
Redistribute latency...
0:00:00.029453801 15536 0x564570395050 WARN             collectpads gstcollectpads.c:1411:gst_collect_pads_recalculate_waiting:<videomixer2-0-collectpads> GstCollectPads has no time segment, assuming 0 based.
Redistribute latency...
Redistribute latency...
0:00:00.172949969 15536 0x564570395000 WARN                 x264enc :0::<x264enc0> frame MB size (240x270) > level limit (36864)
0:00:00.172971144 15536 0x564570395000 WARN                 x264enc :0::<x264enc0> DPB size (4 frames, 259200 mbs) > level limit (2 frames, 184320 mbs)
Redistribute latency...
0:00:00.194095716 15536 0x564570395050 WARN               videopool     gstvideopool.c:219:video_buffer_pool_set_config:<videobufferpool6> no caps in config
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
^Chandling interrupt.
Interrupt: Stopping pipeline ...
EOS on shutdown enabled -- Forcing EOS on the pipeline
Waiting for EOS...
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Interrupt while waiting for EOS - stopping pipeline...
Execution ended after 0:00:18.836726023
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

如果不管它会永远停在GstSystemClock上,文件大小总是大约150kb。任何帮助将不胜感激。

0 个答案:

没有答案