How do I convert a batch of avis into mp4s?
1
vote
1
answer
96
views
I have several avi files in the one directory that I would like to convert to mp4s using avconv. Now I know the basic procedure of how to do this, manually, for each avi, namely (where
$@
are the variables that change with each new avi):
avconv -i $@.avi -c copy $@.mp4
but I was wondering if anyone knows of how to write a bash script to do this automatically. I have tried a modified version of the answer provided to my [optimizing PNG question](https://unix.stackexchange.com/questions/223156/how-do-i-write-a-script-to-automatically-optimize-all-the-pngs-in-my-mediawiki-i) namely:
for k in find . -name "*.avi"
do
avconv -i "$k" -c copy "$k.mp4"
done
but as k is of the form ./filename
avconv could not understand it when given as input. Another issue is that even though I used quotation marks, because many of my avis have spaces in their file names, for some reason avconv was being run for every space-separated word in the file's name.
Asked by Josh Pinto
(3533 rep)
Sep 22, 2015, 02:49 PM
Last activity: Sep 22, 2015, 03:14 PM
Last activity: Sep 22, 2015, 03:14 PM