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.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 31st May 2016, 10:35   #1  |  Link
OvejaNegra
ekTOMBE STUDIOS
 
OvejaNegra's Avatar
 
Join Date: Dec 2005
Location: Cuba
Posts: 253
some general questions about encoding with x264

crf vs 2pass: Lets say i encode a test video using crf 18. The resulting file es 4GB. Now i encode the same material using 2pass and calculating the bitrate to produce a 4GB file. I have now two files of the same size.

1- Which one has better bitrate distribution (of course its a very bad question): which one will have better overall quality?

In theory 2 pass should take bitrate from high motion scenes (higher quantizers) and give it to low/ regular motion scenes (lower quantizers) creating more quality as perceived by the user (since high motion scenes are difficult to watch in detail). on the other side, crf should give more average quantizer distribution, not so good loking slow scenes but better fast motion scenes = stable quality over the video (in a more practical way than using constant quantizer).

BUT im very sure im wrong and crf is better thant using 2 pass, right?

(im talking about quality, dont care about size fitting right now).

2- Is possible to create a file using crf and at the same time comply with level 3.1 (for example) and vbv constraints? Wikipedia specify a max of 17,500 kbits for level 3.1 on high profile. let's say i want to comply with that and some vbv restraints for some device AND use crf at the same time, it's possible?


3- If i want to encode to constant quantizer (for archival purposes) and im happy with ... qp 10. Are there any other settings i need to touch? Should i set pbratio to 1.0, or simply disable bframes?


4- If im encoding a 720p and set the level to 4.1, is that wrong, or i should set the level to 3.1 and vbv-maxrate to 17,500, 000 to be REALLY level compliant? (info from the wiki).

5- Using 2pass encoding, is possible to adjust the bitrate redistribution: Take bitrate from low motion scenes and give it to fast motion scenes?


6- The same for crf: can i control the "quality" distribution?


7- How should compress a video if i want to stream it at 3mb (for example) whit 5 seconds of pre-buffer? (for example, im not using audio, just video). or simply transmit in real time over specific bandwithd limitations


8- I encode anime with the "film" tuning because i like the grain retention, what settings should i "take" from the animation tune without affecting that? bframes and refs? Can anyone provide and example cli?

9- How can i encode at specific bitrate, for example 3mbs BUT without ANY vbr, i dot care if the compression jumps from q10 to q30 from one frame to another as long as it stays at 3mbs ALL THE TIME, constant bitrate, REALLY constant (it will look horrible, i know but i need it to test something)


10- I was reading this: http://www.chaneru.com/Roku/HLS/X264_Settings.htm but is not updated since 2011


thanks for everything, sorry if i mispelled something.
__________________
So, it works or not???
OvejaNegra is offline   Reply With Quote
Old 31st May 2016, 13:03   #2  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,479
1.) 2pass and CRF are more or less the same. (If anything, CRF has a slight advantage because it doesn't need to re-adjust to hit the target)
2.) Yes, no problem at all. Just use --level and --vbv-maxrate/--vbv-bufsize.
3.) It's not recommended at all. That's like asking whether you should stab your eyes with a knife or a fork.
4.) "Wrong" in what way?
5.)/6.) That's what is done by default. You can further adjust using --qcomp. (e.g. --tune grain is designed for more even bit distribution and is suitable for high bitrates)
7.) --vbv-maxrate 3000 --vbv-bufsize 15000. (Try a forum search, there should be several threads covering this more deeply.)
9.) --bitrate 3000 --vbv-maxrate 3000 --vbv-bufsize 3000 (or vbv-bufsize 1 to limit buffer to size of a single frame. but it's a stupid thing to do. choose buffer as big as possible for real life streaming. for archiving you don't need vbv at all)
sneaker_ger is offline   Reply With Quote
Old 31st May 2016, 18:56   #3  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,529
Quote:
9- How can i encode at specific bitrate, for example 3mbs BUT without ANY vbr, i dot care if the compression jumps from q10 to q30 from one frame to another as long as it stays at 3mbs ALL THE TIME, constant bitrate, REALLY constant (it will look horrible, i know but i need it to test something)
AFAIK If you must have TRUE constant bitrate (almost never really needed), then you must use single frame VBV. You also have to enable filler. I don't know how to make x264 size each frame perfectly without any padding.

Assuming 30fps video, set --bitrate 3000 --vbv-maxrate 3000 --vbv-bufsize 100 --nal-hrd cbr --filler

Also, output an elementary stream.

Finally, in cases where you need to hit an exact bitrate all the time (like MPEG-TS for broadcast etc) it's typical to fill the mux with null packets, instead of padding at the ES level. Not sure if that's what you're trying to do, but yeah...
Blue_MiSfit is offline   Reply With Quote
Old 31st May 2016, 19:50   #4  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,529
http://imgur.com/MMsT3eh
Blue_MiSfit is offline   Reply With Quote
Old 1st June 2016, 09:08   #5  |  Link
OvejaNegra
ekTOMBE STUDIOS
 
OvejaNegra's Avatar
 
Join Date: Dec 2005
Location: Cuba
Posts: 253
Im doing some tests right now.
About number 1:



__________________
So, it works or not???
OvejaNegra is offline   Reply With Quote
Old 25th June 2016, 20:43   #6  |  Link
OvejaNegra
ekTOMBE STUDIOS
 
OvejaNegra's Avatar
 
Join Date: Dec 2005
Location: Cuba
Posts: 253
To avoid creating a new thread:

11 - Lets say i'm not happy with the result of my second pass: What can i change without redoing the first pass
a) Increase - decrease bitrate?
b) Enable - disable trellis?
c) Change trellis settings ( --psy-rd)?
d) dc-dacimation
e) fast-p-skip
f) no psy
g) ratetol
h) q-comp
i) deadzones

12 - Im having strage results on two pass modes with some films (i'm using more than 18mbps):

Textured and dark areas like carpets , suits, walls, looking with block and dark patchess. Raising aq to 1.4 helps, but on slow scenes (like people talking with a dark sky on the background) the bitrate falls to something like 6mpbs, the scene looks bad no matter how i raise aq. the background looks blocky and patched again.
Any suggestions?

One example of such scene: Indiana jones and the temple of doom 00:27:56.
Encoding that scene by itself looks great, so i assume its a buffer restriction problem

my settings:
program --level 4.1 --pass 2 --bitrate 18344 --stats "E:\INDI_TEMP\test.stats" --vbv-bufsize 62500 --vbv-maxrate 50000 --aq-strength 1.4 --colorprim bt709 --transfer bt709 --colormatrix bt709 --output "output" "input"

Thanks
__________________
So, it works or not???
OvejaNegra is offline   Reply With Quote
Old 26th June 2016, 04:33   #7  |  Link
kuchikirukia
Registered User
 
Join Date: Oct 2014
Posts: 435
Why are you setting level and vbv?
kuchikirukia is offline   Reply With Quote
Old 26th June 2016, 07:35   #8  |  Link
OvejaNegra
ekTOMBE STUDIOS
 
OvejaNegra's Avatar
 
Join Date: Dec 2005
Location: Cuba
Posts: 253
because x264 specifys that setting the level is not enough, you must set the adecuated buffer:
https://en.wikibooks.org/wiki/MeGUI/...#x264_Settings
also, im using megui, and it set those values when i use level 4.1
__________________
So, it works or not???
OvejaNegra is offline   Reply With Quote
Reply

Tags
encoding, h264, x264

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:05.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.