Log in

View Full Version : Multi pass encoding with x264


sirt
27th July 2012, 15:18
Hi,

Lately I've been doing many tests with x264 and another h264 encoders. You all know x264 allows you to use more than two pass to encode. I've tried to encode a video in 3 pass in order to compare te output with the corresponding one in 2 pass mode. Honestly I had not been able to pick up anything different from an output to another.

So what do you think of multi pass encoding ? Let's say I decide to encode in 10 pass, what will concretely happen ? As I've read the encoder - when doing the 2nd pass - relies on the data collected during the 1st pass ; but, when doing the 3rd pass, it is still unclear to me if it will adapt its work basing on previous 2 passes or only the second one.

Kurtnoise
27th July 2012, 15:33
1/ Post your command line

2/ http://mewiki.project357.com/wiki/X264_Settings#pass

sirt
27th July 2012, 15:38
What command line would you like ? It's almost simple, what if I do this :

--preset slower --bitrate 2000 --pass 1
--preset slower --bitrate 2000 --pass 2
--preset slower --bitrate 2000 --pass 3

Or even :

--preset slower --bitrate 2000 --pass 1
--preset slower --bitrate 2000 --pass 2
--preset slower --bitrate 2000 --pass 3
--preset slower --bitrate 2000 --pass 4
--preset slower --bitrate 2000 --pass 5
--preset slower --bitrate 2000 --pass 6

sneaker_ger
27th July 2012, 15:42
Read the link he posted, you're doing it wrong.

Atak_Snajpera
27th July 2012, 16:08
What command line would you like ? It's almost simple, what if I do this :

--preset slower --bitrate 2000 --pass 1
--preset slower --bitrate 2000 --pass 2
--preset slower --bitrate 2000 --pass 3

Or even :

--preset slower --bitrate 2000 --pass 1
--preset slower --bitrate 2000 --pass 2
--preset slower --bitrate 2000 --pass 3
--preset slower --bitrate 2000 --pass 4
--preset slower --bitrate 2000 --pass 5
--preset slower --bitrate 2000 --pass 6

I would use
--preset slower --bitrate 2000 --pass infinite

SassBot
27th July 2012, 16:17
So what do you think of multi pass encoding ?

It's a waste of time unless you need a tighter tolerance on the final size. That's about the only thing you'll get out of using more than 2 passes.

Let's say I decide to encode in 10 pass, what will concretely happen ?

You'll be wasting lots of electricity and time that could be better spent on encoding something else.

sirt
27th July 2012, 17:27
Read the link he posted, you're doing it wrong.

I know, I simplified the comand lines to give an idea of what I intend to do.


Atak_Snajpera

Fortunately such settings doesn't exist..


Sassboot

Then I conclude it is completely useless because the "tolerance" you mention has no sence : I just tried an encode in 3 pass and there was a small difference of 2 MB between the 2 pass & 3 pass encode.

SassBot
27th July 2012, 17:31
Then I conclude it is completely useless because the "tolerance" you mention has no sence : I just tried an encode in 3 pass and there was a small difference of 2 MB between the 2 pass & 3 pass encode.

I didn't say it would make a huge difference, but you do get slightly better ratecontrol with more passes. This was why I said explicitly "It's a waste of time" since that slight difference isn't worth wasting the electricity and time.

kotuwa
2nd June 2015, 22:39
What command line would you like ? It's almost simple, what if I do this :

--preset slower --bitrate 2000 --pass 1
--preset slower --bitrate 2000 --pass 2
--preset slower --bitrate 2000 --pass 3

Or even :

--preset slower --bitrate 2000 --pass 1
--preset slower --bitrate 2000 --pass 2
--preset slower --bitrate 2000 --pass 3
--preset slower --bitrate 2000 --pass 4
--preset slower --bitrate 2000 --pass 5
--preset slower --bitrate 2000 --pass 6
Read the link he posted, you're doing it wrong.
I know, I simplified the comand lines to give an idea of what I intend to do.

I think it is not the other options, the switch for the 3 pass is wrong, as i know...
I have no idea above would work or not...
Of cource it would give an output, but I think it won't give what 3 pass gives if you used first 3 lines...
There the 2nd line is wasted as --pass 2 does not update the stat file, and the 3rd line would work as the 2nd pass of a 3 pass encode...

As I know the 3 pass would be like

--preset veryslow --bitrate 2000 --pass 1
--preset veryslow --bitrate 2000 --pass 3
--preset veryslow --bitrate 2000 --pass 3

It does not have 2 in it... 2nd pass is also 3... Nth pass is also 3...

--preset veryslow --bitrate 2000 --pass 1
--preset veryslow --bitrate 2000 --pass 3
--preset veryslow --bitrate 2000 --pass 3
--preset veryslow --bitrate 2000 --pass 3
--preset veryslow --bitrate 2000 --pass 3
etc....

Correct me if I am wrong...
!

Asmodian
3rd June 2015, 00:43
Three pass can also be done:

--preset veryslow --bitrate 2000 --pass 1
--preset veryslow --bitrate 2000 --pass 3
--preset veryslow --bitrate 2000 --pass 2

or:
--preset veryslow --bitrate 2000 --pass 1
--preset veryslow --bitrate 2000 --pass 3
--preset veryslow --bitrate 2000 --pass 3
--preset veryslow --bitrate 2000 --pass 3
--preset veryslow --bitrate 2000 --pass 2

note: this thread is/was ~3 years old. ;)

kotuwa
3rd June 2015, 09:11
Does

--preset veryslow --bitrate 2000 --pass 1
--preset veryslow --bitrate 2000 --pass 3
--preset veryslow --bitrate 2000 --pass 2

is better than

--preset veryslow --bitrate 2000 --pass 1
--preset veryslow --bitrate 2000 --pass 3
--preset veryslow --bitrate 2000 --pass 3

!?
If no further passes are going to happen, then using --pass 2 for the 3rd line would be better than using --pass 3
!?

jpsdr
3rd June 2015, 09:17
It's in the help :

-p, --pass <integer> Enable multipass ratecontrol
- 1: First pass, creates stats file
- 2: Last pass, does not overwrite stats file
- 3: Nth pass, overwrites stats file

I personnaly think it should en with 2.

foxyshadis
3rd June 2015, 10:12
Every single pass can be --pass 3 and it would make zip zero difference. --pass 3 is just the general case, while --pass 1 doesn't output video and --pass 2 doesn't output new stats.

Good luck seeing any difference for more than 2 passes, though.

sneaker_ger
3rd June 2015, 17:51
Every single pass can be --pass 3 and it would make zip zero difference. --pass 3 is just the general case, while --pass 1 doesn't output video
No, --pass 3 will try to read a stats file and error out if it does not exist. The first pass always has to be --pass 1. (And --pass 1 does output video)

kotuwa
4th June 2015, 00:43
No, --pass 3 will try to read a stats file and error out if it does not exist. The first pass always has to be --pass 1. (And --pass 1 does output video)
If an output is specified, it gives....
If the output name is NUL, then it does not...
If --slow-firstpass is not used, that output is nothing but trouble... :D
I saw one guy uploaded a tv show using that file.... without even looking/playing... lol :D
Even though --slow-firstpass used, average bitrate is still not good enough....
In any case (rare cases, like this OP) someone need to use the first pass file, then --crf firstpass with --slow-firstpass would be better....
:)

benwaggoner
4th June 2015, 18:17
I've seen a 3rd pass help quality some when there's a big ratio between abr and pbr, particularly if it's a fast first pass. But the delta hasn't been big enough for me to bother to do it except for some very high profile files with extreme variance in complexity within the source file and a very low target ABR. Basically cases where I'm already using Placebo because, why not. When a file is going to get >100K downloads, shaving off 5% of file size can be well worth spending 10x more time encoding.