Skip to content

Instantly share code, notes, and snippets.

@dantheman213

dantheman213/ffmpeg.md

Last active May 3, 2020
Embed
What would you like to do?
ffmpeg cheatsheet

ffmpeg cheatsheet

Extract video at 30 seconds in and the duration with be 5 seconds

ffmpeg -ss 00:00:30 -i orginalfile -t 00:00:05 -vcodec copy -acodec copy newfile

Add a watermark logo to the bottom right of the video offset by 30 x 30 from corner

ffmpeg -i input.mp4 -i logo.png -filter_complex "overlay=x=(main_w-overlay_w)-30:y=(main_h-overlay_h)-30" output.mp4

Compress Bluray source mkv

https://support.plex.tv/articles/203810286-what-media-formats-are-supported/

http://jell.yfish.us/

Encode to HEVC / AAC

  • Provides excellent compression for storage
  • As of today (2020) will likely need to be transcoded rather than streamed directly so your server should have a powerful CPU
  • In future more client hardware will hopefully support these natively and require less CPU involvment from server
1080p high bitrate, SDR 8-bit color, HEVC/x265; 7.1 channel audio with 800kbps
ffmpeg -i Movie.2020.BLURAY.HD.REMUX.mkv -map_metadata 0 -c:v libx265 -crf 23 -pix_fmt yuv420p -preset slow -acodec aac -b:a 800k -ac 8 -c:s copy -movflags +faststart -f matroska -y Movie.2020.BLURAY.HD.RIP.1080p.x265.AAC.mkv
2160p, high bitrate, HDR 10-bit color, HEVC/x265; 7.1 channel audio with 800kbps
ffmpeg -i Movie.2020.BLURAY.UHD.4K.REMUX.mkv -map_metadata 0 -c:v libx265 -crf 23 -pix_fmt yuv420p10le -preset slow -acodec aac -b:a 800k -ac 8 -c:s copy -movflags +faststart -f matroska -y Movie.2020.BLURAY.UHD.RIP.2160p.4K.x265.AAC.mkv

Notes

-metadata title="The Movie Name" -metadata year="2020"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.