Log in

View Full Version : Maximum quality at low bitrate


Michael Lewis
3rd October 2005, 04:50
I make Divx programs to watch on a palm handheld. I convert PAL TV programs from a hard disk recorder using VirtualdubMPEG2. They are 480x320 250 kbps using 2 pass Divx with mono sound. I use 12.5 framerate. I am still using Divx 5.
Generally I am happy with the results. I get 1 hour of continuous viewing for 120 MB stored on an SD card.I am trying to squeeze the maximum quality out of the minimum bitrate and I have some questions.
- I use 250 for the second pass, but I read somewhere that I should use a higher bitrate for the first pass so I use 2000. Is there a setting for the first pass bitrate which will give the best results or is the bitrate of the first pass irrelevant?
- Will I notice a quality improvement if I go to Divx 6 (I don't know much about it)?
Michael

temporance
3rd October 2005, 07:53
Best to use same bitrate in both passes for DivX

DeathTheSheep
3rd October 2005, 21:47
I believe DivXNetworks claims this:
"DivX [6] Pro offers up to 40% better compression than DivX 5"

Additionally, I find Shaping Psychovisaul enhancements beneficial at bitrates like this. Yes, extremely so.

Well, cheers.

DigitAl56K
4th October 2005, 17:49
Michael, you should see a large difference with DivX Pro 6. Try setting the encoder to "Extreme quality", and turn on "H.263 optimized quantization". Make sure bi-directional coding (B-frames) are also enabled.

Psychovis is also a useful tool, I prefer the "Shaping" mode, but also down to personal preference so perhaps you should try encoding the same clip with and without it enabled.

Michael Lewis
4th October 2005, 20:55
Thanks for the advice. I have already downloaded Divx 6 and I am trying it out. I tried shaping but could not spot any marked difference. What effect does it have?

Michael Lewis
4th October 2005, 21:04
A question about resizing.
I resize down from 704x576 to 480x320.
Should I resize within Divx or use a Virtualdub filter?
Which type of resizing should I specify in Divx?
Michael

DeathTheSheep
4th October 2005, 22:55
Answer 1: Psychovisual Enhancements
Psychovisual enhancements work by applying higher compression to areas where the human visual system (HVS) cannot percieve any difference. In theory, this diverts quality from these "unnoticeable" scenes and pours it into "noticeable" ones. It supposedly yields superior visual quality, but lower video metrics (PSNR).

A few points about psychovisual enhancements:
- Shaping is less extreme of a quality diversion than masking and takes less time to encode. Many people find shaping to "look" better. You might want to consider it.
- At a constant quantizer (unconstrained profile), phychovisual enhancements reduce filesize significantly.
- Psychovisual enhancements are more visually beneficial at low bitrates in that they mask blocking and complexity, reducing certain artifacts.
- In a critical frame-by-frame comparison, encodes with psychovisual enhancements tend to look worse, but this conclusion may not hold true when actually watching the clips.

Answer 2: Resizing
I usually recommend resizing *inside* the codec settings while using the "Fast Recompress" setting in VirtualDub. This way, the resize process is markedly faster due to the fact that the codec handles both processes at once--there is no physical split of running processes and instructions.
Resize modes:
- Bilinear: a good, accurate resize which applies no sharpening effects. Recommended for lower bitrates where tiny details have no reason to be sharpened. This mode is recommended for low bitrates by the AviSynth website.
- Bicubic: this will produce a sharper image which is generally more aesthetically pleasing, especially when upsized. Compression tends to be lower and produces more artifacts (mostly ringing, but due to lack of bitrate, blocking may also be present in large amounts).
- The best resize method to use depends on what you think looks best: try each.
- If you decide on a sharp resize method (sharp bicubic), consider psychovisual enhancements more. This is where HVS exploitation really makes its mark-- where there are more details to encode, the encoder has a better chance at illiminating those the HVS wouldn't notice. I generally use only mild psychovisual enhancements (shaping) on bilinearly resized video--it "softens" less than Masking while reducing filesize similarly (though maybe just a tad less).

Have fun.

Michael Lewis
5th October 2005, 10:18
DigitAl56k and DeathTheSheep
Thanks for the replies. It has given me a lot to try out.
An additional question. Mention has been made of certain settings producing better compression eg. shaping, using extreme quality and bilinear over bicubic resizing. (I recognise that I need to try them out in practice to see how they affect the final product). I assume that better compression produces a smaller file size and, since the file length is unchanged, I assume that these settings will decrease the video bitrate of the final divx.
I mention it because I view the video on a Palm and the limiting factors are the Palm processor (400MHz Intel XScale processor) and also the storage on an SD card. If these settings decrease effective bitrate, then I assume that I could increase the bitrate I specify and increase the quality for the same filesize.
Have I understood this right?
Michael

Michael Lewis
5th October 2005, 13:20
I have been reading a Palm forum on this issue and have read that greater compression gives a smaller filesize, but still requires at least the same processor power. I think i've answered my own question.
Michael

DeathTheSheep
5th October 2005, 18:11
Yes, I was referring to encode speed above. Decode speed is nearly always the same (unless you use Qpel/GMC), regardless of compression. I was merely explaining the subjective quality advantages/disadvantages of different psy/sizing methods.
Guess I misunderstood your intent, eh? ;)

PS: AVC is a different story: Its decode speed decreases drastically as the quantization is lowered.

Michael Lewis
5th October 2005, 19:27
Thanks. I am learning all the time.
Hope you will excuse a further question.
I am using Divx unconstrained, but there is a portable profile. Is there a reason to use it?
Michael

DigitAl56K
6th October 2005, 22:05
Yes,

Unconstrained mode does not (by default) constrain the encoder either in terms of the features it uses or the data rate it applies to the bitstream. Because of this, you can not always be assured that an arbitrary decoder will be able to play the bitstream, or to run on a platform with sufficient performance to play the bitstream well. For example, a common side-effect of encoding in unconstrained profile is that slower decoders can not handle the high data rate spikes that can occur in parts of the content, and therefore slow down, drop frames, or loose a/v sync.

It is best, when possible, to use a DivX Certified encoding profile in conjuction with a similarly (or higher) certified device . If you are encoding to PDA you may wish to experiment with the VBV CLI options for the encoder. These manage the rate control, and more information can be found in the DivX User Guide.

fight2win
7th October 2005, 05:41
hey, if i use honor pulldown flags in dgindex, then i use field deinterlace, then the frame rate is 29.97, so then should i use max. keyfframe interval to 300 or 240? also, do i need to change the fps?

DeathTheSheep
10th October 2005, 18:13
I'd use 300 for the 29.79fps encode and 240 for the 23.976fps encode (Either way, it amounts to one keyframe every 10 seconds).

On anime, I sometimes set the max to 500-1000 and let the codec do its work (Scene changes in anime are usually frequent, but when they're not, a sudden keyframe in a still scene might cause the scene to jump/flicker a little bit).

As for changing fps, I wouldn't do that unless:
1. It actually increases the visual quality to do so
2. The device does not support your current fps and requires lower.

Other than these 2 reasons, if your device supports the original fps and it looks good, by all means keep it. :)

DigitAl56K
11th October 2005, 15:42
hey, if i use honor pulldown flags in dgindex, then i use field deinterlace, then the frame rate is 29.97

29.97 after an ivtc seems odd (unless by "honor pulldown" you mean there is none).

ChronoCross
11th October 2005, 18:32
29.97 after an ivtc seems odd (unless by "honor pulldown" you mean there is none).

FieldDeinterlace only removes telecined frames. It has to be followed by decimate() in order to become IVTC. so the framerate will still be at 29.97.

Honor Pulldown is a feature of DGIndex by which the flags in the original mp2 stream are honored keeping duplicates indicated. the resulting output from DGIndex is 29.97.

manono
13th October 2005, 06:02
Hi-

29.97 after an ivtc seems odd (unless by "honor pulldown" you mean there is none).

Honor Pulldown Flags gives you the 29.97fps output. If it's interlaced video, then of course you deinterlace and keep it 29.97fps. If it's telecined from film, then you either IVTC it afterwards, or if originally encoded as Progressive, you don't use Honor Pulldown Flags at all, but use Forced Film in the first place to give you 23.976fps right off the bat.

I'm sorry ChronoCross, but your first paragraph makes no sense (unless I'm misunderstanding, always a possibility). FieldDeinterlace doesn't remove frames. It's a deinterlacer. You don't follow it with Decimate. Perhaps you meant to say Telecide followed by Decimate to IVTC.

ChronoCross
13th October 2005, 06:39
@manono

Sorry my terminology was a bit off. I was trying to explain that field deinterlace doesn't remove duplicate frames and that's the reason it was staying at 29.97fps. FieldDeinterlace is described in the readme as being equal to the post processing feature of telecide. So couldn't you follow FieldDeinterlace() with Decimate() to bring it back to 24fps?

manono
13th October 2005, 07:17
Hi-

OK, I did misunderstand a bit, but then your English was also imprecise. :) No problem.

FieldDeinterlace is described in the readme as being equal to the post processing feature of telecide.

Yes, that's true. It's the same deinterlacer. In Telecide, it's the equivalent of FieldDeinterlace(Full=False) used by itself. The idea is to check the frames after Telecide and deinterlace any frames that slipped through Telecide.

So couldn't you follow FieldDeinterlace() with Decimate() to bring it back to 24fps?

No, because FieldDeinterlace is a deinterlacer and not a field matcher. Most likely the movie will play jerky with all the movement being blended (with the default FieldDeinterlace(Blend=True)). If you use FieldDeinterlace(Blend=False), then you could use Decimate after it, but you will have lost half of your resolution as a result, because of the FieldDeinterlace setting. Either way is very bad. No, You want to use Telecide first. Say you open telecined film with Honor Pulldown Flags from DGIndex in GKnot. You step trrough it frame-by-frame and you'll see 3 good clean frames followed by 2 interlaced frames in every 5 frame sequence. Then if you apply Telecide by itself, you'll get 5 good clean progressive frames, but every 5th frame is a duplicate. Telecide matches the fields properly to create the progressive frames, but it's still 29.97fps. Then you follow Telecide with Decimate which, at default settings will remove one duplicate frame in every 5 frames, leaving you with no dupes, and a 23.976fps framerate.

stephanV
13th October 2005, 07:59
IOW

telecine pattern is: AA BB BC CD DD

If you deinterlace these frames, frame 3 and 4 will be a blend of two frames (B/C, and C/D). So effectively you have lost the real progressive frame C, and thus applying a decimate will never give you the original 24p stream.