Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#1 | Link |
Registered User
Join Date: Nov 2009
Posts: 12
|
about real time encoding with 2pass
Hi, recently, I did some comparison between 1 pass ABR and 2 pass, obviously, 2 pass almostly uses less bit rate to produce more psnr, my issue is if I can use 2 pass method, when I want to implement real time encoding, certainly, it is not really real time, 10 or more second latency can be allowed, and my assumption is one pass generates stat in real time, meanwhile another pass encodes later than 10 seconds based on the stat, can X264 implement it? or somebody has considered it or implemented it based on X264? thanks
![]() |
![]() |
![]() |
![]() |
#2 | Link |
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Impossible in the general case since the purpose of 2-pass is to distribute bits over the whole video, while your plan would only distribute bits over, well, 10 seconds.
However, this is already implemented as RC-lookahead in x264, and is used for VBV, where one does in fact care about the next few seconds as opposed to the whole video. |
![]() |
![]() |
![]() |
#3 | Link | |
Registered User
Join Date: Nov 2009
Posts: 12
|
Quote:
In fact, I attempt to encode some sport program(such as NBA) from 1080i to D1, as you know, the scene in NBA is always high complexed, my plan is encoding them in a very low bitrate, 800bps maybe, however, the result is awful, too obvious block-effect exist in edge for the complexed scene, I know it's because of the high QP for low bitrate, so I try some special methods to improve the quality, not for the psnr, but for the vision from human, and I denoise the raw data based on freq and time domain to smooth the detail, which maybe decrease the complexity for encoding and more or less can distribute some bits for reducing the block effect, could my attempt be available? or do you have any suggestion for the pre-posting or the encoding process for increasing the quality at low bitrate? |
|
![]() |
![]() |
![]() |
#4 | Link |
Derek Prestegard IRL
![]() Join Date: Nov 2003
Location: Los Angeles
Posts: 6,001
|
If you're having low quality due to high QPs, then you can do a few things:
1) Slow down x264 to increase its quality 2) Increase bitrate 3) Decrease resolution 4) Add denoising, either directly in x264, or ideally via more fancy stuff like AviSynth ![]() How exactly are you processing your 1080i sources? Real-time is not my specialty, and probably rules out AviSynth, but maybe something can be done. Why the low bitrate restriction? What x264 command line exactly are you using? Your problem may be due to poorly chosen settings. Are you going to 480p60 or 480p30? If you're coding interlaced - you probably shouldn't if you're trying to squeeze in as much quality as possible. The scaling / deinterlacing process can also heavily impact compressibility. So - how are you doing this? 800kbps is probably enough bitrate for 480p30 sports to look *okay*, not fabulous or anything, always hard to say - and always source specific!! Moar info pls ![]() ~MiSfit
__________________
These are all my personal statements, not those of my employer :) Last edited by Blue_MiSfit; 26th December 2009 at 23:42. |
![]() |
![]() |
![]() |
#5 | Link | |
Registered User
Join Date: Nov 2009
Posts: 12
|
Quote:
1 pass --bitrate 800 --ratetol 10 --qcomp 0.9 --profile baseline --me dia --ref 1; 2 pass --bitrate 800 --ratetol 10 --qcomp 0.9 --profile baseline --analysis all --me umh --ref 3 --deblock 3:3. 800bps is restricted by the network, but it allows 10 second latency, so I choose 10 as ratetol, and baseline is confined by the decoder, cabac and B can' t be used. and deblock alpha and beta is set as 3 3, which can help to decrease the block effect more or less I think. however, all my attempts do not give me a obvious improvement, now my plan is below: 1 reduce some detail at pre-process, by using some strong denose tool or blur tool, because of scaling down too much. 2 because of NBA scene, what we concentrate on are always the athlete and ball, while the auditorium is ignored usually, so I can adjust the QP higher at center region, on the contrary, lower at around of the video, so maybe I add some code for ratecontrol based on the region adaptive. that is my assumption, any suggestion? |
|
![]() |
![]() |
![]() |
#6 | Link | |
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
Here's what you actually mean: --bitrate 800 --vbv-maxrate 800 --vbv-bufsize 8000 |
|
![]() |
![]() |
![]() |
#7 | Link | |
Registered User
Join Date: Nov 2009
Posts: 12
|
Quote:
And I just view some threads about CBR, you suggest me to use VBV buffer model, and according to my understanding, X264 set a 10 second video buffer for imitating the stream buffer at decoder, in purpose that X264 can distribute less bits for the low complexed scene, and more bits for the high ones, but the distribution is limited by the size of buffer to ensure the decoder stream buffer is not overflow and underflow, in a word, that means it produces a stream with constant bitrate in 10 seconds perspective and if we see the curve of bitrate, it must be fluctuant around --vbv-maxrate. is it correct? if so, what is --bitrate used for? and when we set VBV, has the --rc-lookahead been set as a default value? because, if not, how the x264 can guarantee the constant bitrate in a 10 seconds perspective? Last edited by seanxu_2010; 27th December 2009 at 05:52. |
|
![]() |
![]() |
![]() |
#8 | Link | |
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
|
|
![]() |
![]() |
![]() |
#9 | Link | |
Registered User
Join Date: Nov 2009
Posts: 12
|
Quote:
and another question is when we set VBV, has the --rc-lookahead been set as a default value? because, if not, how the x264 can guarantee the constant bitrate in a 10 seconds perspective? |
|
![]() |
![]() |
![]() |
#10 | Link | |
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
|
|
![]() |
![]() |
![]() |
#13 | Link | |
Registered User
Join Date: Nov 2009
Posts: 12
|
Quote:
x264 --profile baseline --bitrate 800 --vbv-maxrate 800 --vbv-bufsize 8000 --me umh --analyse all --qcomp 0.90 --subme 6 --trellis 1 --ref 3 --rc-lookahead 200 -o vbv_basketball_8000.mkv 640x360@30.yuv --fps 30 --psnr x264 [info]: 640x360 (given by file name) @ 30.00 fps x264 [info]: using cpu capabilities: none! x264 [info]: profile Baseline, level 3.0 x264 [info]: frame I:1 Avg QP:31.25 size: 21862 PSNR Mean Y:33.30 U:38.34 V:39.47 Avg:34.50 Global:34.50 x264 [info]: frame P:150 Avg QP:31.05 size: 3784 PSNR Mean Y:33.01 U:37.18 V:39.14 Avg:34.13 Global:34.05 x264 [info]: mb I I16..4: 9.3% 0.0% 90.7% x264 [info]: mb P I16..4: 0.3% 0.0% 1.0% P16..4: 43.6% 14.9% 7.3% 0.9% 0.6% skip:31.4% x264 [info]: coded y,uvDC,uvAC intra: 72.0% 74.3% 51.7% inter: 14.1% 13.6% 2.9% x264 [info]: i16 v,h,dc,p: 45% 31% 13% 11% x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 26% 17% 6% 5% 6% 6% 6% 6% x264 [info]: ref P L0: 75.5% 15.6% 8.9% x264 [info]: PSNR Mean Y:33.012 U:37.188 V:39.139 Avg:34.137 Global:34.051 kb/s:936.92 I find all of the bitrates exceed 800 bps which vbv-maxrate specifies, does it seem accurate? I mean, if the bitrate in continuous 10 seconds are beyond 800bps, the buffer will be overflow! |
|
![]() |
![]() |
![]() |
#14 | Link | |
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
|
|
![]() |
![]() |
![]() |
#15 | Link |
Registered User
Join Date: Nov 2009
Posts: 12
|
I try to follow your mind, we set the VBV as 90% of the size in buffer at initialization, the decoder consume the stream in buffer at the speed of a higher value than 800bps according to the bitrate generated by encoder, while the network can only support the bitrate less than 800bps, then, the balance would be broken, the number of data in buffer must be shifted down, however, it can't induce underflow. Now, we suppose the stream flow is no end, before the buffer underlow, the encoder will produce stream at bitrate under 800bps for filling the buffer, is it correct?
|
![]() |
![]() |
![]() |
#17 | Link |
Registered User
Join Date: May 2006
Posts: 957
|
What CPU are you running this on?
__________________
x264 log explained || x264 deblocking how-to preset -> tune -> user set options -> fast first pass -> profile -> level Doom10 - Of course it's better, it's one more. |
![]() |
![]() |
![]() |
#18 | Link |
Registered User
Join Date: Nov 2009
Posts: 12
|
I disable acceleration for debug
I insight into the sequence of sport scene, I find out some frame will consume higher bits than normal because of the photoflash lamp, however I think such special scenes can be eliminated for saving bits, is there any method to drop some frame according to some special conditions for example, set upper limit for total bits per frame or drop some frame according to frame type? another question is, can I affect or change QP to different slice? for example, I divide a whole frame into 3 slices, the up and down are set as higher QPs, because nobody will take care of them, hence, it can save some bits for the middle slice, is there any method to implement it? |
![]() |
![]() |
![]() |
#19 | Link | ||
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
If you're trying to limit bits per frame for network reasons, you'll need to explain the entire use-case before I can give more advice. Quote:
|
||
![]() |
![]() |
![]() |
#20 | Link | |
Registered User
Join Date: Nov 2009
Posts: 12
|
Quote:
I use VBV to obtain a proper bitrate to accommodate the network. I used ESEyE to observe the size of every frame, I found some B frame used very high bit because of fash lamp, what I expect is when we find it's B frame, and consume an extreme high bits, I will drop it for saving bits for other frame. because in the match, we will concentrate on the athletes in the middle slice, and up and down are always audience, we can use higher QP to blue them for saving bits |
|
![]() |
![]() |
![]() |
Tags |
2 pass, realtime, x264 |
Thread Tools | Search this Thread |
Display Modes | |
|
|