Quantcast Ping-Pong Prediction vs Long-Short Prediction - Page 4 - digitalFAQ.com Forums [Archives]
  #61  
11-28-2004, 09:18 AM
Bchteam Bchteam is offline
Free Member
 
Join Date: Jan 2003
Posts: 275
Thanks: 0
Thanked 0 Times in 0 Posts
One question:

I have encoded a sample with this "ping/Pong" stuff. When I play the sample with the Media Player, there's a message in grey letters that says:

"Offset set to: 0 sec. (Offset intervall should be: 0 sec. / 49 sec.)"

Is that OK, or this an error ?
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #62  
11-28-2004, 09:54 AM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Bchteam
One question:

I have encoded a sample with this "ping/Pong" stuff. When I play the sample with the Media Player, there's a message in grey letters that says:

"Offset set to: 0 sec. (Offset intervall should be: 0 sec. / 49 sec.)"

Is that OK, or this an error ?
You need to read the second post of thread again.
49 sec is the offset for a "pong" pass.
When you go to encode, you must unable slicer function first, and no message will sowed.
Reply With Quote
  #63  
05-24-2005, 04:44 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Slicer has been updated ...

look here for the new Version:
http://www.kvcd.net/forum/viewtopic....15775&start=16
Reply With Quote
  #64  
05-24-2005, 07:59 AM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
Hi Andrej ,
Thanks for updating the original thread (as per my request ).
I have already tested it at home and I gotta tell you: I love it.
BTW, has it gotten any faster than the older release based on sampler()?
I'm saying this because I did a small test with (1,15,3,"ping") and it was ~15 seconds faster than the older one with the same parameters.
Or maybe it has something to do with the older version having the subtitling feature?
I had "subs on" when I encoded the sampler() based sample.
I was using HC Encoder v0.14beta with a simple Mpeg2Source() and your function.
Have you done any speed testings yourself between both versions?
Cheers pal
__________________
Rui
Reply With Quote
  #65  
05-24-2005, 09:13 AM
Zyphon Zyphon is offline
Free Member
 
Join Date: Oct 2003
Location: London, England (UK)
Posts: 1,035
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks Inc for updating your excelllent Ping-Pong prediction tool, I use this in my scripts when I do manual conversions and have had great results I like to look of the new version and no need to have sampler any more, I can't wait to run some tests with it.
__________________
Regards.

Michael.
Reply With Quote
  #66  
05-24-2005, 12:00 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
The new one does use the avisynth's internal SelectrangeEvery() command. Maybe thats the reason why a little speedup occures ... as the external call to sampler.dll is not more done. So it seems that SelectrangeEvery() is faster than Sampler().

The subtitles aren't needed anymore. In the old version it showed you how the offset has to be set manually, but now this will be done automatically when the script recognises the "pong" string in the slicer() command.
So no more Subs needed.

I got an extended slicer() Version of the latest release where ALL specs are shown in subtitles for testing, like OrigFramecount, SlicedFramecount, PercentOfMovie, Ping or Pong ... etc .... but who cares.
Reply With Quote
  #67  
05-24-2005, 12:46 PM
Zyphon Zyphon is offline
Free Member
 
Join Date: Oct 2003
Location: London, England (UK)
Posts: 1,035
Thanks: 0
Thanked 0 Times in 0 Posts
We care.
__________________
Regards.

Michael.
Reply With Quote
  #68  
05-24-2005, 02:55 PM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
The new one does use the avisynth's internal SelectrangeEvery() command. Maybe thats the reason why a little speedup occures ... as the external call to sampler.dll is not more done. So it seems that SelectrangeEvery() is faster than Sampler().
Could be, but I'll do some more thorough tests to proove it.
I'm guessing it could be the subtitle() too but I'll tell you later.
Quote:
The subtitles aren't needed anymore. In the old version it showed you how the offset has to be set manually, but now this will be done automatically when the script recognises the "pong" string in the slicer() command.
So no more Subs needed.
Having the option for the subs was cool, though.
Quote:
I got an extended slicer() Version of the latest release where ALL specs are shown in subtitles for testing, like OrigFramecount, SlicedFramecount, PercentOfMovie, Ping or Pong ... etc .... but who cares.
Andrej if you have such an enhancement could you share it with us?
We do care.
It could be very usefull to store ilustrated test runs with different settings.
That way we could easily recall the basic settings we used on a test run.
Cheers
__________________
Rui
Reply With Quote
  #69  
05-24-2005, 03:59 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Here it is .... but this is a subtitled one and it's NOT configurable, means I used it for testing and to proof that 2% in the command got real 2% of the framerate for example. So Subtitles will be forced NOT to be used for prediction

So its not an enhancement ... its just a testing/proofing function. For prediction purposes do use the one in the link above!

Code:
function slicerTesting(clip input, int percent, int Goplenght, int Gopmulti, string "ping")
{
frames=framecount(input)

PercCount = (Framecount(input)/100)*percent
period    = int(Framecount(input)/PercCount)*(Goplenght*Gopmulti)
input=(ping == "pong") ? input.trim((period/2),Framecount(input)).subtitle("   !!!Pong active at: "+string(int(period/2))+" Frames (auto calculated Offset)",10,100,font="courier new"):input.subtitle("         Ping active",10,100,font="courier new")
selectrangeevery(input, period, (Goplenght*Gopmulti))
minutes    = float((Framecount(last)/framerate(last))/60)
intminutes = int(minutes)
seconds    = int(60*(float(minutes-intminutes)))
subtitle("     Orig Framecount: "+string(frames),10,20,font="courier new")
subtitle("No of sampled Frames: "+string(Framecount()),10,40,font="courier new")
Subtitle("  % of Movie sampled: "+string((100/float(frames))*float(framecount))+" %",10,60,font="courier new")
subtitle("    Sampled Movietime: "+string(int(minutes))+"m:"+string(seconds)+"s",10,80,font="courier new")


}
Reply With Quote
  #70  
05-25-2005, 03:07 AM
Zyphon Zyphon is offline
Free Member
 
Join Date: Oct 2003
Location: London, England (UK)
Posts: 1,035
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for sharing Inc we appreciate all your hard work with this excellent slicer() tool.
__________________
Regards.

Michael.
Reply With Quote
  #71  
06-09-2005, 05:48 PM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
@Inc: I was thinking about you new function and I would like to know what do you think about:

Suppose you want to predict an encoding task and select 2% prediction sample size. So You do calculations and a script as following.

Quote:
a=Mpeg2source("E:\DVD Authoring Working Folder\Matrix.d2v").slicer(1,15,1,"ping")
b=Mpeg2source("E:\DVD Authoring Working Folder\Matrix.d2v").slicer(1,15,1,"pong")
return a++b


Crop, resize and filters.


function slicer(clip input,int percent,int Goplenght,int Gopmulti,string "ping")
{
PercCount=(Framecount(input)/100)*percent
period=int(Framecount(input)/PercCount)*(Goplenght*Gopmulti)
input=(ping=="pong")?input.trim((period/2),Framecount(input)):input
selectrangeevery(input,period,(Goplenght*Gopmulti) )
}
I think that in only one pass, you will obtain your predicted size.
Ping-pong in only one pass. Please notice that slicer calls (ping and pong) just asks for 1 % (half your prediction sample lenght). I mean that it is really only an 1% ping-pong prediction.

If it is true, with encoders that supports command line, is is quite easy to do a loop until matching sample prediction size.

What do you think?
Reply With Quote
  #72  
06-10-2005, 02:32 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Code:
a=Mpeg2source("E:\DVD Authoring Working Folder\Matrix.d2v").slicer(1,15,1,"ping") 
b=Mpeg2source("E:\DVD Authoring Working Folder\Matrix.d2v").slicer(1,15,1,"pong") 
return a++b
By loading two times the same source your script needs more memory!

Better would be:
Video=Mpeg2source("E:\DVD Authoring Working Folder\Matrix.d2v")
ping = Video.slicer(1,15,1,"ping")
pong= Video.slicer(1,15,1,"pong")
last = ping++pong

If you set return at the end no other following routins will be included.

Also ....

ping = Video.slicer(1,15,1,"ping")
pong= Video.slicer(1,15,1,"pong")
last = ping+pong

is the same as ...

last = Video.slicer(2,15,1,"ping")

as by just 2% theoretically the amount of slices is doubled, means one more slice between the slices of 1% (wich means a pong is included).
IF Im not wrong ...... Please check that

Ping pog is not purposed to do ...

ping
pong
ping
pong
ping
.....

Its more like this

ping
pong
ping
ping
ping
ping
pong
- encode
Reply With Quote
  #73  
06-10-2005, 11:59 AM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
Code:
a=Mpeg2source("E:\DVD Authoring Working Folder\Matrix.d2v").slicer(1,15,1,"ping") 
b=Mpeg2source("E:\DVD Authoring Working Folder\Matrix.d2v").slicer(1,15,1,"pong") 
return a++b
By loading two times the same source your script needs more memory!

Better would be:
Video=Mpeg2source("E:\DVD Authoring Working Folder\Matrix.d2v")
ping = Video.slicer(1,15,1,"ping")
pong= Video.slicer(1,15,1,"pong")
last = ping++pong

If you set return at the end no other following routins will be included.
It is too hard to me to explain this (not even understand it, ) so be patient please.
Thanks for show me difference between return and last.
Did you mean that with return, not resize neither filtering would be applied in my previous script?

Quote:
Also ....

ping = Video.slicer(1,15,1,"ping")
pong= Video.slicer(1,15,1,"pong")
last = ping+pong

is the same as ...

last = Video.slicer(2,15,1,"ping")

as by just 2% theoretically the amount of slices is doubled, means one more slice between the slices of 1% (wich means a pong is included).
IF Im not wrong ...... Please check that
If your function behaviour is:
Ping 1% = 1xxx1xxx1xxx1xxx1xxx1
Pong 1%= x1xxx1xxx1xxx1xxx1xxx1
Ping 2% = 11xx11xx11xx11xx11xx11

I agree that:

ping = Video.slicer(1,15,1,"ping")
pong= Video.slicer(1,15,1,"pong")
last = ping+pong

is the same as ...

last = Video.slicer(2,15,1,"ping")

but if your function behaviour is:
Ping 1% = 1xxx1xxx1xxx1xxx1xxx1
Pong 1%= xx1xxx1xxx1xxx1xxx1xx
Ping 2% = 11xx11xx11xx11xx11xx11

your previous affirmation is not true.
Could you say me how really works your function.

Quote:
Ping pog is not purposed to do ...

ping
pong
ping
pong
ping
.....

Its more like this

ping
pong
ping
ping
ping
ping
pong
- encode
Now the harder part:

When you do a 2% ping pong we have:

2 % ping
2 % pong
2 % ping
2 % ping
2 % ping
2 % ping
2 % pong

You "suppose" that ping-pong differences will be equal than first one, bur really it isn't as you can view in the screenshot:



CQ 69 diff = 1172
CQ 70.5 diff = 1175
CQ 69.9 diff = 1176
CQ 70.2 diff = 1181

Small differences but differences. Is for this reason that you need to evaluate last pong, to see if prediction is enough close of target filesize.
I think if you do prediction as You corrected me before, as ping pong differences are inherent, you don't need last pong pass.
In other words, when you do:

Target size 30000 KB

1: 2 % ping 20000 KB
2: 2 % pong 25000 KB
3: 2 % ping 22000 KB
4: 2 % ping 24000 KB
5: 2 % ping 26000 KB
6: 2 % last ping 27500 KB
7: 2 % last pong 32000 KB

As pp diff is not the same at different CQ values, you target would be (27500+32000)/2=29950 KB at last CQ.
But you can continue doing pings until obtain exact match.

I do:
1: 2 % ping-pong (1% ping + 1% pong)
2: 2 % ping-pong
3: 2 % ping-pong
4: 2 % ping-pong
5: 2 % ping-pong

As pp diff is inherent, my target would be (13865.55+16134,45)=30000 KB
It will need less passes than usual ping-pong to obtain same exact match.
Not final pong is necessary.

All this stuff is just a theory, I had not have time to test it.
Reply With Quote
  #74  
06-10-2005, 12:37 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Ähhhhm ... thats a lot of stuff!

I see you want it to integrate in your Pred-Tool. Nice!
As I also intented to write a HYBRID Predictioner for HC/CCE/TmpEnc/Nuenc ... but Im so much in other PureBasic Avisynth Stuff so Ill explain you how to do it.
(Avalon also integrated Slicer in his AutoQ's but Im shure he even doesnt know how the idea is )

Quote:
Did you mean that with return, not resize neither filtering would be applied in my previous script?
The return command defines WHAT will be send from the Return on to your decoder. Means IF you set other routines or filters after the "Return" Line, these will be ignored as yo define with Return WHAT will be returned exactly

Quote:
If your function behaviour is:
Ping 1% = 1xxx1xxx1xxx1xxx1xxx1
Pong 1%= x1xxx1xxx1xxx1xxx1xxx1
Ping 2% = 11xx11xx11xx11xx11xx11
Nope, .... well it shouldn't.

Ping 1% = 1xxx1xxx1xxx1xxx1xxx1
Pong 1%= xx1xxx1xxx1xxx1xxx1xx

...ok ...

Ping 2% = 11xx11xx11xx11xx11xx11

... but here u show the doubling of the Gop lenght including! the increase of %frames in total

"11" means for example (2*15frames), means a Gop multi of 2!
When increasing the "%" Value that wont enlarge the slices(means the count of the FOLLOWING frames) but enlarges the count of the slices theirselves.

Example (5% of the movie):
Ping = 1xxxxxxxxxxxxx1xxxxxxxxxxxxx1xxxxxxxxxxxxx .....
Pong= xxxxxxx1xxxxxxxxxxxxx1xxxxxxxxxxxxx1xxxxxx .....

doubling the 5% to 10%:

Ping = 1xxxxxx1xxxxxx1xxxxxx1xxxxxx1xxxxxx1xxxxxx .....
Pong= xxx1xxxxxx1xxxxxx1xxxxxx1xxxxxx1xxxxxx1xxx .....

multiplying the GOP by 2 by keeping 10%:

Ping = 11xxxxxxxxxxxx11xxxxxxxxxxxx11xxxxxxxxxxxx .....
Pong= xxxxxxx11xxxxxxxxxxxx11xxxxxxxxxxxx11xxxxx .....

multiplying the GOP by 2 by keeping 5%:

Example (5% of the movie):
Ping = 11xxxxxxxxxxxxxxxxxxxxxxxxxx11xxxxxxxxxxxx .....
Pong= xxxxxxxxxxxxx11xxxxxxxxxxxxxxxxxxxxxxxxxxx .....


So thats the math, as IF you increase the GOP multi, you have to decrease the number of slices to match the same % in total

So .... 2% and GopMulti=1 means more slices! but short! sampled
..... 2% and GopMulti=2 means less slices! but long! sampled




Acording to the rest of your post ....

Well If you first do a pin and then a pong you get:
a) The size of the sample which whould be the result IF you would use the actual CQ (yep thats what we already know )

b) the DIFFERENCE of the ping (slices) to the pong (slices). THAT Difference you have to keep in your mind as it affects the whole logic.

So we do

Ping = 100kb
Pong = 110kb

110-100 = 10 .... 100/10 = The difference = 10% in size as "less" to the pong. Means do add 5% to every following ping to get the wanted "how would it be if I would do a pong now" average!

Ping = xxxkb (+5% of size)
ping = xxxkb (+5% " )
Ping = xxxkb (+5% " )
Ping = xxxkb (+5% " ) ------ that would match!
Finally we would do a final "safe" pong and again we would do the same calculation way as in our first ping/pong WITHOUT adding the 5% to the LAST ping. The Result should match the last Ping+5%.

Be aware that the Calcs above are out of mind as Im in the office, but you will understand WHY you have to do maximal 2 pongs in the whole prediction. The Pongs just serve you the difference, which wouldnt be available in a prediction of the same % Amount in single passes. THATs the "Idea" of Slicer.
Reply With Quote
  #75  
06-10-2005, 01:16 PM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
@Inc:
Just now I understand what do you mean with "keep the difference in mind".

For me difference was ping KB - pong KB.
But you are talking about a "proportional difference" (I don't know how to call it in english).
difference = a - b
proportional difference = (a - b) / a

It is only an explanation for other confused people as me.
Reply With Quote
  #76  
06-10-2005, 03:31 PM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
Better would be:
Video=Mpeg2source("E:\DVD Authoring Working Folder\Matrix.d2v")
ping = Video.slicer(1,15,1,"ping")
pong= Video.slicer(1,15,1,"pong")
last = ping++pong
This gives me an Evaluate: division by zero error referenced to ping=, pong= and your function period= lines.

Edited1: Forget it, was my mistake.

Edited1: When I encode separated ping and pong, it gives me same framecount that the previous script. Why?
I changed function percent, but still same framecount???
Reply With Quote
  #77  
06-10-2005, 05:33 PM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
@Pro,
Only changing the GOP multiplier value will give you different sample sizes.
That's how this function is supposed to work.
You ask for 1% of a movie with 155000 frames
then you always get 1550 frames in a ping or pong.
Quote:
difference = a - b
proportional difference = (a - b) / a
It's a typo, right?
It should look like:
proportional difference = (a - b) / b
Cheers
__________________
Rui
Reply With Quote
  #78  
06-10-2005, 06:10 PM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by rds_correia
@Pro,
Only changing the GOP multiplier value will give you different sample sizes.
That's how this function is supposed to work.
You ask for 1% of a movie with 155000 frames
then you always get 15500 frames in a ping or pong.
Quote:
difference = a - b
proportional difference = (a - b) / a
It's a typo, right?
It should look like:
proportional difference = (a - b) / b
Cheers
I know that, but I don't know why when I did the test, it gives me 3 times same famecount. I am doing it again now.

Not a typo. Read a few post before Inc said

ping 100
pong 110
difference (proportional difference) = 10%

It is actually -10%

(a -b) / a = -10%
(100 - 110) / 100 = -10%
Reply With Quote
  #79  
06-10-2005, 06:25 PM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Prodater64
Not a typo. Read a few post before Inc said

ping 100
pong 110
difference (proportional difference) = 10%

It is actually -10%

(a -b) / a = -10%
(100 - 110) / 100 = -10%
Ok what I've always done is for instance:
ping=27619KB
pong=28066KB
(28066-27619)/28066
So actually I've been doing (b-a)/b
But that's just because usually "b" has a higher KB value than "a".
Don't really know why.
But I guess it's because "a" usually has a few frames from the begining of the movie.
Thus these initial frames are really dark scenes that will always be visible on "a" but not on "b".
Eventually I've had a couple of a>b but usually I have b>a.
Cheers
__________________
Rui
Reply With Quote
  #80  
06-10-2005, 07:52 PM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
@rds

If you are doing:

ping=27619KB
pong=28066KB

28066-27619=447
447/28066=0.0159

be carefull:

If you apply that proportional diff to pongs:

28066 * (0.159/2) = 223.5
28066 - 223.5 = 27842.5
27619 + 223.5 = 27842.5

you will obtain your target = 27842.5

But if you apply that proportional diff to pings (that is that you are doing, ping pong ping ping ping ping ping ping safe pong):
27619 * (0.159/2) = 219.94
27619 + 219.94 = 27838.94 that is a sub-value respect to your target.
(Theoretically your actual final size will be oversized, but difference is so little that maybe you can't appreciate it)

Do you understand?
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Prediction Ping-pong ??? neptune Conversion et d'Encodage de Vidéo (Français) 3 11-09-2004 04:18 AM
Very good result with ping-pong prediction fabrice Avisynth Scripting 4 11-05-2004 11:53 AM
Bitrates: How long (about) should the prediction take? m0rdant Video Encoding and Conversion 6 08-14-2004 10:17 AM
About ping-pong prediction. zagor Avisynth Scripting 8 05-08-2004 03:06 PM
Predicción Ping-Pong Prodater64 Convertir y Codificar Video (Español) 13 04-02-2004 08:54 PM

Thread Tools



 
All times are GMT -5. The time now is 06:11 AM  —  vBulletin © Jelsoft Enterprises Ltd