15

I'm new to Linux and I want to execute one command on every file in a loop:

avconv -i *.mp4 -vcodec copy -ac 2 -strict experimental *.mp4

Can any one tell me how I can do this? I have more than 100 files to convert. I just want to convert them into new files with the same names, but using different codecs. It works for one file but I don't know how to run it on all of the files. I found this avconv documentation but I can't find the answer in there either.

Knowledge Cube
  • 14,681
  • 15
  • 80
  • 151
Noman
  • 153
  • 1
  • 1
  • 5

1 Answers1

19

Try this:

for i in *.mp4; do avconv -i "$i" -vcodec copy -ac 2 -strict experimental "out-$i"; done
January
  • 35,223
  • 15
  • 82
  • 101