I am using this line to batch convert mp4 files to webm files. For all mp4 files i need the output files to be of same name but .webm extension. For example if i have video1.mp4 and video2.mp4 then after conversion i need two files i.e video1.webm and video2.webm. How can i achieve this using bash script?
for f in *.mp4; do ffmpeg -i "$f" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "$f".webm; done
The above code will change the output file to video1.mp4.webm. Thanks!
Try this ...
for f in *.mp4;
do
ffmpeg -i "$f" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${f%.mp4}".webm;
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With