How to Convert Video to Blu-ray Using FFmpeg
This article provides a straightforward guide on how to convert standard video files into Blu-ray compliant H.264 elementary streams or MPEG-TS files using FFmpeg. You will learn the exact command-line parameters required to meet strict hardware Blu-ray specifications, including profile limits, GOP structures, and color spacing.
To create a video stream that hardware Blu-ray players can successfully read, you must adhere to the H.264 High Profile, Level 4.1 standard, define specific buffer sizes, and enable x264’s compatibility flags.
Convert Video to Blu-ray H.264 Elementary Stream (.264)
If you plan to use professional authoring software to build your Blu-ray directory, you will need a raw H.264 elementary stream. Use the following command for a 1080p video at 23.976 frames per second:
ffmpeg -i input.mp4 -an -c:v libx264 -preset slow -profile:v high -level 4.1 -pix_fmt yuv420p -b:v 30M -maxrate 40M -bufsize 30M -color_primaries bt709 -color_trc bt709 -colorspace bt709 -g 24 -keyint_min 1 -sc_threshold 0 -bf 3 -b_strategy 1 -coder 1 -x264opts "bluray-compat=1:vbv-maxrate=40000:vbv-bufsize=30000:keyint=24:slices=4" output.264Convert Video to a Blu-ray Compatible MPEG-TS File (.ts)
If you need a multiplexed file containing both video and compatible audio (AC-3 format) in an MPEG-TS container, use this command:
ffmpeg -i input.mp4 -c:v libx264 -preset slow -profile:v high -level 4.1 -pix_fmt yuv420p -b:v 30M -maxrate 35M -bufsize 30M -color_primaries bt709 -color_trc bt709 -colorspace bt709 -g 24 -keyint_min 1 -sc_threshold 0 -bf 3 -b_strategy 1 -coder 1 -x264opts "bluray-compat=1:vbv-maxrate=35000:vbv-bufsize=30000:keyint=24:slices=4" -c:a ac3 -b:a 640k -f mpegts output.tsKey Parameter Explanations
-profile:v high -level 4.1: Restricts the output to the High Profile, Level 4.1, which is the maximum level supported by the Blu-ray specification for 1080p.-pix_fmt yuv420p: Sets the pixel format to YUV 4:2:0, required for standard consumer video playback.-color_primaries bt709 -color_trc bt709 -colorspace bt709: Defines the color space to Rec. 709, the standard for high-definition Blu-ray video.-x264opts "bluray-compat=1...": This critical flag optimizes the x264 encoder parameters specifically for Blu-ray hardware compatibility.slices=4: Divides each frame into four slices, which helps hardware decoders process the stream efficiently.vbv-maxrate=40000:vbv-bufsize=30000: Defines the Video Buffering Verifier (VBV) limits (40 Mbps maximum bitrate and 30 Mb buffer size) to prevent data peaks that could cause physical disc-reading errors.-g 24: Sets the GOP (Group of Pictures) size. For 24fps or 23.976fps video, a GOP size of 24 (or a multiple thereof) is standard for Blu-ray.-c:a ac3 -b:a 640k: Encodes the audio to Dolby Digital (AC-3) at a high-quality bitrate of 640 kbps, which is universally supported by Blu-ray players.