Concatenate mp4 without re-encoding

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Concatenate mp4 without re-encoding

Ross O Sullivan
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.


Thanks for taking the time to read this and for your work on Gstreamer,
Ross O'Sullivan

Séanadh Ríomhphoist/

Email Disclaimer

Tá an ríomhphost seo agus aon chomhad a sheoltar leis faoi rún agus is lena úsáid ag an seolaí agus sin amháin é. Is féidir tuilleadh a léamh anseo. 

This e-mail and any files transmitted with it are confidential and are intended solely for use by the addressee. Read more here. 


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate mp4 without re-encoding

Sebastian Dröge-3
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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (981 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate mp4 without re-encoding

Ross O Sullivan
I am trying to get it working on a copy of the same video so streams should have the exact same configuration.

The error I'm currently getting is the following.

ERROR: from element /GstPipeline:pipeline0/GstQTDemux:d2: GStreamer encountered a general stream error.
Additional debug info:
qtdemux.c(5520): gst_qtdemux_loop (): /GstPipeline:pipeline0/GstQTDemux:d2:
streaming stopped, reason not-negotiated

Before that it is printing about the sink and src pad for the audio concat c and it's caps filter (audio/mpeg).

Thanks for the help,
Ross O'Sullivan

On 28 November 2016 at 21:28, Sebastian Dröge <[hidden email]> wrote:
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

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



Séanadh Ríomhphoist/

Email Disclaimer

Tá an ríomhphost seo agus aon chomhad a sheoltar leis faoi rún agus is lena úsáid ag an seolaí agus sin amháin é. Is féidir tuilleadh a léamh anseo. 

This e-mail and any files transmitted with it are confidential and are intended solely for use by the addressee. Read more here. 


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate mp4 without re-encoding

Sebastian Dröge-3
On Mon, 2016-11-28 at 21:53 +0000, Ross O Sullivan wrote:

> I am trying to get it working on a copy of the same video so streams
> should have the exact same configuration.
>
> The error I'm currently getting is the following.
>
> ERROR: from element /GstPipeline:pipeline0/GstQTDemux:d2: GStreamer
> encountered a general stream error.
> Additional debug info:
> qtdemux.c(5520): gst_qtdemux_loop ():
> /GstPipeline:pipeline0/GstQTDemux:d2:
> streaming stopped, reason not-negotiated
>
> Before that it is printing about the sink and src pad for the audio
> concat c and it's caps filter (audio/mpeg). 
Check the full debug log, or provide it here. There will be information
about what exactly is wrong there.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (981 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate mp4 without re-encoding

Ross O Sullivan
I have enclosed the debug log in a text file.

Thanks for the help,
Ross

On 29 November 2016 at 10:40, Sebastian Dröge <[hidden email]> wrote:
On Mon, 2016-11-28 at 21:53 +0000, Ross O Sullivan wrote:
> I am trying to get it working on a copy of the same video so streams
> should have the exact same configuration.
>
> The error I'm currently getting is the following.
>
> ERROR: from element /GstPipeline:pipeline0/GstQTDemux:d2: GStreamer
> encountered a general stream error.
> Additional debug info:
> qtdemux.c(5520): gst_qtdemux_loop ():
> /GstPipeline:pipeline0/GstQTDemux:d2:
> streaming stopped, reason not-negotiated
>
> Before that it is printing about the sink and src pad for the audio
> concat c and it's caps filter (audio/mpeg). 

Check the full debug log, or provide it here. There will be information
about what exactly is wrong there.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



Séanadh Ríomhphoist/

Email Disclaimer

Tá an ríomhphost seo agus aon chomhad a sheoltar leis faoi rún agus is lena úsáid ag an seolaí agus sin amháin é. Is féidir tuilleadh a léamh anseo. 

This e-mail and any files transmitted with it are confidential and are intended solely for use by the addressee. Read more here. 


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

debug.txt (15K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate mp4 without re-encoding

Sebastian Dröge-3
On Tue, 2016-11-29 at 12:04 +0000, Ross O Sullivan wrote:
> I have enclosed the debug log in a text file.

That's not a debug log. Please set GST_DEBUG=6 and run again :)

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (981 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate mp4 without re-encoding

Ross O Sullivan
Oops sorry, I wasn't aware of that debug flag.

The log is 49mb so I compressed using xz.

Thanks,
Ross

On 29 November 2016 at 12:24, Sebastian Dröge <[hidden email]> wrote:
On Tue, 2016-11-29 at 12:04 +0000, Ross O Sullivan wrote:
> I have enclosed the debug log in a text file.

That's not a debug log. Please set GST_DEBUG=6 and run again :)

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



Séanadh Ríomhphoist/

Email Disclaimer

Tá an ríomhphost seo agus aon chomhad a sheoltar leis faoi rún agus is lena úsáid ag an seolaí agus sin amháin é. Is féidir tuilleadh a léamh anseo. 

This e-mail and any files transmitted with it are confidential and are intended solely for use by the addressee. Read more here. 


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

debug.log.xz (3M) Download Attachment