videoffmpegh.264blu-ray

Extend Frame Size and Re-Encoding Video to be Blu-Ray Compliant with ffmpeg and tsMuxer


I have a media file with the following video stream:

Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709), 1440x1080 [SAR 1:1 DAR 4:3], 23.98 fps, 23.98 tbr, 1k tbn (default)

I am attempting to extend the frame size to 1920x1080 and re-encode the video with libx264 to create a Blu-ray compatible video stream. I am using the following command (video filter from here):

ffmpeg -i original.mkv -c:v libx264 -preset veryslow -tune animation -profile:v high -crf 16 -pix_fmt yuv420p -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1" -an h264.mkv

The resulting video stream:

Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)

I then copy video, audio, and subtitle streams from three separate files to create the final file:

ffmpeg -i h264.mkv -i audio.mkv -i subs.mkv -map 0:v -map 1:a -map 2:s -c copy bluray.mkv

I then create a Blu-ray ISO by adding each track from bluray.mkv in tsMuxer. I have enabled "Continually insert SPS/PPS" and tried both "Do not change SEI and VUI data" as well as "Always rebuild SEI and VUI data". This process succeeds without warning or error.

The resulting ISO can be mounted and played in both VLC and IINA, but when it is burned to a BD25 disc and played on a PS4, the video is a mix of the original frame, what looks like multiple smaller copies of the frame with incorrect image stride, and random green blocks, all of which update around once every five seconds. All audio and subtitle tracks play without issue.

How do I ensure the resulting video stream of this conversion can be played on Blu-ray players without issue?


Solution

  • I finally made it back to this project and found a solution. Here are the arguments to ffmpeg I ended up using:

    I believe -x264opts bluray-compat=1 was the key.