Skip to content

Instantly share code, notes, and snippets.

@homingli
Created September 7, 2020 20:08
Show Gist options
  • Save homingli/fd9fd0adaacebbfe32b6de1baf66afea to your computer and use it in GitHub Desktop.
Save homingli/fd9fd0adaacebbfe32b6de1baf66afea to your computer and use it in GitHub Desktop.
### re-Encoding
# re-encode video, using x265 HEVC Encoding, LAME mp3 encoding (48K CBR)
ffmpeg -i in.mp4 -vcodec libx265 -acodec libmp3lame -b:a 48k out.mp4
### Clipping out a part of the video...
# 60 second clip starting 90 seconds in (stream copy)
ffmpeg -ss 90 -i orig.mp4 -t 60 -c copy out.mp4
# or re-encoding (same 60s clip, starting 90s in)
ffmpeg -i orig.mp4 -ss 90 -strict -2 -t 60 re-encode-out.mp4
# source, with more details: http://www.markbuckler.com/post/cutting-ffmpeg/
### resizing video
# re-encode with libx265 and shrink width & height by half
ffmpeg -i out.mp4 -vcodec libx265 -crf 28 -vf "scale=iw/2:ih/2" out265.mp4
### joining videos
# source: https://stackoverflow.com/a/11175851
# source: https://ffmpeg.org/faq.html#How-can-I-join-video-files_003f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment