Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
808 views
in Technique[技术] by (71.8m points)

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...