How can I turn:




when looping a directory using avconv?

Right now, they are outputted as:


and here is what I am trying:

for i in /media/MediaOne/Movies/Kids/*.avi; do avconv -i "$i" -c copy "$i.mp4"; done

tried this too:

for i in /media/MediaOne/Movies/Kids/*.avi; do avconv -i "$i" -c copy "/media/MediaOne/converted/$i.mp4"; done

but got a bunch of errors, because $i/media/MediaOne/converted/ did not exist

  • tried i%, but the files were named i%.mp4 – Kevin Jan 26 '14 at 18:55

Use basename command to remove extension from file name, notice special quotation marks

`$(basename $i .avi).mp4`

instead of


dirname may help to extract path to folder containing input file. (man dirname for help)

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.