My scripts for converting various video formats to mp4 using ffmpeg, which is amazing!
Used my macbook with the M4 Pro chip and it flew through all these.
<pre>
for file in *.mov; do
ffmpeg -i "$file" -c:v libx264 -crf 23 -c:a aac -b:a 128k -movflags +faststart "${file%.mov}.mp4"
done
for file in *.MOV; do
ffmpeg -i "$file" -c:v libx264 -crf 23 -c:a aac -b:a 128k -movflags +faststart "${file%.MOV}.mp4"
done
for file in *.avi; do
ls -la "$file"
ffmpeg -i "$file" -c:v libx264 -preset veryslow -crf 23 -c:a aac -b:a 128k -movflags +faststart "${file%.avi}.mp4"
done
for file in *.m4v; do
ffprobe -v error -show_streams -select_streams v:0 "$file" | grep codec_name
done
for file in *.mpg; do
ls -la "$file"
ffmpeg -i "$file" -c:v libx264 -preset veryslow -crf 23 -c:a aac -b:a 128k -movflags +faststart "${file%.mpg}.mp4"
done
ffmpeg -i input.mp4 -c:v libx264 -crf 28 -preset veryslow -c:a copy output.mp4
ffmpeg -i input.mp4 -c:v libx264 -crf 28 -preset veryslow -c:a copy output.mp4
ffmpeg -i "1994-05-20-FincherVideo-WeddingRehersal-1-Chapter1.mp4" -c:v libx264 -crf 28 -preset veryslow -c:a copy "1994-05-20-FincherVideo-WeddingRehersal-1-Chapter1a.mp4"
#With certain processes I would define a variable and use it in scripts
export video="1997-02-12-Baby.m4v"
for file in *.mp4; do
ffmpeg -i "$file" -c:v libx264 -crf 28 -preset veryslow -c:a copy "$file"-new.mp4
done
for file in *.m4v; do
ls -la "$file"
ffmpeg -i "$file" -c:v libx264 -preset veryslow -crf 23 -c:a aac -b:a 128k -movflags +faststart "${file%.m4v}.mp4"
done
# this re-encodes the mp4, but makes it smaller
for file in *.mp4; do
ffmpeg -i "$file" -c:v libx264 -crf 28 -preset veryslow -c:a copy "$file"-new.mp4
done