Batch convert videos FFmpeg
Using ffmpeg to convert a load of videos at once
To get you started, the basics would be:
ffmpeg -i [input filename] -vcodec libx264 -vf scale=1280:720 -crf 25 -c:a copy [output filename]
This will use the x264 codec
Scale the video down to 1280:720
Set the quality rate to 25 (0 highest quality, 51 lowest)
Copy the audio
I created a script called video-reduction.sh, with this in it:
ffmpeg -i $1 -vcodec libx264 -vf scale=1280:720 -crf 25 -c:a copy $1_new.mp4
Make sure the script is executable:
chmod +x video-reduction.sh
Now to convert a batch of MP4 files you can run:
ls *.mp4 -1 | xargs -I{} ./video-reduction.sh {}
ffmpeg -i [input filename] -vcodec libx264 -vf scale=1280:720 -crf 25 -c:a copy [output filename]
This will use the x264 codec
Scale the video down to 1280:720
Set the quality rate to 25 (0 highest quality, 51 lowest)
Copy the audio
I created a script called video-reduction.sh, with this in it:
ffmpeg -i $1 -vcodec libx264 -vf scale=1280:720 -crf 25 -c:a copy $1_new.mp4
Make sure the script is executable:
chmod +x video-reduction.sh
Now to convert a batch of MP4 files you can run:
ls *.mp4 -1 | xargs -I{} ./video-reduction.sh {}