Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
21st February 2015, 18:57 | #1 | Link |
Registered User
Join Date: Feb 2015
Posts: 6
|
x264 encoding in 10bit 4:2:2 for Blu-ray
Hello everybody,
I am now fighting since weeks to understand if there exist a solution to create a video blu-ray (i.e., playing automatically on every BD-player) containing real 10bit 4:2:2 YUV video (lossy or lossless) at 720x576 25i and 24bit 48kHz audio. Here is a summary of the capture and encoding process:
I have observed the following: -The PCM audio is always played fine on the blu-ray player at 24bit 48kHz stereo is fine: no issues observed -The Matroska container (audio+video) is always fine (I use VLC to play it): no issues observed Now, coming to the issue with the video:
I have tested more or less all the setting combinations (vbr / vbv / buffer sizes and rate / cbr) given on the page http://forum.doom9.org/showthread.php?t=154533 I have no more ideas how to continue. Now my questions are:
Finally, here is the command line I use for the video compression: Code:
"..\x264\x264.2525.10bit.x86_64_clear.exe" --demuxer lavf --output-csp i422 --tune film --preset medium --bluray-compat --crf 16 --nal-hrd vbr --vbv-maxrate 30000 --vbv-bufsize 30000 --vbv-init 0.2 --keyint 25 --open-gop --aud --cabac --b-pyramid strict --bframes 3 --ref 6 --slices 4 --weightp 0 --partitions p8x8,b8x8,i8x8,i4x4 --aq-mode 1 --aq-strength 1.0 --deblock -1:2 --b-adapt 2 --videoformat pal --colorprim "bt470bg" --transfer "bt470bg" --colormatrix "bt470bg" --input-res 720x576 --input-depth 10 --sar 12:11 --tff --force-cfr --fps 25/1 --output "..\2_Files_Intermediate\output.264" "..\2_Files_Intermediate\input.avi" Code:
############################### # Processing video [*.264]... # ############################### lavf [info]: 720x576p 0:1 @ 25/1 fps (cfr) resize [warning]: converting from yuv422p10le to yuv422p16le x264 [info]: using SAR=12/11 x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 x264 [info]: profile High 4:2:2, level 3.1, 4:2:2 10-bit x264 [info]: frame I:36 Avg QP:27.24 size: 87812 x264 [info]: frame P:195 Avg QP:30.38 size: 52626 x264 [info]: frame B:525 Avg QP:32.45 size: 27552 x264 [info]: consecutive B-frames: 3.3% 6.1% 18.7% 72.0% x264 [info]: mb I I16..4: 3.4% 71.6% 25.0% x264 [info]: mb P I16..4: 3.3% 29.5% 7.1% P16..4: 20.5% 26.7% 12.8% 0.0% 0.0% skip: 0.0% x264 [info]: mb B I16..4: 0.8% 4.1% 0.6% B16..8: 37.3% 18.3% 4.8% direct:31.7% skip: 2.4% L0:24.8% L1:28.7% BI:46.5% x264 [info]: field mbs: intra: 56.9% inter:51.1% skip:13.0% x264 [info]: 8x8 transform intra:73.7% inter:66.8% x264 [info]: coded y,uvDC,uvAC intra: 89.1% 100.0% 99.2% inter: 64.3% 97.5% 60.6% x264 [info]: i16 v,h,dc,p: 3% 85% 4% 8% x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 29% 18% 4% 6% 5% 10% 5% 14% x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 40% 10% 4% 7% 5% 10% 4% 11% x264 [info]: i8c dc,h,v,p: 41% 39% 7% 14% x264 [info]: ref P L0: 62.1% 23.6% 7.0% 3.7% 1.4% 1.0% 0.7% 0.4% 0.0% 0.0% x264 [info]: ref B L0: 79.5% 19.6% 0.5% 0.3% x264 [info]: ref B L1: 78.1% 20.5% 0.9% 0.5% x264 [info]: kb/s:7377.82 encoded 756 frames, 39.77 fps, 7377.82 kb/s Best regards TheDock |
21st February 2015, 18:59 | #2 | Link |
Registered Developer
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,342
|
Blu-ray does not support 4:2:2, 4:4:4, Lossless, or 10-bit.
Its limited to 4:2:0 8-bit, Main or High profile.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders |
21st February 2015, 19:15 | #3 | Link |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
|
Sufficed to say...
No Blu-ray disc player is able to decode 4:2:2, 4:4:4, Lossless or 10-bit AVC encoded video either!
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
|
21st February 2015, 20:30 | #4 | Link |
Registered User
Join Date: Feb 2015
Posts: 6
|
Thanks for your answers
But now I am completely lost. The *.m2ts file in the STREAM directory of the BDMV has following information: Code:
General ID : 1 (0x1) Complete name : I:\BDMV\STREAM\00000.m2ts Format : BDAV Format/Info : Blu-ray Video File size : 31.1 MiB Duration : 30s 240ms Overall bit rate mode : Variable Overall bit rate : 8 620 Kbps Maximum Overall bit rate : 35.5 Mbps Video ID : 4113 (0x1011) Menu ID : 1 (0x1) Format : AVC Format/Info : Advanced Video Codec Format profile : High 10@L4.1 Format settings, CABAC : Yes Format settings, ReFrames : 5 frames Codec ID : 27 Duration : 30s 240ms Bit rate mode : Variable Bit rate : 5 966 Kbps Maximum bit rate : 30.0 Mbps Width : 720 pixels Height : 576 pixels Display aspect ratio : 4:3 Frame rate : 25.000 fps Standard : PAL Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 10 bits Scan type : MBAFF Scan order : Top Field First Bits/(Pixel*Frame) : 0.575 Stream size : 21.5 MiB (69%) Color primaries : BT.601 PAL Transfer characteristics : BT.470 System B, BT.470 System G Matrix coefficients : BT.601 Color range : Limited Audio ID : 4352 (0x1100) Menu ID : 1 (0x1) Format : PCM Format settings, Endianness : Big Format settings, Sign : Signed Muxing mode : Blu-ray Codec ID : 128 Duration : 30s 235ms Bit rate mode : Constant Bit rate : 2 304 Kbps Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 48.0 KHz Bit depth : 24 bits Stream size : 8.30 MiB (27%) In the configuration of my BD-player, I can select 8/10/12 bit and 4:2:2 / 4:4:4 for the HDMI output: I understand that this has nothing to do with the input (i.e., the file on the blu-ray disc). Am I correct? Best regards The Dock |
21st February 2015, 20:33 | #5 | Link |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
|
Where is that stream from. Given that it's only 31.1MB please upload it somewhere?
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
|
21st February 2015, 21:06 | #6 | Link |
Registered User
Join Date: Feb 2015
Posts: 6
|
Hello SeeMoreDigital,
I have uploaded the complete *.iso file containing the blu-ray: https://dl.dropboxusercontent.com/u/76384861/AJA_06.iso The *.m2ts file contained in this video blu-ray ISO file was created by myself using the steps described in my first post in this thread. The source material was in this case SVHS material digitized with a BrightEye 75 device from Ensemble Design (used also as TBC). For the compression I have used x264 with the following command: Code:
"..\x264\x264.2525.10bit.x86_64_clear.exe" --demuxer lavf --output-csp i420 --tune film --preset medium --bluray-compat --level 4.1 --crf 16 --nal-hrd vbr --vbv-maxrate 30000 --vbv-bufsize 30000 --vbv-init 0.2 --keyint 25 --open-gop --aud --cabac --b-pyramid strict --bframes 3 --ref 6 --slices 4 --weightp 0 --partitions p8x8,b8x8,i8x8,i4x4 --aq-mode 1 --aq-strength 1.0 --deblock -1:2 --b-adapt 2 --videoformat pal --colorprim "bt470bg" --transfer "bt470bg" --colormatrix "bt470bg" --input-res 720x576 --input-depth 10 --sar 12:11 --tff --force-cfr --fps 25/1 --output "..\2_Files_Intermediate\output.264" "..\2_Files_Intermediate\input.mov" Here is the output generated during the x264 encoding: Code:
############################### # Processing video [*.264]... # ############################### lavf [info]: 720x576p 0:1 @ 25/1 fps (cfr) resize [warning]: converting from yuv422p10le to yuv422p16le resize [warning]: converting from yuv422p16le to yuv420p16le x264 [info]: using SAR=12/11 x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 x264 [info]: profile High 10, level 4.1, 4:2:0 10-bit x264 [info]: frame I:36 Avg QP:26.97 size: 73002 x264 [info]: frame P:195 Avg QP:30.08 size: 43015 x264 [info]: frame B:525 Avg QP:32.12 size: 21012 x264 [info]: consecutive B-frames: 3.3% 6.1% 18.7% 72.0% x264 [info]: mb I I16..4: 2.8% 72.6% 24.7% x264 [info]: mb P I16..4: 1.6% 21.9% 5.8% P16..4: 25.3% 30.7% 14.6% 0.0% 0.0% skip: 0.1% x264 [info]: mb B I16..4: 0.2% 1.8% 0.4% B16..8: 38.6% 20.2% 5.6% direct:27.2% skip: 6.0% L0:28.4% L1:33.9% BI:37.7% x264 [info]: field mbs: intra: 57.4% inter:52.0% skip:23.7% x264 [info]: 8x8 transform intra:73.8% inter:64.6% x264 [info]: coded y,uvDC,uvAC intra: 94.5% 99.5% 93.0% inter: 65.4% 86.6% 27.7% x264 [info]: i16 v,h,dc,p: 4% 86% 4% 6% x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 29% 14% 4% 6% 5% 10% 5% 15% x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 38% 9% 4% 7% 5% 10% 5% 11% x264 [info]: i8c dc,h,v,p: 33% 41% 8% 18% x264 [info]: ref P L0: 64.4% 21.6% 7.0% 3.6% 1.4% 1.0% 0.7% 0.4% 0.0% 0.0% x264 [info]: ref B L0: 80.1% 18.9% 0.6% 0.3% x264 [info]: ref B L1: 78.6% 19.8% 1.0% 0.6% x264 [info]: kb/s:5832.65 encoded 756 frames, 45.55 fps, 5832.65 kb/s Last edited by TheDock; 21st February 2015 at 21:10. Reason: Addition of the x264 log during compression |
22nd February 2015, 00:47 | #7 | Link |
Registered User
Join Date: Mar 2008
Posts: 47
|
Predictive lossless coding is a separate feature introduced by the same profile (Hi444PP according to wikipedia) as 4:4:4 support, but it's a separate feature. Implementing only some features of a profile is possible, and might have happened for some players.
Just because you find support for one feature of a profile doesn't mean you will find support for all features of a profile, unless the player specifically claims support that profile. Probably some hardware BD player makers followed the compatibility adage: "be liberal in what you accept, strictly conformant in what you output". So they accept whatever they can, rather than rejecting a 4:2:0 10-bit stream just because the BD spec doesn't require them to accept it. The max video bitrate (from the table on https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC) is higher for Hi10P Level 4.1 than for High Level 4.1 (by more than a factor of 2). Maybe with crf 7, you're exceeding the decoder's ability to keep up, hence the corrupted output? It probably never claimed to be able to accept Hi10P L4.1 in the first place. Oh also, the DPB would take more space with higher bit depth, so you might need to reduce your ref count, if you were near the limit for 8-bit h.264 BD streams. (err probably not, forgot you were using SD rez). Keep in mind that experimenting to find out what works on your specific player isn't going to tell you much about other BD players, unless they use the same hardware decoder chipset. And even then, probably different firmware will make a difference, too. |
22nd February 2015, 11:02 | #8 | Link |
Registered User
Join Date: Dec 2002
Posts: 5,565
|
My guess is the players just send the data through their 8 bit decoders. You can see that in 8 bit software players as well: some scenes look normal on first glance while others show heavy artifacts. Playing with the crf or other settings "randomizes" the symptom.
|
22nd February 2015, 11:06 | #9 | Link | |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
|
Quote:
LAV Decoder can't play it in hardware, my LG TV's reject it but my Oppo BDP-103 plays it and the colours seen to be okay. As I say, most curious.
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
|
|
22nd February 2015, 12:49 | #10 | Link |
Registered User
Join Date: Feb 2015
Posts: 6
|
Thanks for your answers and comments. Yes, it is interestingly curious
So I will then switch to the following configuration:
Which configuration(s) should I use then for encoding the video? The audio has a bitrate of: 24bit x 48kHz x 2channels = 2.304.000 bit/s I would like to set the video bitrate as high as possible but being compatible with most of the blu-ray hardware players. Here are the options and values I would use for a 2-pass x264 video encoding based on the recommendations given by shon3i in http://forum.doom9.org/showthread.php?t=154533: Code:
"..\x264\x264.2525.8bit.x86_64_clear.exe" --pass 1 --slow-firstpass --demuxer lavf --output-csp i420 --tune film --preset placebo --me umh --bluray-compat --level 4.1 --bitrate 30000 --vbv-maxrate 40000 --vbv-bufsize 30000 --vbv-init 0.2 --keyint 25 --open-gop --aud --cabac --b-pyramid strict --bframes 3 --ref 6 --slices 4 --weightp 0 --partitions p8x8,b8x8,i8x8,i4x4 --aq-mode 1 --aq-strength 1.0 --deblock -1:2 --b-adapt 2 --videoformat pal --colorprim "bt470bg" --transfer "bt470bg" --colormatrix "bt470bg" --input-res 720x576 --input-depth 10 --sar 12:11 --tff --force-cfr --fps 25/1 --output "..\2_Files_Intermediate\output.264" "..\1_Files_Uncompressed\input.mov" Thanks The Dock |
22nd February 2015, 14:37 | #11 | Link |
ангел смерти
Join Date: Nov 2004
Location: Lost
Posts: 9,558
|
If you have room, just set bitrate equal to vbv-maxrate for cbr to max out quality.
Technically, the max bitrate is 40mbps, but you could probably use any combination of audio/video up to 54mbps with players from the last few years, and even that limit may be low. Decoding chips are quite powerful these days. It depends on if you want to be strict to the spec or just distribute something to friends. Older first and second generation players had a lot of trouble with anything over 40 mbps, though. Any 3D player has the capability of decoding two streams at up to 60 mbps, which may or may not apply to a single stream as well. You can always experiment with rates that high. |
23rd February 2015, 00:09 | #12 | Link |
Registered User
Join Date: Mar 2008
Posts: 47
|
Is this just an exercise in seeing what's possible? What kind of content gets any kind of visual benefit from 30Mb/s at 720x576i50? (I like the practice of counting fields per second for interlaced content. I think of 50i as similar to 50p with half the vertical resolution. Needing more temporal resolution, but needing to support hardware that doesn't do 50p, is the only excuse left for interlacing, right? CRTs are long gone.)
If you're going to save your 4:2:2 10bit original in a lossless format for archival purposes, then what benefit are you getting from ridiculous bitrates for your lossy encode? I'm not saying there can't be a benefit, just asking what it is, because I'm surprised. Using WAY more bitrate than needed is just going to make it take longer to burn discs, and make it slow to send over networks or copy to USB drives, or w/e. Using a bit more bitrate than you think you need makes sense, in case you missed noticing a visual flaw that will bother you later. I know you said this wasn't the kind of answer you're looking for, so I'll leave it at that. Also, if you want to distribute something that will look good for the most people, you might want to deinterlace and distribute 720x576p50 content (if that's an option for BD?) People that play your video on computers, instead of on TVs with fancy deinterlace hardware, might be using software players with poor or no deinterlacing. (e.g. I'm not sure if VLC can activate GPU-accelerated deinterlacing, and even so there are old computers without hardware video processing. And realtime software deinterlacing doesn't usually look good. Old Intel GPUs (like my g965) don't have video decode hardware, let alone deinterlacing.) If there's room on the disc, you could include a 4:2:2 10bit version of your video. Maybe as a data file for people to play with computers? This is probably a dumb idea. |
23rd February 2015, 08:54 | #16 | Link | |
Registered User
Join Date: Sep 2012
Posts: 366
|
Quote:
-edit- oops, all these numbers look the same. Last edited by ndjamena; 23rd February 2015 at 10:35. |
|
23rd February 2015, 10:56 | #18 | Link |
Registered User
Join Date: Mar 2009
Location: Germany
Posts: 5,769
|
As said before several times, 4:2:2 is not BD compatible, not even AVCHD (or its last version, 2.0).
My only explanation is that the streams may be played on certain devices, as fake BDs/AVCHDs, is due to the universality of their decoders. Most decoding chips, like Sigma Designs or MediaTek, support 10b or more, for their chips are also used in pro gear. It may that the player interpreted the BD structure as a folder structure and played the M2TS files as a file, not as part of the BD/AVCHD structure. Like playing MP3 off a CDR. I remember an old trick (I also had to use) concerning the playback of SVCDs on certain players. It required that the MPEG-2 stream (SVCD) should have been packed as MPEG-1 (VCD), and bingo the DVD player was able to play them, because the decoder knew how to process the samples, although the system refused the format. But those CDRs were only good for those players (and computers). Therefore, if you want compatibility you should use 4:2:0. Or wait until the new HD format may come.
__________________
Born in the USB (not USA) |
23rd February 2015, 12:15 | #19 | Link |
Registered User
Join Date: Feb 2015
Posts: 6
|
Thanks for all your answers.
I totally agree that the bitrate it is not "needed" in this special sample, but as I said, this was not my question. Thanks to all of you, I am now several steps further. Yesterday I was able to resolve the interlacing issue. I would like to present it here briefly. The source was recorded as stated in my first post in this thread: 720x576:25i. With SVHS/VHS sources, I like to crop some parts from the top, bottom, left and right to get a more stable image. Then, to get again the compatibility with the most widespread standards, I use padding to have a 720x576 video again. All this should remind 25i (interlaced) output video. By using the following command, I got troubles: Code:
"..\ffmpeg\ffmpeg-20150206-git-9dc45d1-win64-static\bin\ffmpeg.exe" -y -analyzeduration 100M -probesize 100M -ac 2 -channel_layout stereo -i input.mov -vf crop=w=700:h=562:x=20:y=2,pad=width=720:height=576:x=10:y=7:color=black,fieldorder=tff -vcodec v210 -acodec copy output.mov Code:
"..\ffmpeg\ffmpeg-20150206-git-9dc45d1-win64-static\bin\ffmpeg.exe" -y -analyzeduration 100M -probesize 100M -ac 2 -channel_layout stereo -i input.mov -vf crop=w=700:h=560:x=20:y=4,pad=width=720:height=576:x=12:y=8:color=black,fieldorder=tff -vcodec v210 -acodec copy output.mov |
Thread Tools | Search this Thread |
Display Modes | |
|
|