Skip to content

Instantly share code, notes, and snippets.

@ihutornoy
Last active April 16, 2021 11:19
Show Gist options
  • Save ihutornoy/cb97ceea70178fbd699c822723668798 to your computer and use it in GitHub Desktop.
Save ihutornoy/cb97ceea70178fbd699c822723668798 to your computer and use it in GitHub Desktop.
CUDA
-hwaccel cuda
//*.mp4 compressed
ffmpeg -hwaccel cuda -i input.mp4 -vcodec libx264 -crf 24 output.mp4
//*.webm for web
ffmpeg -hwaccel cuda -i input.mp4 -c:v libvpx -crf 30 -b:v 1M -b:a 128k -c:a libopus -an output.webm
//save poster
ffmpeg -hwaccel cuda -i input.mp4 -ss 00:00:00 -vframes 1 output.jpg
//loseless vp9
ffmpeg -hwaccel cuda -i input.mp4 -b:v 0 -crf 30 -pass 1 -an -f webm /dev/null
ffmpeg -hwaccel cuda -i input.mp4 -b:v 0 -crf 30 -pass 2 output.webm
# Output a single frame from the video into an image file:
ffmpeg -hwaccel cuda -i input.mov -ss 00:00:14.435 -vframes 1 out.png
# Output one image every second, named out1.png, out2.png, out3.png, etc.
# The %01d dictates that the ordinal number of each output image will be formatted using 1 digits.
ffmpeg -hwaccel cuda -i input.mov -vf fps=1 out%d.png
# Output one image every minute, named out001.jpg, out002.jpg, out003.jpg, etc.
# The %02d dictates that the ordinal number of each output image will be formatted using 2 digits.
ffmpeg -hwaccel cuda -i input.mov -vf fps=1/60 out%02d.jpg
# Extract all frames from a 24 fps movie using ffmpeg
# The %03d dictates that the ordinal number of each output image will be formatted using 3 digits.
ffmpeg -hwaccel cuda -i input.mov -r 24/1 out%03d.jpg
# Output one image every ten minutes:
ffmpeg -hwaccel cuda -i input.mov -vf fps=1/600 out%04d.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment