How to append one mp4 file to another?

sonntex sonntex at gmail.com
Mon Oct 31 14:12:48 UTC 2016


> What is it that you want to achieve here? You can transcode or transmux
> the files into a new MP4 container, or if this is fragmented MP4 you
> can also directly append them to each other in theory.

I grab jpeg stream from uvc camera, transcode it to h264 and mux it to
small mp4 files (about one minute duration). As a result I have sequence of
small faststart mp4 files with the same codec inside and I want to glue it
to one large file.

I tried to use append=true for filesink, but resulted mp4 file has wrong
duration:

# ls -l
total 59252
-rw-r--r-- 1 root root 19556905 Jan  1 00:06 video-0.mp4
-rw-r--r-- 1 root root 21036712 Jan  1 00:07 video-1.mp4
-rw-r--r-- 1 root root 20076108 Jan  1 00:08 video-2.mp4
# gst-discoverer-1.0 -v video-* | grep Duration
  Duration: 0:00:56.507222222
  Duration: 0:00:59.897777777
  Duration: 0:00:58.152777777
# gst-launch-1.0 -q filesrc location="video-0.mp4" ! qtdemux ! h264parse !
mp4mux faststart=true ! filesink location="video.mp4" append=true
# gst-launch-1.0 -q filesrc location="video-1.mp4" ! qtdemux ! h264parse !
mp4mux faststart=true ! filesink location="video.mp4" append=true
# gst-launch-1.0 -q filesrc location="video-2.mp4" ! qtdemux ! h264parse !
mp4mux faststart=true ! filesink location="video.mp4" append=true
# ls -l
total 118306
-rw-r--r-- 1 root root 19556905 Jan  1 00:06 video-0.mp4
-rw-r--r-- 1 root root 21036712 Jan  1 00:07 video-1.mp4
-rw-r--r-- 1 root root 20076108 Jan  1 00:08 video-2.mp4
-rw-r--r-- 1 root root 60471249 Jan  2 21:31 video.mp4
# gst-discoverer-1.0 -v video.mp4 | grep Duration
  Duration: 0:00:56.458888888
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20161031/2769489d/attachment-0001.html>


More information about the gstreamer-devel mailing list