post image January 7, 2022 | 1 min Read

Concat mp4 file with ffmpeg

**Concatenated'' video files (e.g. *.mp4) specified in *.txt file ‘‘created’’ on the file

Example: If you got *.mp4 files starting from: 1 to 46

file sound.mp4
file 46-Con-xyz-rendered.mp4
file sound.mp4
for i in {1..46}; do 
    file=$(echo ${i}-*-rendered.mp4); 
    touch ${file}; 
    echo -e "file sound.mp4\nfile ${file}\nfile sound.mp4" > ${file%.mp4}.txt; 
    ffmpeg -f concat -safe 0 -i ${file%.mp4}.txt -c copy ${file%.mp4}-final.mp4; 
done
author image

Jan Toth

I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …

comments powered by Disqus