Concatenate mp4 without re-encoding

Sebastian Dröge sebastian at centricular.com
Mon Nov 28 21:28:08 UTC 2016


On Mon, 2016-11-28 at 14:50 +0000, Ross O Sullivan wrote:
> Hi,
> 
> I'm making a video editor with the gstreamer C api as part of a University project and I have been having trouble creating a concatenate feature for mp4 files without re-encoding.  I was hoping you could point me in the direction of a solution.
> 
> 
> My current design of the pipeline is as follows:
> 
>     source1       source2
>     demux1          demux2
> video   audio   video   audio
>   \       \        /       /
>             queue
>     \       \     /       /
>       \        x        /
>  concat Videos   concat audio
>             \      /
>               muxer
>                 |
>             filesink
> 
> I have tried to create a similar design in gst-launch with the following command but I keep getting stream errors. 
> 
> gst-launch-1.0 -v mp4mux name=mp4 ! filesink location='out.mp4' \
>         concat name=c ! audio/mpeg ! mp4.audio_0 \
>         concat name=c2 ! video/x-h264 ! mp4.video_0 \
>         filesrc location='left.mp4' ! qtdemux name=d1 \
>         filesrc location='right.mp4' ! qtdemux name=d2 \
>         d1.audio_0 ! audio/mpeg ! queue ! c. \
>         d2.audio_0 ! audio/mpeg ! queue ! c. \
>         d1.video_0 ! video/x-h264 ! queue ! c2. \
>         d2.video_0 ! video/x-h264 ! queue ! c2.

You need to make sure that all streams have exactly the same
configuration. Not just e.g. video width/height, but also the
codec_data must be exactly the same. MP4 does not support changes in
the middle of a stream.

What kind of stream errors do you get, what do you see in the debug
logs shortly before them?

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20161128/de4d7001/attachment.sig>


More information about the gstreamer-devel mailing list