Gstreamer管道可连接两个媒体容器(视频和音频流) [英] Gstreamer pipeline to concat two media containers (video and audio streams)

查看:338
本文介绍了Gstreamer管道可连接两个媒体容器(视频和音频流)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是gstreamer的初学者,并且正在为Gstreamer 1.0管道无缝连接两个MP4媒体容器(它们都带有视频和音频流)而苦苦挣扎。
在我看来,使用 concat元素是最方便的方法,并且我可以同时合并两个视频流:

I am a beginner to gstreamer and struggling with a pipeline for Gstreamer 1.0 to concatenate seamlessly two MP4 media containers, both of them with video and audio streams. It seems to me that using "concat" element is the most convenient way, and I am able to concat either video streams:

gst-launch-1.0 concat name=c ! autovideosink  filesrc location=1.mp4 ! decodebin ! videoconvert ! c.  filesrc location=2.mp4 ! decodebin ! videoconvert ! c.

或音频流:

gst-launch-1.0 concat name=c ! autoaudiosink  filesrc location=1.mp4 ! decodebin ! audioconvert ! c.  filesrc location=2.mp4 ! decodebin ! audioconvert ! c.

但到目前为止,创建一个将容器与视频和音频连接在一起的管道没有运气。

but no luck so far with creating a pipeline which concatenates both containers with video and audio.

来自这篇文章我意识到 streamsynchronizer 是必需的,所以有人可以帮助示例管道显示它的外观吗?

From this article I realized that streamsynchronizer is required for that, so could someone please help with sample pipeline showing how it might look like ?

推荐答案

好的,我想到了这个,但有时alsa说该流的状态不正确。

Ok I came up with this but sometimes the alsa says that the stream is not in a proper state..

GST_DEBUG=3 gst-launch-1.0 concat name=c2 ! videoconvert ! videorate ! autovideosink concat name=c ! audioconvert ! audiorate ! alsasink filesrc location=big.mp4 ! decodebin name=d1 ! audio/x-raw ! queue ! c. filesrc location=big2.mp4 ! decodebin name=d2 ! audio/x-raw ! queue ! c. d1. ! video/x-raw ! queue ! c2. d2. ! video/x-raw ! queue ! c2.

管道的小信息:

1,您不必使用audioconvert / videoconvert来识别来自解码bin的流的类型-您可以安全地使用 audio / x-raw video / x-raw ..解码音频/视频后始终是原始格式。

1, You dont have to use audioconvert/videoconvert to recognize the type of stream from decodebin - you can safely use audio/x-raw or video/x-raw respectively.. after decoding the audio/video is always in raw format.

2,使用2个concat元素,因为一个只能一次处理一个流..但是如果您使用两个连接器,您可能会担心音频/视频不同步..我希望将其同步,因为它们都生活在同一个管道中,并且每个管道都有一个时钟提供程序,因此从理论上讲应该没问题..当您需要适当的同步时,将所有内容放在一个管道中始终很重要。

2, use 2 concat elements as one can only handle one stream at time.. but if you use two concats you may fear that audio/video is not synchronized.. I hope it is synced as they both live in same pipe which has one clock provider for everything so theoreticaly it should be ok.. its always important to have everything in one pipe when you need proper synchronization.

3,我使用了alsasink,但是您可以使用任何适合您的接收器。我为我选择了非常不喜欢的Pulsesink。我喜欢使用这种音频管道: audioconvert!音频率! alsasink

3, I used alsasink but you may use whatever sink suits you.. sometimes the autoaudiosink picked pulsesink for me which I do not like very much.. I like to use this kind of audio end of pipe: audioconvert ! audiorate ! alsasink

4,我已经看到了这些错误,但是添加队列后它消失了..但是对于您我不知道它们会出现..

4, I have seen these errors but after adding queue it went away.. but they may appear for you I dont know..

0:00:00.053972316 11839 0x7f0274003b70 WARN           audiobasesink gstaudiobasesink.c:1139:gst_audio_base_sink_wait_event:<alsasink0> error: Sink not negotiated before eos event.
ERROR: from element /GstPipeline:pipeline0/GstAlsaSink:alsasink0: The stream is in the wrong format.
Additional debug info:
gstaudiobasesink.c(1139): gst_audio_base_sink_wait_event (): /GstPipeline:pipeline0/GstAlsaSink:alsasink0:
Sink not negotiated before eos event.
ERROR: pipeline doesn't want to preroll.

这篇关于Gstreamer管道可连接两个媒体容器(视频和音频流)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆