Skip to content

Instantly share code, notes, and snippets.

@crashGoBoom
Last active January 10, 2019 20:06
Show Gist options
  • Save crashGoBoom/da33cdad0da183342059ad808cd8da36 to your computer and use it in GitHub Desktop.
Save crashGoBoom/da33cdad0da183342059ad808cd8da36 to your computer and use it in GitHub Desktop.
ffmpeg batch conversion
# Convert 4:3 aspect ratio files to 16:9 with black bars. For each m4v file convert and encode using crf 18.
for i in *.m4v; do ffmpeg -i "$i" -vf "scale=960x720,setsar=1,pad=1280:720:160:0" -crf 18 "${i%.m4v}.mp4"; done
# For normal conversion to mp4.
for i in *.m4v; do ffmpeg -i "$i" "${i%.m4v}.mp4"; done
# For mov to mp4 conversion with some compression.
for i in *.mov; do ffmpeg -i "$i" -crf 23 -vcodec libx264 -acodec aac "${i%.mov}.mp4"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment