Combine MPEG-DASH segments (ex, init.mp4 + segments.m4s) back to a full source.mp4?

前提是你 提交于 2019-11-27 05:35:00

问题


GPAC, http://gpac.wp.mines-telecom.fr/, can be used to do video segmentation along with MPEG-DASH spec. One type of results is a combination of init files (ex, init.mp4) and several roughly fixed-duration segments (ex, segment-%d.m4s). What if I just got those results and I like to reverse/combine them back to one full source.mp4 file? Can I use GPAC or ffmpeg for this?


回答1:


You can just use the cat command or similar tools to do this job:

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, the following command can be used:

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

The -v parameter for ls sorts the output naturally (i.e. 1, 2, ..., 10, ..., 100), otherwise it sorts lexically (i.e. 1, 10, 100, 2, ...). The -x parameter puts the output on a line instead of columns.




回答2:


Under Windows cmd shell you can use the copy command for file concatenation in the following way:

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

"help copy" does provide you all options



来源:https://stackoverflow.com/questions/23485759/combine-mpeg-dash-segments-ex-init-mp4-segments-m4s-back-to-a-full-source-m

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!