Skip to content

Instantly share code, notes, and snippets.

@lucidbeaming
Created April 21, 2020 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucidbeaming/3e17ecb7eeb753438fc251a6c01f0e6f to your computer and use it in GitHub Desktop.
Save lucidbeaming/3e17ecb7eeb753438fc251a6c01f0e6f to your computer and use it in GitHub Desktop.
ffmpeg video - batch scale, normalize, OS X compatible and output to h264 .mp4 files
# Looks for all files with .mp4 extension. Scales to fit width while matching height.
# Fills the entire file area. Normalizes audio level and sets 44100 rate.
# Converts to yuv420p colorspace for Mac OS X compatibility. Outputs to subfolder named "out".
for i in *.mp4; do
ffmpeg -i "$i" -vf "scale=-1:480,crop=640:480,fps=fps=30" -filter:a loudnorm -ar 44100 -c:a aac -b:a 128k -c:v libx264 -crf 18 -preset veryfast -pix_fmt yuv420p "out/$i"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment