Log in

View Full Version : Artefacts encoding - Experts needed


Lucius Snow
3rd April 2014, 12:14
Hi all,

On some particular and rare footage, i get very bad artefacts at encoding with 25i and 24p for Blu-Ray. Since i use DVD Architect, i can't use X264 sadly which is not compatible. So i use Mainconcept with these settings.

Please check here the artifacts on the capture :
http://poubellelqt.free.fr/temp/Capture.tif

Average bitrate : 26000 kbit/s
Maximum bitrate : 39000 kbit/s
VBV Buffer size : 3750000 bytes (30000 kbit)
Entropy coding mode : CABAC
Slice pictures : 4
MBAFF : Disable (not supported by DVD Architect)
GOP size (maximum) : 24 or 25 frames (according source 24p or 25i)
GOP size (minimum) : 1 frame
IDR frequency : 1
Refrence frames : 4
Number of B-pictures : 2
Use Adaptive B-Frames Placement : Enable
References B-pictures : Disable
Pyramid B-frame coding : Disable (not suppored by DVD architect)
Use Weighted P Mode : Enable
Use Simple / adaptive quant strenght : Disable
I-frame beating reduction : 0
Use deblocking : Yes
Use adaptive deblocking : Yes
Manager buffer underflow : Yes
Deblcoking alpha : -1
Deblocking Beta : -1
Search shape : 8x8
Motion estimation subpixel mode : Quarter pixel
Use Fast Inter/Intra decisions : Disable
Use Fast Multi-reference frame motion : Disable
Use Fast sub-block motion estimation : Disable
Rate distortion optimisation : Enable
Fast rate distortion optimization : Enable
Refiined Rate-distortion motion detection : Disable
I-pictures use 16x16 Intra Macroblock Predition : Enable
I-pictures use 8x8 Intra Macroblock Predition : Enable
I-pictures use 4x4 Intra Macroblock Predition : Enable
P and B-pictures Use 16x16 Intra Macroblock Prediction : Enable
P and B-pictures Use 8x8 Intra Macroblock Prediction : Enable
P and B-pictures Use 4x4 Intra Macroblock Prediction : Enable

Thank you very much.

Guest
3rd April 2014, 16:00
Just out of interest, why are x264-generated streams incompatible with DVD Architect? x264 has options for creating bluray-compliant streams.

Also, please describe the artifacts. I don't see anything particularly objectionable, except perhaps for some residual combing from a poor or incorrectly used deinterlacer.

Lucius Snow
3rd April 2014, 16:09
Just out of interest, why are x264-generated streams incompatible with DVD Architect? x264 has options for creating bluray-compliant streams.

Also, please describe the artifacts. I don't see anything particularly objectionable, except perhaps for some residual combing from a poor or incorrectly used deinterlacer.
I don't know why it is not compatible. Here is what the website says : https://sites.google.com/site/x264bluray/issues-with-certain-players I can confirm this issue.

You can see lot of artifacts in the down left of the picture. Therer are big blocks.

Guest
3rd April 2014, 16:13
I don't see any big blocks and there is nothing of macroblock size anyway. The content is very challenging and you may simply have insufficient bitrate for such a scene. We can help more with an unprocessed source sample containing that frame.

Lucius Snow
3rd April 2014, 17:25
I don't see any big blocks and there is nothing of macroblock size anyway. The content is very challenging and you may simply have insufficient bitrate for such a scene. We can help more with an unprocessed source sample containing that frame.

Please find here the original :
http://poubellelqt.free.fr/temp/Original.tif

This is not the exact same frame, but you should see a hudge difference of quality.

Guest
3rd April 2014, 17:45
I meant a sample of the source stream, not a screenshot. That will allow us to try encodes to see if we get similar results.

Looking at the screenshot, however, it looks like you are just bitrate starved for that scene. Have you tried two-pass encoding?

foxyshadis
3rd April 2014, 23:10
Encoding interlaced or telecined video in progressive mode will chew up bitrate and quality like crazy. Unfortunately, DVDA won't take interlaced files from any source but Vegas, so you don't have a choice but to bump up the bitrate for 50i. Consider speeding up the movie for 50i instead of telecining it, so it's always progressive. (I'm assuming you're using DVDA 6, since 5 doesn't work with external 24p.)

You have AQ disabled; AQ gives more bits to flatter areas, like the ground, so you won't get that total loss of texture. I would turn it on. Obviously, try bumping the average bitrate up to see how it comes out as well, or forcing a special zone for extra bitrate on that one scene. And if this is one-pass, try two-pass like neuron2 said.

Your reference about x264 being incompatible just says that interlaced x264 is incompatible, which is the same as with Mainconcept anyway. I would switch to x264 if possible.

Lastly, just an unrelated tip if you're doing this already, but DVDA works best if you mux to m2ts with tsmuxer first.

Lucius Snow
3rd April 2014, 23:51
Thank you for your answers.

Yes i use two-pass encoding. I encode with these settings using Carbon Media Carbon which is based on Mainconcept. It works with DVD-Architect 6. The artefacts occur also with Vegas preset.

I'll enable Simple / adaptive quant strenght to check.

For the average bitrate, i've tried with 30 Mbit/s and there were no improvment at all.

I'm not sure i can put more extra bitrate for that scene in particular. The whole stream takes 70 minutes.

About TSmuxer, DVD-A asked me to recompress the generated m2ts file. It was not recognized as a compliant stream.

Yes, the source is 25p and i generate a 25i for Blu-Ray compliance. My customer doesn't want me to switch to 24p because of others artefacts.

Sorry, i don't know what Telecine is. I'll search about it on the forum. I'm not sure to have understood about this issue.

Here is the video sample in Apple ProRes :
http://poubellelqt.free.fr/temp/


Cheers.

SeeMoreDigital
5th April 2014, 11:12
Yes, the source is 25p and i generate a 25i for Blu-Ray compliance. My customer doesn't want me to switch to 24p because of others artefacts.

I re-encode ProRes 25p sources to H.264 all the time... What exactly does your customer require?

Lucius Snow
6th April 2014, 09:45
I re-encode ProRes 25p sources to H.264 all the time... What exactly does your customer require?

A Blu-Ray, so 25p is not possible.

DarkSpace
6th April 2014, 10:20
Just an idea, but instead of encoding the progressive content as interlaced, is it perhaps allowed by the BluRay spec to encode the content as 25p with 2:2 pulldown flags?
I know that I personally would prefer that way, because it keeps the content flagged as progressive also.

SeeMoreDigital
6th April 2014, 11:26
Agreed... Encode the content as 'progressive' and if possible try different stream flagging.

Anyway, given there are plenty of AVC-HD camcorders around that can capture at 25p, there should be a way of placing such content onto a Blu-ray disc (without re-encoding), even if the original BD specification does not specifically permit it ;)

LoRd_MuldeR
6th April 2014, 12:34
A Blu-Ray, so 25p is not possible.

x264 explicitly has a "fake interlace" mode for this purpose:
--fake-interlaced Flag stream as interlaced but encode progressive. Makes it possible to encode 25p and 30p Blu-Ray

It's possible, because even in an "interlaced" stream one can switch between interlaced/progressive encoding as needed. H.264 has two modes for this purpose, MBAFF and PAFF:
http://forum.doom9.org/showpost.php?p=927647&postcount=2

So it's perfectly valid to have, for example, an MBAFF stream where all macroblocks are encoded as progressive...

Lucius Snow
6th April 2014, 12:42
Thanks all for your feedback. Here are some news :

- Enabling "Simple / adaptive quant strengh" didn't solve the problem unfortunately.

- Encoding this short sample (dozen of seconds) instread of the whole film (60 min), with the *same* encoding parameters, give much better results. Maybe is there more bitrate flexibility for encoding a short sample ?

- I know how to add pulldown flags when encoding DVD in 24p, but not for Blu-Ray. I can't find this option for H264 encoding parameters into Carbon coder, unlike MPEG2 encoding where it is possible

Lucius Snow
6th April 2014, 12:47
x264 explicitly has a "fake interlace" mode for this purpose:
--fake-interlaced Flag stream as interlaced but encode progressive. Makes it possible to encode 25p and 30p Blu-Ray

It's possible, because even in an "interlaced" stream one can switch between interlaced/progressive encoding as needed. H.264 has two modes for this purpose, MBAFF and PAFF:
http://forum.doom9.org/showpost.php?p=927647&postcount=2

So it's perfectly valid to have, for example, an MBAFF stream where all macroblocks are encoded as progressive...
I don't think it's compatible with DVD Architect but i'll make now another test with MBAFF enabled.

Thanks.

LoRd_MuldeR
6th April 2014, 12:48
I don't think it's compatible with DVD Architect

If DVD Architect does not accept a BluRay conform stream, only the DVD Architect support can help to fix the bug.

Encoding this short sample (dozen of seconds) instread of the whole film (60 min), with the *same* encoding parameters, give much better results. Maybe is there more bitrate flexibility for encoding a short sample ?

The opposite should hold true. The longer the clip, the more flexibility the encoder has to "move" the bits to where they are needed, while still hitting the target average bitrate. If encoding a longer version of the clip at the same target bitrate actually yields worse quality, their RC algorithm is broken or at least failing on your specific sample. Using a shorter clip only hides the symptom, I think.

Still keep in mind that the encoder's goal is to improve the overall quality, in motion, not to make every single frame look good, in step-by-step view. For example, in "fast" (complex) scenes the quantizer is usually raised, because these scenes would consume far too many bits otherwise - bits that would better be used elsewhere. And because the quality loss is less visible in those scenes anyway, when you watch them at normal speed. See quantizer curve compression (http://x264dev.multimedia.cx/archives/98) for details.

DarkSpace
6th April 2014, 13:07
x264 explicitly has a "fake interlace" mode for this purpose:
--fake-interlaced Flag stream as interlaced but encode progressive. Makes it possible to encode 25p and 30p Blu-Ray
That's exactly what I meant by "having the stream flagged as interlaced" (honestly, any halfway decent encoder should do at least something like this for progressive content), but I still prefer that the bitstream is flagged as progressive with 2:2 pulldown.
My reasoning: With --fake-interlaced, the content is encoded progressive, but the decoder will still be forced to output it as interlaced. As such, deinterlacing should happen somewhere during playback, and even if that deinterlacing doesn't screw up and really only does proper field matching, it is unnecessary. With 25p and pulldown flags ("--pulldown 22" for x264), the decoder can output progressive video directly, without the deinterlacing step even being needed.
However, I don't know if 25p + pulldown is as valid as --fake-interlaced for BluRays.

LoRd_MuldeR
6th April 2014, 13:11
My reasoning: With --fake-interlaced, the content is encoded progressive, but the decoder will still be forced to output it as interlaced. As such, deinterlacing should happen somewhere during playback, and even if that deinterlacing doesn't screw up and really only does proper field matching, it is unnecessary.

Not necessarily. If a frame is progressive in a PAFF stream, a somewhat smart player will skip deinterlacing for that frame, because there obviously is no reason to deinterlace. The same goes for frames where all MB's are progressive in MBAFF streams. Finally, even if the player "blindly" applies deinterlacing on all frames of an "interlaced" stream (aka "aggressive deinterlacing"), a somewhat smart deinterlacing algorithm will pass-trough propgressive frame unmodified.

Sharc
6th April 2014, 13:39
A Blu-Ray, so 25p is not possible.
Well, it depends on the resolution:
720x576@25p is Blu-Ray compliant (Secondary Stream).
I don't think any Blu-Ray player would reject it.

sneaker_ger
6th April 2014, 14:37
Just an idea, but instead of encoding the progressive content as interlaced, is it perhaps allowed by the BluRay spec to encode the content as 25p with 2:2 pulldown flags?
I know that I personally would prefer that way, because it keeps the content flagged as progressive also.
That's exactly what I meant by "having the stream flagged as interlaced" (honestly, any halfway decent encoder should do at least something like this for progressive content), but I still prefer that the bitstream is flagged as progressive with 2:2 pulldown.[...]However, I don't know if 25p + pulldown is as valid as --fake-interlaced for BluRays.

Blu-Ray doesn't support 1080p50, only 720p50. Going the pulldown route requires downscaling (unless source is <=720p).

Lucius Snow
6th April 2014, 15:52
Well, it depends on the resolution:
720x576@25p is Blu-Ray compliant (Secondary Stream).
I don't think any Blu-Ray player would reject it.

Yes of course, but the goal is to keep the native resolution 1920x1080.

DarkSpace
6th April 2014, 16:16
Blu-Ray doesn't support 1080p50, only 720p50. Going the pulldown route requires downscaling (unless source is <=720p).
For what it's worth, I never mentioned 50p. All I mentioned was 25p content encoded as
a) 25i with --fake-interlaced
b) 25p with --pulldown 22 (which will, when needed, change the stream to 25i upon playback)
but nothing about 50p...

If what LoRd_MuldeR said is correct, I'll have to somewhat lower my personal preference of b) over a), though.
(Don't misunderstand, I still prefer b), but that's merely because it seems "cleaner" to me than a) does.)

sneaker_ger
6th April 2014, 16:36
My bad, I mixed up 2:2 pulldown with frame doubling pulldown.

Lucius Snow
6th April 2014, 16:37
I've just made another test with MBAFF enabled. The quality result is a bit différent but it makes the same big artefacts. No real improvement.

I can confirm that DVD-Architect makes an error (with MBAFF enabled) when muxing the H264 elementary stream, even if i import a M2TS file muxed first by TSMuxer. Sadly, Sony doesn't fix the bugs since 2010. There are lot of others bugs concerned. There're no alternatives for authoring except DoStudio but which costs $3000 minimum.

EDIT : New tests with the short sample and "Use AQ strengh" enabled has given better results. However, these improvements almost disappear with the whole video stream.

SeeMoreDigital
6th April 2014, 17:57
So why can't you use a 'free-ware' encoding application that allows you to use x264?

Lucius Snow
6th April 2014, 18:29
So why can't you use a 'free-ware' encoding application that allows you to use x264?

H264 files encoded with x264 can't be muxed into DVD-Architect.

SeeMoreDigital
6th April 2014, 19:06
Is it your intention to create a Blu-ray disc full of short movies? How complex do you want this disc to be?

Lucius Snow
6th April 2014, 20:58
Is it your intention to create a Blu-ray disc full of short movies? How complex do you want this disc to be?
Not especially... It can be short films, long features. Authoring usually have menus, submenus, chapters, subtitles, Dolby Digital 5.1 etc.

kieranrk
7th April 2014, 10:24
Not necessarily. If a frame is progressive in a PAFF stream, a somewhat smart player will skip deinterlacing for that frame, because there obviously is no reason to deinterlace. The same goes for frames where all MB's are progressive in MBAFF streams. Finally, even if the player "blindly" applies deinterlacing on all frames of an "interlaced" stream (aka "aggressive deinterlacing"), a somewhat smart deinterlacing algorithm will pass-trough propgressive frame unmodified.

The coding method is orthogonal to the display method as signalled in pic-struct. Yes if the deinterlacer was clever it would skip the frame pictures.