I have several chunks in folder.
0001.mp4 0002.mp4 0003.mp4 ... 0112.mp4
I would like to merge them into full.mp4
I tried to use:
avconv -f concat -i <(printf "file '%s'\n" /root/chunk/*.mp4) -y \ -c copy /root/test/full.mp4
Unknown input format: 'concat'
avconv -f concat -i <(printf "%s|" /root/chunk/*.mp4) -y \ -c copy /root/test/full.mp4
Unknown input format: 'concat'
avconv -i concat:`ls -ltr /root/chunk/*.mp4 | awk 'BEGIN {ORS="|"} { print $9 }'` \ -c:v copy -c:a copy /root/test/full.mp4
In last edition only one input file was catched to output.
How to merge all chunks from folder into full video?
I don't want to use ffmpeg or other. Avconv only.
When using FFmpeg to merge a series of video clips, the process is called concatenation, or concat for short. There are several ways that videos can be concatenated, depending on whether the individual videos share the same codec or not.
mp4
files cannot be simply concatenated, as the "accepted" answer suggests.
If you run that, and that alone, you'll end up with output.mp4
having only the contents of file1.mp4
.
That said, what you're looking to do in the original question can in fact be done, as long as you split original file into mpeg streams correctly.
The following commands will split input.mp4
into 3x 60 second segments, in file[1-3].ts:
avconv -ss 0 -i input.mp4 -t 60 -vcodec libx264 -acodec aac \ -bsf:v h264_mp4toannexb -f mpegts -strict experimental -y file1.ts avconv -ss 0 -i input.mp4 -t 60 -vcodec libx264 -acodec aac \ -bsf:v h264_mp4toannexb -f mpegts -strict experimental -y file2.ts avconv -ss 0 -i input.mp4 -t 60 -vcodec libx264 -acodec aac \ -bsf:v h264_mp4toannexb -f mpegts -strict experimental -y file3.ts
You can then put them back together much as the other answer suggests:
avconv -i concat:"file1.ts|file2.ts|file3.ts" -c copy \ -bsf:a aac_adtstoasc -y full.mp4
I used this process to create a scalable, parallel transcoder as described at:
avconv -i concat:file1.mp4\|file2.mp4 -c copy output.mp4
I don't know if works with any container's type ( worked for me with AVI
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With