Log in

View Full Version : Encoding Video for Blu-Ray using H264/AVC


Pages : 1 2 3 4 5 6 7 8 [9]

benwaggoner
26th September 2018, 16:50
Welp, that didn't work. Despite passing both Sony and Panasonic's verifier, we're still getting weird stuttering errors on PS4. So I guess scratch that, gotta stick with full-blown x264.


Are you getting the errors playing on a disc or via USB? As a .ts or a full BD disc image?

If it’s BD-R, it’s possible you might have have a burn/media issue.

mp3dom
27th September 2018, 08:50
Welp, that didn't work. Despite passing both Sony and Panasonic's verifier, we're still getting weird stuttering errors on PS4. So I guess scratch that, gotta stick with full-blown x264.

There are stb players (maybe even PS4 at this point) that try to output progressive video (progressive scan) without using the RFF flags as support (they use their own internal routines in realtime).
I saw jerking movements/stuttering mainly on panning with "still text" on it (so, generally opening/endings). If that's the case, there's a solution, but not with x264 (create a stream with a mixture of soft and hard pulldown).

WorldOfCrap
29th September 2018, 01:06
@ benwaggoner: We always test via BD-R, but we tried multiple burns on multiple players, and got problems in the same general spot of the program. I also doubt it was an I/O issue because the stream that was playing back was NTSC SD with AC3 audio, so the total bitrate was no more than 5500 kbps.

@ mp3dom: This wasn't an interlaced/progressive issue. In fact, it wasn't happening for the entire stream, but randomly in localized parts of the video, for example, within the same minute. The stuttering was unlike anything I'd ever seen before -- we'd get dropped frames and dropped audio, but seldom at the same time, and although it would stutter in the same general area, it wouldn't be in exactly the same frames each time we played it back. We tried with multiple burns on multiple PS4s, and had the same issues in the same general parts of playback.

Here's some cell phone video my QC guy took, sorry for the low quality:
https://www.dropbox.com/s/emrxio2p5vth59h/IMG_5434.MOV?dl=0

I had the Scenarist team take a look, since I initially thought this was a mux problem with their new v8 release, and they were able to reproduce the problem, but had no idea what was causing it. PS3 had some minor hiccups on those discs (same general spot, similar issue), but PS4 was unwatchable. Re-encoding the video with standard x264 fixed everything.

Unfortunately I don't have the ability to keep trying this, so I'll have to give up on ffmpeg for now. I suspect that SOME essential BD-compliant flag isn't getting passed correctly to x264lib, or isn't implemented in that iteration of x264.

mp3dom
29th September 2018, 14:15
Well... the only stuttering I can see from your video is the one on the onscreen text... and it's exactly what I told you before (text from the OP/ED). The very fine/razor text details (especially the razor horizontal border of the text) is making the player go crazy and get fooled because, with its own routines, it still try to output a 60p stream but using the wrong field matching.
You can overcome the problem simply encoding OP/ED with hard-pulldown and the rest with soft-pulldown.
This problem happens using other encoders too, and with other players as well... so it's not a direct x264/PS3-4 problem.

WorldOfCrap
30th September 2018, 23:48
Well... the only stuttering I can see from your video is the one on the onscreen text...
Yeah, not what I was referring to -- I'm aware that there was some interlacing issues there. It's more like full-on drop-outs where the video stops for a good half-second while the audio keeps going, or the audio drops for a half-second or so while the video keeps going. (I'm not sure if that clip captured an incident where the video was affected, but it sure got several incidents with the audio, which was just fine. Again, this cleared after re-encoding the video.)

kolak
29th December 2018, 00:35
Maybe your problematic place is at layer break?

infoeater
19th April 2019, 09:14
Is it possible to use x264 zones with ffmpeg? If so, how?

poisondeathray
19th April 2019, 14:52
Is it possible to use x264 zones with ffmpeg? If so, how?

-x264opts

e.g bitrate multiplier x2 for frames 100-200

-x264opts zones=100,200,b=2

infoeater
19th April 2019, 16:04
Thanks,
I used similar command before and it failed. After you wrote it, it started working. You have great power ;)

WSC4
18th August 2019, 02:13
First of all, I am not "Authoring" a Blu-ray Disc with x264. The disc will be a data disc of just 10 video files. There will be no BDMV, CLIPINF, PLAYLIST OR STREAM FOLDERS. The videos will be in the root directory on the Blu-ray disc.

Is this still OK to encode with x264?

1080p at 25 fps:

x264 --bitrate XXXXX --preset veryslow --tune film --bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 25 --open-gop --slices 4 --fake-interlaced --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 --pass 2 -o out.mkv input.mov

From the first page of this thread:

Output file must be in raw 264 elementary stream (extension .264) otherwise settings will not applied correctly. DO NOT USE MKV OR MP4.

I have to use the MKV extension. Is there a problem with this? Again, the disc will not have menus, chapters et cetera and I am not authoring it with Blu-ray authoring programs.

poisondeathray
18th August 2019, 16:33
I have to use the MKV extension. Is there a problem with this? Again, the disc will not have menus, chapters et cetera and I am not authoring it with Blu-ray authoring programs.


No problem if it's just a data disc

WSC4
19th August 2019, 07:23
Thank you. That is good news.

The videos to be burnt onto the discs are actually from a camcorder. MediaInfo state they are all progressive. Do I have to use the --fake-interlaced option?

Looking at these files from the video camera, MediaInfo also displays --colorprim, --transfer and --colormatrix as "bt709". Do I still need to include those options? My guess is that x264 will copy them anyway.

The discs would be played on current to maybe 9 year old Blu-ray players.

Asmodian
19th August 2019, 08:08
You do need to include those options, x264 will not copy them.

No need for --fake-interlaced.

Bordo32
17th February 2021, 17:45
I was reading trough many different posts on various forums, still did to find a definitive answer on what is recommended by Blu Ray specs Min GOP size (encoding with X264, H264), what min keyint value has to be set to have Blu Ray compliant encoded file?

I know that the Max GOP has to match the bitrate for 4.1 level, hence keint = 60 for 59.94fps video.
But the Min size is a mystery.
I am leaning towards min keyint = 1.
But found other recommendations:
min keyint = 2
min keyint = 0
min keyint = 1
min keyint = fps/2
min keyint = fps/2 + 1

But what is actual value is described by Blu Ray specs, if it is described?

Looking for your comments/advise.

benwaggoner
17th February 2021, 19:54
I was reading trough many different posts on various forums, still did to find a definitive answer on what is recommended by Blu Ray specs Min GOP size (encoding with X264, H264), what min keyint value has to be set to have Blu Ray compliant encoded file?

I know that the Max GOP has to match the bitrate for 4.1 level, hence keint = 60 for 59.94fps video.
It's not about the bitrate. The limitation is 1 second for Level 4.0 and 2 seconds for Profile 4.0 with a --vbv-maxrate of 15000 or less, IIRC. I used that combo burning BD images to DVD-R media way back in the day when BD-R replication wasn't cost-effective for smaller runs due to the requirement to purchase a per-title encryption key.

But the Min size is a mystery.
I am leaning towards min keyint = 1.
But found other recommendations:
min keyint = 2
min keyint = 0
min keyint = 1
min keyint = fps/2
min keyint = fps/2 + 1

But what is actual value is described by Blu Ray specs, if it is described?

It's been a long time since I made an old-school Blu-ray, but my dim memory agrees with --min-keyint 2. Some of the limitations are/have been due to a combination of x264 implementation and BD spec limitations, not strictly the Blu-ray spec itself. For example, open-gop wasn't allowed with --bluray-compat in older versions of x264 even though the spec allowed it. There's a lot fewer parameters changed in --bluray-compat today than in olden times.

MasterNobody
17th February 2021, 22:15
if( h->param.b_bluray_compat )
{
h->param.i_bframe_pyramid = X264_MIN( X264_B_PYRAMID_STRICT, h->param.i_bframe_pyramid );
h->param.i_bframe = X264_MIN( h->param.i_bframe, 3 );
h->param.b_aud = 1;
h->param.i_nal_hrd = X264_MAX( h->param.i_nal_hrd, X264_NAL_HRD_VBR );
h->param.i_slice_max_size = 0;
h->param.i_slice_max_mbs = 0;
h->param.b_intra_refresh = 0;
h->param.i_frame_reference = X264_MIN( h->param.i_frame_reference, 6 );
h->param.i_dpb_size = X264_MIN( h->param.i_dpb_size, 6 );
/* Don't use I-frames, because Blu-ray treats them the same as IDR. */
h->param.i_keyint_min = 1;
/* Due to the proliferation of broken players that don't handle dupes properly. */
h->param.analyse.i_weighted_pred = X264_MIN( h->param.analyse.i_weighted_pred, X264_WEIGHTP_SIMPLE );
if( h->param.b_fake_interlaced )
h->param.b_pic_struct = 1;
}
Link to encoder/encoder.c (https://code.videolan.org/videolan/x264/-/blob/b86ae3c66f51ac9eab5ab7ad09a9d62e67961b8a/encoder/encoder.c#L1002)
Commit (https://code.videolan.org/videolan/x264/-/commit/9fb055856a617f5ddca15a0c5745ff1c1486ad9a) from 2012.

Bordo32
17th February 2021, 23:12
It means has to be set keyint_min = 1 for Blu Ray compliant.
Correct?

MasterNobody
17th February 2021, 23:55
Yes. And it is automatically forced set when --bluray-compat is used i.e. no matter what --min-keyint you set, it still will be 1.

Bordo32
18th February 2021, 00:19
MasterNobody, thanks for your help.
Now is clear, set keyint_min = 1 just be on the safe side.

Richard1485
30th March 2021, 18:02
The images in the first post have disappeared. Good job sneaker made a backup (https://forum.doom9.org/showthread.php?p=1808625#post1808625). Maybe a mod can edit the OP.

Selur
1st April 2021, 18:40
@Richard1485: For me they are still there unless 'Ghostery' is enabled.

Richard1485
1st April 2021, 22:46
I don't have Ghostery, but I've quoted the OP, and the images are indeed still there. Something else must be blocking them. My bad then. It's good to know that they're still there. I went to check something the other day and couldn't see them. Thanks.

Selur
5th June 2024, 04:11
Nowadays, the pictures timeout of me,...

FranceBB
9th June 2024, 18:02
Nowadays, the pictures timeout of me,...

This is weird...
They also wouldn't load on my side on Chrome, however when I quoted the original post and tried to access the image directly at:

http://tom.niko.users.sbb.rs/resolutions.png

it would load and display.
At that point I started wondering: could it be an HTTPS issue?
And sure enough, if I try to load the same page with HTTP instead of HTTPS (namely http://forum.doom9.org/showthread.php?t=154533 instead of https://forum.doom9.org/showthread.php?t=154533) Chrome ignores it and loads the HTTPS version without images anyway. On the other hand, loading the HTTP version on Firefox works and sure enough the images are still there:

https://i.imgur.com/5O4HeIi.png

Funnily enough I have the "Always use HTTPS connections" disabled in my Chrome settings but it looks like the browser is testing and probing each HTTP website you visit to see whether it also support an HTTPS equivalent version and automatically "upgrades" you to HTTPS. At that point, I guess they're blocking plain HTTP elements like images due to a security concern which is why they're visible on Firefox but not on Chrome. Why Google, why...? :(

tebasuna51
17th June 2024, 10:23
I attached the images to avoid the problem.
I let the original url but now a copy of the images are in Doom9 and must be always see.

Selur
17th June 2024, 17:00
Thanks!

javieracdc
11th December 2024, 20:04
Anyone have some backup of the webpage?
http://www.x264bluray.com/home/1080i-p

The webpage is down

I need to compliant a MOV file into blu ray but i'm just learning some fews that i have to know

benwaggoner
12th December 2024, 01:15
Anyone have some backup of the webpage?
http://www.x264bluray.com/home/1080i-p

The webpage is down

I need to compliant a MOV file into blu ray but i'm just learning some fews that i have to know
As in a .MOV with a BD-compatible H.264 bitstream?

javieracdc
12th December 2024, 14:12
As in a .MOV with a BD-compatible H.264 bitstream?

I'm following this webpage to convert from MOV to a blu ray compliant
https://web.archive.org/web/20211016213149/http://www.x264bluray.com/home/1080i-p

However, what about the audio encode? because that command only works with stream video.

I am also experimenting with this command:

ffmpeg -i IMG_0006.mov -c:v libx264 -preset ultrafast -x264opts bitrate=18000:level=4. 2:keyint=60:bluray-compat:slices=4:open-gop:ref=4:open-gop:ref=4:vbv-maxrate=4000000:vbv-bufsize=3000000:weightp=0:b-pyramid=strict:cabac: “fps=60000/1001”:force-cfr -c:a ac3 -b:a 640k -ar 48000 -y out.mkv

Is this correct to encode audio and video at the same time?

quowouldsafa1985
23rd December 2024, 19:08
When encoding video for Blu-Ray using H264/AVC, it's important to follow the Blu-Ray standards to ensure compatibility and quality. The H264 codec is one of the most widely used for Blu-Ray encoding due to its excellent balance between file size and video quality. For Blu-Ray, the encoding settings should comply with the specific profile and level constraints, typically the High Profile with Level 4.1 for HD content.

A few key points to consider include choosing the right bitrate. For 1080p content, a bitrate of around 20-30 Mbps works well, but this can vary depending on the contentÂ’s complexity. If youÂ’re encoding in 4K, youÂ’ll need a much higher bitrate to preserve the quality of the image. Additionally, youÂ’ll want to use 2-pass encoding to optimize the bitrate allocation for the best quality.

Audio is also an important aspect—most Blu-Ray discs use Dolby Digital (AC3) or DTS audio, but you could also use uncompressed formats like LPCM depending on your requirements. Always make sure to check the synchronization between audio and video during encoding.

For more detailed guides and tips, you can refer to this link. It provides a great breakdown of encoding settings and tools you can use to get the best results for Blu-Ray creation.

javieracdc
23rd March 2025, 19:31
When encoding video for Blu-Ray using H264/AVC, it's important to follow the Blu-Ray standards to ensure compatibility and quality. The H264 codec is one of the most widely used for Blu-Ray encoding due to its excellent balance between file size and video quality. For Blu-Ray, the encoding settings should comply with the specific profile and level constraints, typically the High Profile with Level 4.1 for HD content.

A few key points to consider include choosing the right bitrate. For 1080p content, a bitrate of around 20-30 Mbps works well, but this can vary depending on the contentÂ’s complexity. If youÂ’re encoding in 4K, youÂ’ll need a much higher bitrate to preserve the quality of the image. Additionally, youÂ’ll want to use 2-pass encoding to optimize the bitrate allocation for the best quality.

Audio is also an important aspect—most Blu-Ray discs use Dolby Digital (AC3) or DTS audio, but you could also use uncompressed formats like LPCM depending on your requirements. Always make sure to check the synchronization between audio and video during encoding.

For more detailed guides and tips, you can refer to this link. It provides a great breakdown of encoding settings and tools you can use to get the best results for Blu-Ray creation.

Hi
Which is the link url that are you refering to?

excellentswordfight
24th March 2025, 12:43
Hi
Which is the link url that are you refering to?
I think you can ignore that message, looks like a bot respons, so I wouldnt follow any link regardless.

javieracdc
26th March 2025, 00:29
Ok anyway :)

I have a Mac Book Air M2 and I installed the Compressor app, and I noticed that this program (which is similar to Handbrake) has a Blu ray profile to encode a video and export the video in .264 format

https://support.apple.com/es-cl/guide/compressor/cpsr3f00eefa/mac

Has anyone tried this software to encode a video to h264 and test if it complies with Blu ray parameters? will there be any difference versus doing it directly with x264 ?

javieracdc
26th March 2025, 17:33
Edit:
I used a video for testing the Compressor h264 settings and it generated:

Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference : 4 frames
Format settings, GOP : M=3, N=15
Format settings, Slice coun : 4 slices per frame
Bit rate mode : Variable
Maximum bit rate : 35.0 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 29.970 (30000/1001) FPS
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan type, store method : Separated fields
Scan order : Top Field First
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

Later I convert this 264 file into m2ts using tsmuxer and I imported into TMPenc authoring works 7 trial and I used The File Checker:


https://i.ibb.co/C57qDHP4/clip-format-checker.png

And it detects that video must be reencoded

cubicibo
26th March 2025, 19:08
Two issues:
- you misconfigured TMPGenc as a PAL project while you want NTSC framerate. You can fix this without re-encoding.
- you must reduce the number of reordered frame to two, or reduce the number of consecutive b-frames. You must change your compressor settings (if possible) and re-encode.

javieracdc
26th March 2025, 21:05
Two issues:
- you misconfigured TMPGenc as a PAL project while you want NTSC framerate. You can fix this without re-encoding.
- you must reduce the number of reordered frame to two, or reduce the number of consecutive b-frames. You must change your compressor settings (if possible) and re-encode.

1) Yes, you are right, I configured now in NTSC and now framerate is passed

2) In Compressor, not possible (At least the option) modify this type of value,
Even here:
https://support.apple.com/es-cl/guide/compressor/cpsr3f00eefa/mac

Doesn´t specific modify the reordering frame

cubicibo
26th March 2025, 22:06
If you can't reduce the maximum number of consecutive b-frames then Compressor cannot be used for your purpose.

javieracdc
1st April 2025, 18:52
Hi
I had retested again about the Blu Ray output in Compressor app in MAC, but now I downloaded a older version of Compressor, version 4.7, which this version is the latest supports for DVD and Blu ray iso creation (Even this version create blu ray with a basic menu), newer Compression version, DVD is deprectated and cant create an iso file ready for blu ray, only creates .h264 files extension video

So I created again the blu ray of my video test and this is the output of m2ts:
Video
ID : 4113 (0x1011)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference : 4 frames
Format settings, Slice coun : 4 slices per frame
Codec ID : 27
Duration : 1 min 5 s
Bit rate mode : Variable
Bit rate : 24.7 Mb/s
Maximum bit rate : 35.0 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 29.970 (30000/1001) FPS
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan type, store method : Separated fields
Scan order : Top Field First
Bits/(Pixel*Frame) : 0.398
Stream size : 194 MiB (96%)
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

And now using Clip Format Checker from TMPEnc AW7 now the video is passed:

https://i.ibb.co/932WxYsv/image.png

In conclusion, Compressor version 4.7 is the "latest"version that full comply with Blu Ray standard.

The version that I was using on my fisrt test was 4.9