Running Ubuntu 13.10 with a fully compiled ffmpeg. I know the code for the actual conversion is ffmpeg -i video.mp4 -codec copy video.avi

I just need a plain and simple Bash script to do that for, say, forty or fifty of the .mp4 files.


If you have a list of file you can use something like:

cat list-of-files.txt | while read file; do ffmpeg -i $file -codec copy ${file%%.mp4}.avi; done

or simply

cd /path/; ls *.mp4 | while read file; do ffmpeg -i $file -codec copy ${file%%.mp4}.avi; done
  • 3
    you can avoid cat using while ..do..done < list-of-files.txt Nov 8 '13 at 20:17
for i in *.avi; do ffmpeg -i "$i" -codec copy "`echo $i | sed 's/.avi$/.mp4/'`"; done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.