Skip to content

Instantly share code, notes, and snippets.

@cjLGH
Last active January 28, 2019 07:27
Show Gist options
  • Save cjLGH/b96c050567f7bc4ff3cd1fd148515659 to your computer and use it in GitHub Desktop.
Save cjLGH/b96c050567f7bc4ff3cd1fd148515659 to your computer and use it in GitHub Desktop.
H.264 to H.265

H.264 to H.265

FFMPEG Commands

Presets Medium and Veryfast, and CRF of 22

Command: ffmpeg -i "INPUT.mkv" -c:a copy -c:v libx265 -preset medium -x265-params crf=22 "OUTPUT.mkv"
Command: ffmpeg -i "INPUT.mkv" -c:a copy -c:v libx265 -preset veryfast -x265-params crf=22 "OUTPUT.mkv"

Two-Pass Encoding - 200 MiB

Original File: INPUT.mkv
Original File Duration (seconds): ~2706

Encoding Total Bitrate (kBit): ( 200 MiB * 8192 [converts MiB to kBit] / ~2706 seconds = ~605 kBit/s total bitrate
Encoding Video Bitrate (kBit): 605 - 128 kBit/s (desired audio bitrate) = 477 kBit/s video bitrate

Command Pass 1: ffmpeg -y -i "INPUT.mkv" -c:v libx265 -b:v 470k -x265-params pass=1 -an -f matroska /dev/null
Command Pass 2: ffmpeg -i "INPUT.mkv" -c:v libx265 -b:v 470k -x265-params pass=2 -c:a aac -b:a 128k "O.mkv"

Two-Pass Encoding - 350 MiB

Original File: INPUT.mkv
Original File Duration (seconds): ~2706

Encoding Total Bitrate (kBit): ( 350 MiB * 8192 [converts MiB to kBit] / ~2706 seconds = ~1060 kBit/s total bitrate
Encoding Video Bitrate (kBit): 1060 - 320 kBit/s (desired audio bitrate) = 740 kBit/s video bitrate

Command Pass 1: ffmpeg -y -i "INPUT.mkv" -c:v libx265 -b:v 740k -x265-params pass=1 -an -f matroska /dev/null
Command Pass 2: ffmpeg -i "INPUT.mkv" -c:v libx265 -b:v 740k -x265-params pass=2 -c:a aac -b:a 320k "S01E01-twopass-custom-350mb.mkv"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment