Skip to content

Instantly share code, notes, and snippets.

@rabernat
Last active June 7, 2023 15:34
Show Gist options
  • Save rabernat/08922c2143cc7338a9cf to your computer and use it in GitHub Desktop.
Save rabernat/08922c2143cc7338a9cf to your computer and use it in GitHub Desktop.
ffmpeg encoding command
# good info:
# https://trac.ffmpeg.org/wiki/Encode/H.264
# assuming the input files are 1920x1080
ffmpeg -i full_1080p/transformation_full.%04d.png -c:v libx264 -preset veryslow -crf 2 -pix_fmt yuv420p -framerate 25 output.mov
# or with padding (1080x1080 input)
ffmpeg -i movie_frames/frame1024_%04d.png -vf 'pad=width=1920:x=420:color=white' -c:v libx264 -preset veryslow -crf 2 -pix_fmt yuv420p -framerate 25 output_square.mov
# downsize to 720
ffmpeg -i full_1080p/transformation_full.%04d.png -vf scale=1280:720 -c:v libx264 -preset veryslow -crf 2 -pix_fmt yuv420p -framerate 25 output.mov
# compress and re-encode 1080
ffmpeg -i My\ Movie.mp4 -vf scale=1280:720 -c:v libx264 -b:v 1000k -pix_fmt yuv420p -strict -2 test.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment