1

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.

2 Answers 2

3

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
1
  • 3
    you can avoid cat using while ..do..done < list-of-files.txt Nov 8, 2013 at 20:17
0
for i in *.avi; do ffmpeg -i "$i" -codec copy "`echo $i | sed 's/.avi$/.mp4/'`"; done

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .