Skip to content

Instantly share code, notes, and snippets.

@cadebrown
Last active February 28, 2022 17:01
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 cadebrown/dd4a4d042dd6c6bd56db8df7ce50fe65 to your computer and use it in GitHub Desktop.
Save cadebrown/dd4a4d042dd6c6bd56db8df7ce50fe65 to your computer and use it in GitHub Desktop.
use GPU acceleration with FFMPEG
# run this to turn frames into video, using a NVIDIA GPU
ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -r 30 \
-i 'frame_%05d.png' -c:a copy -c:v h264_nvenc -b:v 50M \
output.mp4
# CPU
ffmpeg -y -vsync 0 -r 30 \
-i 'frame_%05d.png' -c:a copy -c:v h265 -b:v 50M \
output.mp4
# CPU, with upscaling to 1080p
ffmpeg -y -vsync 0 -r 15 \
-i 'frame_%05d.png' -vf scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1,setsar=1 -c:a copy -c:v libx265 -b:v 50M \
output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment