Author Topic: XviD aspect bugs ?  (Read 25056 times)

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6060
Re: XviD aspect bugs ?
« Reply #75 on: February 07, 2015, 04:33:47 PM »
@kapetr: perhaps a rename of thread should be appropriate? A more fitting header?

kapetr

  • Newbie
  • *
  • Posts: 41
Re: XviD aspect bugs ?
« Reply #76 on: February 08, 2015, 10:59:00 AM »
4
You want constant size, not constant quality, so you use ABR. But you use Q limitation. so you do not want constant size either. Your goal is not clear. 
My goal is all time the same - to set upper limit of size. I have e.g. +- 4000kb/s mpeg2 source and I want "invest" maximally e.g. 1200 kb/s of target ABR. The target may be smaller - but if not and I get better quality then expected = no problem. But I do not want to get e.g. 2000 kb/s or even more. It has no sense for me to transcode and get just small  saving of space.
Is it now clear ?

And till now I have get no approach how to get what I want with CRF.

P.S.: thanks for anchors - will take a look

kapetr

  • Newbie
  • *
  • Posts: 41
Re: XviD aspect bugs ?
« Reply #77 on: February 08, 2015, 11:13:19 AM »
@kapetr: perhaps a rename of thread should be appropriate? A more fitting header?
Better to split it. Maybe some of Avidemux could see original topic to make changes to Avidemux.
But I don't know how to split. I you can - then it would by fine - I thing from Reply #45 (or #50). Thanks.
« Last Edit: February 08, 2015, 11:19:02 AM by kapetr »

poutnik

  • Full Member
  • ***
  • Posts: 167
Re: X264 rate control
« Reply #78 on: February 08, 2015, 12:44:18 PM »
Aside of conditional de-interlacing, light filtering and resizing, my goal is similar to your one.

But I guess your goal is  not just to make the size smaller, but also to keep quality above acceptable level.
ABR goes partially against your goal, as it sets not only maximum but also minimum bitrate ( putting aside Q limitation now ), ignoring quality levels.
Q limitation ignores visual quality levels as well, as it depends on video.

With near the same resolution ( 848x576 is 100.3% of 704x576 ) as original and CRF26, I get by rule of thumb usually 1/4-1/3 of original MPEG2 bitrate.
Note that some channels like CT2 have 3500-4000 kb/s , while for others like Prima ZOOM have usual bitrate even about 2500 kb/s.
For 2500 MPEG2 is 1500 H264 rather overkill.

Try for video sample a set of CRF numbers, and choose the one with optimal trade off between subjective visual quality and size.
Than keep this CRF for all your encoding.

I got for CRF26 typically 500-1400 kb/s. The question is. if your  maximum target is "maximal average bitrate" or "average average bitrate" ?
In my humble opinion, the more reasonable is the latter.
The latter for CRF26 may be about 800-900 kb/s.

If I were you, I would try CRF26 as first guess. IF you get for a serie of encodings avg bitrate too low, you may increase it or vice versa.
Remember the rule of thumb CRF difference 6 make size ratio about 1 : 2 
( Note that it is exponential , so CRF increment make size smaller  typically by 12%)

kapetr

  • Newbie
  • *
  • Posts: 41
Re: X264 rate control
« Reply #79 on: February 08, 2015, 07:15:09 PM »
I got for CRF26 typically 500-1400 kb/s. The question is. if your  maximum target is "maximal average bitrate" or "average average bitrate" ?
In my humble opinion, the more reasonable is the latter.
The latter for CRF26 may be about 800-900 kb/s.

I thing you talk about a point I had want discuss too. I do not understand, why ADM in "encoding status windows" uses designation "average bitrate". I thing it shows ABR for a very small time interval (? 1s) - thus it would be "more true" to name it "current bitrate".

I have mean of course (using your words) "average average bitrate"  - I mean ABR of whole video..
If I use e.g. ABR 1200 => the indicated bitrate is sometimes even over 3500kb/s, sometimes under 100kb/s.

Note - as I wrote - I have no problem (I'm glad), if target video has better quality. Only what I want is not to exceed selected ABR. With CRF I would get sometimes smaller files - but they would be worser.
I still thing that ABR with Q limits is simpler and safer way to reach what I want in 1-pass encoding.

You prefer constant quality - that is good thing. But you get with CRF for difficult video bigger ABR then I would accept and for simple video smaller ABR, but you pay with worse quality.

[Jinak řečeno: můžu sice vysledovat CRF tak, aby ABR nepřekračovalo třeba 1200kb/s (pro videa náročná na kompresi), ale pak při tomto CRF budu koukat (v případě dobře komprimovatelných videí) na stejně "zmršená" videa při bitrate (sice jen) 400kb/s, ačkoli jsem byl ochoten investovat 1200kb/s a mohl tak mít kvalitu mnohem lepší. A já k tomu navíc přidávám tu limitaci Q, aby nedocházelo k použití nesmyslně nízkých Q, resp. tak vysokých, že by již kvalita nebyla akceptovatelná. Zejm. tím dolním limitem pak mohu "našetřit" bitrate pro náročné úseky - kodér je myslím dost inteligentní a i nad rámec bufferu ví, že má našetřeno a může tedy v případě nutnosti použít vyšší bitrate déle.]

To get best for size-money is of course 2-pass encoding. But it is time expensive. The ABR+Qlimits approach is of course not as good as, but in most cases good enough (for my case of usage).
« Last Edit: February 08, 2015, 07:52:52 PM by kapetr »

poutnik

  • Full Member
  • ***
  • Posts: 167
Re: X264 rate control
« Reply #80 on: February 09, 2015, 07:51:23 AM »
I thing you talk about a point I had want discuss too. I do not understand, why ADM in "encoding status windows" uses designation "average bitrate". I thing it shows ABR for a very small time interval (? 1s) - thus it would be "more true" to name it "current bitrate".

It seems to be 1s bitrate average, what is rather useless information.

Quote
I have mean of course (using your words) "average average bitrate"  - I mean ABR of whole video..
If I use e.g. ABR 1200 => the indicated bitrate is sometimes even over 3500kb/s, sometimes under 100kb/s.

No, by "average average bitrate" (AABR) I mean average bitrate of average bitrates of all videos in storage. By "maximal average bitrate" (MABR) I mean maximal acceptable average bitrate for 1 video. :-)  I think your real goal is to have AABR not higher then 1500 kb/s.

CRF will you provide you for the same AABR better quality for complex videos than ABR,
while it safes bitrate on low complex videos where your eyes would not appreciate extra quality.

Another option for you is to set bitrate variance of ABR - MeGUI name, in ADM it is called Average bitrate tolerance on Quantizer tab of X264 settings.  MeGUI has for it default value 1%, what is quite strict, good for streaming, bad for scene adaptation. I would try to use 20-40%. ADM has as default 100%, what leads me to suspicion it may have little different meaning. MeGUI hints say 0% means strict average bitrate, while 100% rathe constant quantizer.

Quote
Note - as I wrote - I have no problem (I'm glad), if target video has better quality. Only what I want is not to exceed selected ABR. With CRF I would get sometimes smaller files - but they would be worser. I still thing that ABR with Q limits is simpler and safer way to reach what I want in 1-pass encoding.

You prefer constant quality - that is good thing. But you get with CRF for difficult video bigger ABR then I would accept and for simple video smaller ABR, but you pay with worse quality.
Simple and safer way is to use ABR tolerance parameter.

I do not understand why you do not want to accept lower AABR with occational bigger MABR ? IMHO it is good business.  Do you say you prefer accepting rather bad quality but not crossing your target ? CRF will give you better quality with the same AABR. You scarify quality of complex videos to waste it on simple videos where you will not notice it.

Hm, pokud Ti vyhovuje kvalita bitrate 1500 kb pro narocna videa, vyhovuje Ti kvalita i CRF26, u kterehoz jsem mel max 1450. A pokud Ti vyhovuje tato kvalita pri CRF26 u narocnych videi, vyhovuje Ti take u jednoduchych, kde Ti staci treba jen 500. A kdyz to zvednes treba na CRF24, budes mit treba 600-1800, s prumerem treba 1100-1200,
s kvalitou vyssi nez s ABR a AABR nizsi nez s ABR

--EN version of above-
If quality of bitrate 1500 for xomplex video is acceptable for you, is acceptable even CRF26, where are observed maximum 1450. ( Note that with the same bitrate CRF mode provide always better quality than ABR ). And if the quality is acceptable for complex vide, is acceptable for simple video as well, where 500 is sufficient. And if you raise quality to CRF24, you will get estimated bitrate variability 600-1800, wit average about 1100-1200. With quality better than with ABR and with A-ABR smaller than with ABR.
--------
Quote
To get best for size-money is of course 2-pass encoding. But it is time expensive. The ABR+Qlimits approach is of course not as good as, but in most cases good enough (for my case of usage).
CRF gives the same best for the size as the 2-pass ABR encoding, if you choose in 2pass the size of CRF encoding. But it is not the case of 1pass ABR. 1pass ABR rate control is  worse than 2pass ABR rate control. Generally, ABR has sense only if you must fit particular size, or streaming bandwidth. ( together with VBV )

The ABR rate control buffer is relatively short for 1pass ABR. If the video complexity is more or less constant, it gives comparable results as the same size CRF or 2pass ABR. But if video complexity changes are significant and last longer than few seconds, 1pass ABR adapts quantizers to keep the bitrate. I have read somewhere 1pass ABR control  rate buffer frame size = sqrt ( processed frames ). So for 60 min video it is sqrt(90000)=300, i.e. 12 s for 25 fps. 

Note that the encoder does not know the total length of the movie in 1pass encoding.
« Last Edit: February 17, 2015, 06:39:10 AM by poutnik »

poutnik

  • Full Member
  • ***
  • Posts: 167
Re: X264 rate control
« Reply #81 on: February 09, 2015, 08:40:14 PM »
As illustration of Effect of ABR with bitrate variance, here are 3 bitrate profiles:

The upper chart belongs to video encoded as CRF26, with one of the highest bitrates I noticed - 1421 bp/s
The middle chart belongs to the same video encoded as ABR 1421 bp/s at MeGUI default bitrate variance 1%.
The bottom chart belongs to the same video encoded as ABR 1421 bp/s, bit wit bitrate variance 40%.

Note that bitrate profile of the 2nd ABR is much closer to the one of CRF26.

« Last Edit: February 17, 2015, 12:37:33 PM by poutnik »

kapetr

  • Newbie
  • *
  • Posts: 41
Re: X264 rate control
« Reply #82 on: February 15, 2015, 04:10:11 PM »
Quote
No, by "average average bitrate" (AABR) I mean average bitrate of average bitrates of all videos in storage. By "maximal average bitrate" (MABR) I mean maximal acceptable average bitrate for 1 video. :-)  I think your real goal is to have AABR not higher then 1500 kb/s.

No - My goal is AABR=MABR=1500kb/s. (Velmi zjednodušeně řečeno. Videa přibývají, mažou se, ... Takže kódovat s kalkulací nějakémo AABR pro flešku je už z principu nesmysl.)

Hm, pokud Ti vyhovuje kvalita bitrate 1500 kb pro narocna videa, vyhovuje Ti kvalita i CRF26, u kterehoz jsem mel max 1450. A pokud Ti vyhovuje tato kvalita pri CRF26 u narocnych videi, vyhovuje Ti take u jednoduchych, kde Ti staci treba jen 500. A kdyz to zvednes treba na CRF24, budes mit treba 600-1800, s prumerem treba 1100-1200,
s kvalitou vyssi nez s ABR a AABR nizsi nez s ABR

Ne, stále mi nerozumíš - neříkám, že mně 1500kb/s u "náročného" videa nějak extra vyhovuje. Jen je snesitelné - za cenu, již jsem ochoten zaplatit. Tím pádem u "nenáročného" videa dostanu za investovanou částku 1500kb/s lepší kvalitu, než mi dá CRF - 500kb/s.
Jak jsem uvedl - náš přístup se liší - ty chceš konst. kvalitu, já konstantní ABR (přesněji řečeno - konstantní úsporu cíl/zdroj).
« Last Edit: February 15, 2015, 04:22:29 PM by kapetr »

poutnik

  • Full Member
  • ***
  • Posts: 167
Re: X264 rate control
« Reply #83 on: February 15, 2015, 04:36:41 PM »
Ne, Tvým cílem je úspora místa, a dÄ›láš to velmi neefektivním způsobem. 

Radeji vyplacas bitrate tam, kde to nepoznas, abys pak skudlil tam, kde to poznas, misto naopak.
To plati jednak pro srovnani videi mezi sebou, druhak tez v ramci jednoho videa a malou ABR bitrate variance.
Dost nelogicke.

Menší ale konstantní úspora s  velmi promÄ›nlivou kvalitou je podle Tebe lepší
než vÄ›tší, ale variabilní  úspora s vyrovnanou a celkove lepsi kvalitou.

Na fleshku se vejde klidne 20 filmu, a tam o AABR lze mluvit docela dobre.
Takze misto 20 filmu s ABR 1500 s kvalitou velmi kolisavou se ti tam vejde s CRF24 treba 25,
s kvalitou vyrovnanou a celkove lepsi.

Tuhle jsem vcera vyrobil s CRF26 velmi pekne dokumentarni video s BR cca 550 kb/s
dokonce s doublerate 50 fps ( MeGUI QTGMC script )

---- Added EN translation for general audience --------

No. Your goal is space saving, and you do it by very ineffective way.

You prefer wasting of bitrate on places where you will not notice it, to have to save it, where you will notice it, instead of the opposite. It is valid for both comparison between videos and as well within the same video ( in case of low ABR tolerance value ). Quite illogical.

You suppose smaller, but constant space saving with very variable quality is better, than bigger, but variable space saving with balanced and overall better quality.

Flash storage can hold easily up to 20 videos, so talking A-ABR makes good sense. Instead of 20 videos with ABR1500 with very variable quality, you may fit it with about 25 videos encoded by CRF24. with balanced and overall better quality.

Just as example, yesterday I have made with CRF26 very good documentary video with bitrate about 550 kb/s, even with doublerate 50 fps via Avisynth script QTGMC ( in MeGUI ).

« Last Edit: February 16, 2015, 07:40:30 AM by poutnik »

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6060
This is no longer a discussion concerning avidemux
« Reply #84 on: February 15, 2015, 06:30:18 PM »
Why switching to Czech language? Not very polite to your host! Kindly hold your MeGUI discussions somewhere else.

poutnik

  • Full Member
  • ***
  • Posts: 167
Re: Avidumux uses X264 ABR and CRF rate control
« Reply #85 on: February 15, 2015, 10:16:27 PM »
I have just reacted to czech post portions, as KaPetr has obvious difficulties with English. In fact, I almost never know if I read/write in Czech or English. Original intentions was not to have it all in Czech, but once written, I have let it so.

It is not MeGUI discussion, but discussion related to optimal X264 usage in ADM. The fact I use X264 mainly in MeGUI is irrelevant, as the principles are front-end independent. QTGMC script is not MeGUI script, but Avisynth script, usable by ADM via AVS proxy, AFAIK even in Linux under Wine . I mentioned both just as a side note in X264 rate control context.

So, unless usage of ADM is to be degraded to being just a TS/H264 cutter, it is still ADM relevant.
« Last Edit: February 18, 2015, 08:08:19 AM by poutnik »

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6060
Re: XviD aspect bugs ?
« Reply #86 on: February 16, 2015, 07:18:49 AM »
As most of us are not fluent in Czech, even google isn't, there is no point in posting these here.
Use PM for chat in Czech.

poutnik

  • Full Member
  • ***
  • Posts: 167
Re: X264 rate control
« Reply #87 on: February 16, 2015, 07:44:56 AM »
I have added EN translation. This approach is fully accepted in most web forums in case of issues with official language.
Aside of that, AFAIK PM does not allow attachments and adds nothing for contribution to general audience.

BTW, Forums are by their nature primarily aimed to topic discussion.
For bug reports are better suited Bug Trackers, like e.g. BTMantis.

As a note for moderators, I suggest mine and KaPetr X264 rate control related posts should be moved here :
http://avidemux.org/smuf/index.php/topic,16358.0.html
« Last Edit: February 18, 2015, 08:10:56 AM by poutnik »

kapetr

  • Newbie
  • *
  • Posts: 41
Re: X264 rate control
« Reply #88 on: February 21, 2015, 09:02:46 PM »
You prefer wasting of bitrate on places where you will not notice it, to have to save it, where you will notice it, instead of the opposite. It is valid for both comparison between videos and as well within the same video ( in case of low ABR tolerance value ). Quite illogical.
I is not so.

Maybe for "difficult" video I could get better output with CRF resulting in target ABR 1200kb/s then with ABR 1200kb/s mode (also resulting in 1200kb/s ABR). That is probably true (even with Q limits).
But for more "simple" videos it gives to me better quality using ABR 1200kb/s then CRF resulting in target ABR 500 kb/s. And - even by simple video - by low 1200kb/s can be no word about wasting.

poutnik

  • Full Member
  • ***
  • Posts: 167
Re: X264 rate control
« Reply #89 on: February 23, 2015, 05:58:48 AM »
You have agreed with me in last post, even if you may do not know it yet.

As for redistribution of bitrate within a single video,  the same principles apply as well for redistribution of bitrate between different videos.

You can consider particular videos on you flash USB stick as parts of 1 supervideo, filling all your storage.

 If CRF raises its avg BR from 1200 to 1800 for 1 part and decrease to 600 for other part,
it manages at the same size  constant quality as for single video,
the same noticable increase of quality in one part( compared to ABR ) as for single video
the same not noticeable decrease of quality on the other part as for single video.

It is the same as within a single video, where you have already agreed CRF would provide better quality for the same size than ABR.

This allows you for several videos together  to reach even better quality with even smaller total size.
« Last Edit: February 23, 2015, 03:34:21 PM by poutnik »