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
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.
Little info to the pipe:
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, 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, 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, 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: 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.