Skip to content

Instantly share code, notes, and snippets.

@oseiskar
Created January 18, 2020 09:02
Show Gist options
  • Save oseiskar/7ccad344d2d010f3c3aa818e4e231539 to your computer and use it in GitHub Desktop.
Save oseiskar/7ccad344d2d010f3c3aa818e4e231539 to your computer and use it in GitHub Desktop.
Miscellaneous FFmpeg scripts
# record lossless video to screengrab.mp4 after waiting 5 seconds, override without asking
sleep 5 && \
ffmpeg -y -video_size 1920x1080 -framerate 25 -f x11grab -i $DISPLAY -c:v libx264 -crf 0 -preset ultrafast screengrab.mp4
# lossless encoding of screengrab.mp4 with high quality, no audio ("-an", instead of "-c:a copy")
# CRF: "For x264, sane values are between 18 and 28. The default is 23"
# from start to 2 minutes
ffmpeg -ss 00:00:00 -i screengrab.mp4 -t 00:02:00 -c:v libx264 -preset slow -crf 22 -an output.mp4
# change video container without re-encoding
ffmpeg -i video.mkv -codec copy video.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment