Log in

View Full Version : Is it reasonable to encode in xvid with higher bitrate than the mpeg2 source?


Plamen234
12th May 2010, 18:17
The source is a tv recording
Video
ID : 330 (0x14A)
Menu ID : 10801 (0x2A31)
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : Yes
Format settings, Matrix : Default
Format_Settings_GOP : M=3, N=12
Duration : 1h 15mn
Bit rate mode : Variable
Bit rate : 4 196 Kbps
Nominal bit rate : 6 000 Kbps
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate : 25.000 fps
Standard : PAL
Resolution : 8 bits
Colorimetry : 4:2:0
Scan type : Interlaced
Scan order : Top Field First
Bits/(Pixel*Frame) : 0.405
Stream size : 2.20 GiB (89%)

The .avs is
LoadPlugin("D:\Programs\meGUI\tools\dgindex\DGDecode.dll")
DGDecode_mpeg2source("video.d2v", cpu=6, idct=5, info=3)
LoadPlugin("D:\Programs\meGUI\tools\avisynth_plugin\ColorMatrix.dll")
ColorMatrix(hints=true, interlaced=true, threads=0)
Load_Stdcall_Plugin("D:\Programs\meGUI\tools\yadif\yadif.dll")
Yadif(order=1)
crop(8,8,-8,-8)

The 1st-pass of a 2-pass encoding demands these bitrates
with mpeg matrix 6641 kbps
with h.263 matrix 7123 kbps (which I find strange for h.263 is less hungry as far as I know)

So which is reasonable in this case to give the encoder the bitrate it needs or to limit the bitrate up to the mpeg2 bitrate?
Preserving max quality is the goal.
And what is the reason for higer bitrate for xvid - the deinterlacing or the post processing in the .avs (or both)?

Thank you in advance and any help is appreciated.

Inspector.Gadget
12th May 2010, 18:24
What do you means "demands"?

Plamen234
12th May 2010, 18:31
at Q2 done in the 1st pass

Guest
12th May 2010, 20:03
Your response is incoherent. Please try again.

BigDid
12th May 2010, 21:18
The source is a tv recording
Video ...
The 1st-pass of a 2-pass encoding demands these bitrates
with mpeg matrix 6641 kbps
with h.263 matrix 7123 kbps (which I find strange for h.263 is less hungry as far as I know)
Hi,

Last xvid rev (1.22) uses Vaq (derivated from x264) which changes usual matrix behaviour; h263 now being the base matrix for Vaq.

I suppose that your 1st pass-Q2 is without B-frames ?

So which is reasonable in this case to give the encoder the bitrate it needs or to limit the bitrate up to the mpeg2 bitrate?
Preserving max quality is the goal.

Then stay with Q2, 1 pass quality, No-B frames, High bitrate matrix like EqmV3HR/UHR from Sharktooth or 6of9 from Didée ...

For a better Size/quality ratio you can use alone or in combination:
- B-frames
- Q2.5 or more in 1 pass quality.

If you want to play it via a SAP you will have to stick to more compatible matrix -and reduced bitrate- like EqmV2 (autoGK sharp matrix) or standard matrixes (Mpeg/h263).

See ASP matrixes thread from Sharktooth:
http://forum.doom9.org/showthread.php?s=&threadid=83125
Moderators: could Sharktooth's thread be stickied in the MPEG-4 ASP section?
It would allow a quick access for the xvid/MPEG-ASP enthusiasts, thank you!

Did

PS: another alternative would be to try a good quality 1 pass encoding with x264 (CRF 18 in Ripbot for example...)

Plamen234
13th May 2010, 05:36
Your response is incoherent. Please try again.

Right, I'm sorry.
I meant that I run only the 1st pass from the 2-pass encoding type. And at the end of this phase in the Xvid Status window the average bitrates are the stated above (nothing else in the settings is changed exept the matrix, and lets leave the concrete matrix choice).
And these bitrates are approximately twice higher than the mpeg2 interlaced source.
So my question is that should I limit the bitrate up to the average of the mpeg2 source or should I leave the higher bitrate that whatever xvid matrix needs?

Thanks to everyone again.

p.s.: sap compatability and x264 are left aside for now ;-)

Dark Shikari
13th May 2010, 05:37
The source is crap quality.

There's no point to encoding at such high quality when using such a bad source; it's just a waste of bits.

Didée
13th May 2010, 13:21
The source is crap quality.
How do you know - have you seen a sample?
A range of 4000~4500 kbps is the usual standard for DVB-S, which is the "good one". The small brother DVB-T usually clocks in at ~2000 kbps, maybe even less, and that is what looks really poor.

When you're spoiled by today's BR standards, then DVB-S is crap quality, yes. But if you spent an hour watching an old VHS capture and then switch to a DVB_S channel, then it looks all brilliant.

(But psssst ... the quality of DVB-S in Germany mostly is embarrassing, indeed.) ;-)


In any case, the Yadif deinterlacer usually causes rather high bitrate requirements. And it's not because of its high quality or the lots of detail it produces - in contrary, the high bitrate requirement rather is a sign of its bad deinterlacing quality.

Just for fun, you might test the following instead of Yadif:

bob().selecteven()

This is NOT a serious suggestion what you should actually use for deinterlacing! But it could be interesting to see what bitrate this would cause on Xvid's 1st pass. I'd guess there will be a 25% drop in bitrate.

If speed is not an issue, then TempGaussMC probably will give some top-notch deinterlacing together with lowest-possible bitrate requirement (compared to other deinterlacers).

But if speed IS an issue, then you probably don't want to use that.

Dark Shikari
13th May 2010, 17:43
How do you know - have you seen a sample?
A range of 4000~4500 kbps is the usual standard for DVB-S, which is the "good one". The small brother DVB-T usually clocks in at ~2000 kbps, maybe even less, and that is what looks really poor.

When you're spoiled by today's BR standards, then DVB-S is crap quality, yes. But if you spent an hour watching an old VHS capture and then switch to a DVB_S channel, then it looks all brilliant.By "crap quality" I mean "given a lossless source, Xvid Q2 will look better than a DVB-S encode of that lossless source". Accordingly, Xvid Q2 on a DVB-S encode of that source is a waste of bits.

Plamen234
13th May 2010, 18:10
I got the point for the bitrate ;-)
About the deinterlacing process, it's still a magic for me done by the megui's analyzer (yeah, I'm still under Windows for avisynth and megui) and the choice for the deinterlacer is megui's.

I'll give the shot for TempGausMC - speed is not a problem (actually it is when encoding is done with x264 with the most insane options).

henryho_hk
14th May 2010, 12:01
I suggest degrainmedian(mode=2, interlaced=true).TempGaussMC_beta2(tr2=3,EdiMode="NNEDI2") [yes, double-rate deinterlacing retains full temporal resolution.... Don't you say you want quality?]

Then you can safely do a two-pass 2700~3000kbps EQM v2 (http://www.webalice.it/f.corriga/CQMs/eqm_autogk_sharp.xcm) XviD encode (50fps!). You'd better make an intermediate AVI with huffyuv or XviD EQM EHR/UHR CQ2 (non-VAQ) since TempGaussMC_beta2() spends you hours. And you are free to encode to XviD or x264 with that intermediate AVI.

Plamen234
18th May 2010, 06:56
Thank you henryho_hk
I suggest degrainmedian(mode=2, interlaced=true).TempGaussMC_beta2(tr2=3,EdiMode="NNEDI2") [yes, double-rate deinterlacing retains full temporal resolution.... Don't you say you want quality?]
I will give a try on this method.


Then you can safely do a two-pass 2700~3000kbps EQM v2 (http://www.webalice.it/f.corriga/CQMs/eqm_autogk_sharp.xcm) XviD encode (50fps!).
50fps? Why is this and what should I do with such rate?


You'd better make an intermediate AVI with huffyuv or XviD EQM EHR/UHR CQ2 (non-VAQ) since TempGaussMC_beta2() spends you hours. And you are free to encode to XviD or x264 with that intermediate AVI.
Here I did not got the idea for the "intermediate AVI". Could you, please, elaborate on this?

henryho_hk
19th May 2010, 12:25
We can say that PAL interlaced footage has 50fps temporal resolution with half spatial resolution (even and odd fields, 720x288 each).

By deinterlacing (single-rate deinterlacing), we convert it into 720x576 frames @ 25fps.
By bobbing (double-rate deinterlacing), we convert it into 720x576 frames @ 50fps.

With excellent bobbers like TGMC, you have stable and crisp results, (mostly) free of aliasing, AND fluent motion. If u want 25fps output, simply add a "selecteven()" after it. Still light-years better than yadif even yadifmod+nnedi2 combo.

But you need to spend time, quite a lot of time, running TGMC. It is tedious to run TGMC twice for 2-pass encodes. To save the overall encoding time, I recommend deinterlacing/bobbing your source by TGMC and save it as a loss-transparent/lossless AVI first. And then do your favorite 2-pass encoding over the intermediate file.

Plamen234
27th May 2010, 21:19
Thank you for your reply!
I perfectly got your idea. And this puts new and higher limits to my encodes.