Log in

View Full Version : interlaced chroma issue and artifacts around avisynth subtitles


Alex-Kid
20th April 2013, 07:04
I hope this is the place to post these issues.

I'm finishing my DVD project, but there are some issues I can't solve.

I have worked all the project based on 480p60 video. This is the workflow I've followed:

NTSC DV-AVI (Cedocida) → QTGMC (bob deinterlace) → ...
...DENOISERS → SHARPENER → EDITION → SUBTITLES → ...
...REINTERLACE (separatefields.selectevery(4,1,2).weave)

First (16:9 top/bottom fields from lossless video):

http://i37.tinypic.com/2upqzxz.png

I get chroma displacement when reinterlacing. When progressive (before reinterlacing), picture is fine, so I don't know if it's an inner issue of the YV12 interlaced chroma sampling. If I can't get rid of it, I think I can use a chroma smoother so it looks better.

----------0----------

Second (16:9 interlaced frame from MPEG-2 final encoding video)

http://i37.tinypic.com/2yzar6o.jpg

I get this artifacts around hardcoded subtitles by avisynth internal filter after encoding MPEG-2 file. Before encoding, subtitle looks fine, so here I am lost and I don't know what to do. It seems the subtitle had an artifacts box around, even when the video bitrate is 9008 kbps. Every other zone in the picture looks good (when watched ;)).

I don't think video files are necessary, but I'll provide them if you need them.

Please help me solving these issues to finish the project. I have 2 or 3 projects more to come!

Saludos

By ALEX-KID

TheSkiller
20th April 2013, 10:55
Nothing is wrong actually, you just think it is because of the improper way you view your interlaced YV12 video.
By that I mean to view your raw YV12 video it has to be converted to RGB somehow. Because your video is interlaced this needs to happen in an interlaced manner. If you just view your AVS script result in, say, VirtualDub some Codec installed on your computer is requested to do the YV12->RGB conversion so that your video can be displayed. When this happens the chroma is getting scaled as if the video was progressive causing the issue you see, although it is not really there in YV12.

Solution: To preview your video properly add this to the very end of your script but be sure to remove or comment it out for encoding.

ConvertToRGB(interlaced=true)


Edit: But if you want to check your video with fields separated, put the SeparateFields() after the RGB conversion. ;)

Alex-Kid
23rd April 2013, 20:30
TheSkiller, I thought it could be the reason, thanks for making it clear for me.

żAnybody for the subtitle clock issue :)?

paradoxical
23rd April 2013, 20:38
It simply looks like there wasn't enough bitrate to encode the text without artifacts along with everything else in the frame since there are noticeable compression artifacts all over that shot. Ringing around text is an issue with any block-based encoding scheme because of the sharp transitions.

Alex-Kid
24th April 2013, 23:04
It simply looks like there wasn't enough bitrate to encode the text without artifacts along with everything else in the frame since there are noticeable compression artifacts all over that shot. Ringing around text is an issue with any block-based encoding scheme because of the sharp transitions.

Ok, but the video has already 9008 kbps, I can't raise bitrate up much more for DVD compliancy.

żAny other ideas? The video is processed in 480p and is very sharp too, so maybe (simple) reinterlacing can impact on encoding.

paradoxical
24th April 2013, 23:07
Ok, but the video has already 9008 kbps, I can't raise bitrate up much more for DVD compliancy.

żAny other ideas? The video is processed in 480p and is very sharp too, so maybe (simple) reinterlacing can impact on encoding.

You might try doing a low-pass filter on the video to help the compressibility. Otherwise if you're already at the max bitrate you can encode at you might just have to live with it.

IanB
25th April 2013, 00:12
In the vane of every little bit helps.

Two tricks that can slightly reduce the bit demand for encoding text, 1. make the text and halo slightly transparent, this helps with motion estimation of objects moving behind the text. 2. use the interlaced mode of the antialiaser, this adds a subtle vertical blur to the characters, slightly lowering bits need caused by sharp edges.

With inbuilt Avisynth Subtitle filter :-...
TextColor=$80E0E0E0 # 50% transparent 90% white
HaloColor=$C0404040 # 75% transparent dark gray
Subtitle(..., text_color=TextColor, halo_color=HaloColor, interlaced=True)

fvisagie
25th April 2013, 13:22
Also be sure to use two-pass encoding, to get the maximum out of the allowed bitrate.

Cheers,
Francois

paradoxical
25th April 2013, 20:24
Also be sure to use two-pass encoding, to get the maximum out of the allowed bitrate.

Having done lots of encoding with CCE, there is usually almost no real noticeable benefits between doing a maxed-out bitrate 1-pass CBR vs a 2-pass at the 9000kbps+ bitrates that Alex-Kid is using. Doing some level of filtering will do far more to help compressibility than 2-pass encoding.

fvisagie
26th April 2013, 08:04
Having done lots of encoding with CCE, there is usually almost no real noticeable benefits between doing a maxed-out bitrate 1-pass CBR vs a 2-pass at the 9000kbps+ bitrates that Alex-Kid is using.

That's interesting. I'll look out for it with my next DVD encode. Although I use ffmpeg; do what extent have you experienced this with other encoders also?

Doing some level of filtering will do far more to help compressibility than 2-pass encoding.

For sure. Although this does introduce a compressibility vs. quality loss trade-off.

paradoxical
26th April 2013, 14:15
That's interesting. I'll look out for it with my next DVD encode. Although I use ffmpeg; do what extent have you experienced this with other encoders also?

HCEnc was pretty similar. 2-pass might do something noticeable if we were talking like 4000 kbps, but at 9000+ kbps it's going to make negligible difference. 2-pass at 9000+ kbps and CBR at 9000+ kbps are going to look pretty much the same. The only thing the 2-pass would do is possibly make it so you could get a smaller file size while possible having similar quality, but since he's already looking to max out the bitrate that doesn't really seem to be a concern. A frame encoded at 9000kbps in a 2-pass encode is not going to somehow look magically better than if the frame was encoded with the same bitrate doing a 1-pass unless something is either broken or it makes stupid decisions in the 1-pass code.


For sure. Although this does introduce a compressibility vs. quality loss trade-off.

Considering he's already seeing quite noticeable compression artifacts, it's not like it's going to get worse.

fvisagie
29th April 2013, 07:56
That makes a lot of sense, thanks.

Alex-Kid
30th April 2013, 00:01
In the vane of every little bit helps.

Two tricks that can slightly reduce the bit demand for encoding text, 1. make the text and halo slightly transparent, this helps with motion estimation of objects moving behind the text. 2. use the interlaced mode of the antialiaser, this adds a subtle vertical blur to the characters, slightly lowering bits need caused by sharp edges.

With inbuilt Avisynth Subtitle filter :-...
TextColor=$80E0E0E0 # 50% transparent 90% white
HaloColor=$C0404040 # 75% transparent dark gray
Subtitle(..., text_color=TextColor, halo_color=HaloColor, interlaced=True)

Thanks for the tip but, due to high motion scenes, subs tend to disappear and complicate reading, even with little transparency. Interlaced mode of subtitle filter is already turned on.

I was wondering if building a subtitle mask and applying antialias filters would gain some more compressibility.

Also be sure to use two-pass encoding, to get the maximum out of the allowed bitrate.


I already use 2-pass encoding with HCEnc. I even set Adaptive Quantization with a value of 3, but it doesn't seem to work well with hardsubbing.

As a final thought: I've seen many DVD scenes with high motion but clean subtitles. I know HCEnc is a very good encoder and I've used it for a long time to encode my miniDV tapes. But this is the first time I do enough processing steps to enhance the picture and find that HCEnc doesn't seem to handle it well, even at very high bitrate.

I must also say that I used lossless encoding for intermediate steps.

paradoxical
6th May 2013, 15:00
Are you sure that those DVD scenes aren't using forced subtitles to achieve that? If you are authoring for DVD it might just be better to create a subtitle track and set it as a forced stream. That way you will get clean subtitles and since they can't be disabled it will achieve the same effect as hard-subbing.

Alex-Kid
10th May 2013, 07:32
Are you sure that those DVD scenes aren't using forced subtitles to achieve that? If you are authoring for DVD it might just be better to create a subtitle track and set it as a forced stream. That way you will get clean subtitles and since they can't be disabled it will achieve the same effect as hard-subbing.

Now that you mention it, I am not sure if those subs were hard or soft, but I have to admit that it's a very good idea. Thank you! :)

TheSkiller
15th May 2013, 14:42
The clock in your screenshot is definitely not a softsub because softsubs are not affected by lossly video compression. They are not part of the picture, they are overlaid on top of it.
But nevertheless softsubs on DVD are limited to 4 colors for a given subpicture, hence they are not as smooth but with the right technique they will look just fine.

paradoxical
15th May 2013, 15:21
The clock in your screenshot is definitely not a softsub because softsubs are not affected by lossly video compression. They are not part of the picture, they are overlaid on top of it.
But nevertheless softsubs on DVD are limited to 4 colors for a given subpicture, hence they are not as smooth but with the right technique they will look just fine.

The pictures above weren't what he was talking about. He mentioned he had seen other DVDs that had similar overlaid subtitles that didn't show compression artifacts. Which is why I mentioned that they could just be forced subtitles.

As a final thought: I've seen many DVD scenes with high motion but clean subtitles.

Emulgator
23rd May 2013, 18:08
I see decoding faults already in the source fields (the red car's door frame).
The other field's chroma is leaking in.
So if you reinterlace these you will get chroma faults anyway.

Before trying to mend this:
Find the faulty decoder. It is system dependent.

For instance: If you run XP and use AviSynth using DirectShowSource,
you have a good chance to be connected to quartz.dll, qdv.dll. These do introduce chroma decoding faults with DV-AVI.
Once you go through VD (using internal dvsd VfW), on the same system you get proper decoding.
On Win7 DirectShow decodes DV properly regarding chroma, but may therefore drop the first frame, making any cut offset by one.

And with Cedocida I ran into faults as well, I can not tell why, just dropped it. Have to try again once.