Merge MPEG-DASH segments (e.g. init.mp4 + segment.m4s) back to full source.mp4?

GPAC, http://gpac.wp.mines-telecom.fr/ , can be used to segment video together with the MPEG-DASH specification. One result is a combination of init files (ex, init.mp4) and several segments with a fixed duration (for example, segment-% d.m4s). What if I get these results and I like to flip / merge them into one complete source.mp4 file? Can I use GPAC or ffmpeg for this?

+6
source share
2 answers

You can simply use the cat or similar tools to complete this task:

 cat init.mp4 > source.mp4 cat segment-1.m4s >> source.mp4 cat segment-2.m4s >> source.mp4 ... 

To do this automatically for all segments in the current folder, you can use the following command:

cat init.mp4 $(ls -vx segment-*.m4s) > source.mp4

The -v option for ls sorts the output naturally (e.g. 1, 2, ..., 10, ..., 100), otherwise it sorts lexically (i.e. 1, 10, 100, 2, ... ) The -x option places the output in a row instead of columns.

+6
source

In the Windows cmd command shell, you can use the copy command to concatenate files as follows:

 copy init.mp4 +segment*.m4s source.mp4 

"help copy" provides all options

0
source

All Articles