Log in

View Full Version : ImageSource() FPS value - not working?


MrVideo
24th August 2018, 05:11
First I tried using this script:
ImageSource("E:\image.bmp", end=119, fps=23.976 , use_DevIL=false)
This was reported back:
avs [info]: 1920x1080p 1:1 @ 12570329/524288 fps (cfr)
Not exactly what I was expecting.
OK, then I tried this:
ImageSource("E:\image.bmp", end=119, fps=24000/1001 , use_DevIL=false)
That was even worse:
avs [info]: 1920x1080p 1:1 @ 23/1 fps (cfr)
So, what is one supposed to use to get 23.976fps working?

As a side note, the encoding of the BMP image looks great. :D

poisondeathray
24th August 2018, 06:52
You can add AssumeFPS(24000,1001)

But you probably have other problems with your avisynth install

Where is avs [info] coming from ? what program ?

What avs version are you using ?

Groucho2004
24th August 2018, 08:13
The "fps" parameter in ImageSource() is of the type float. So, you have to use float values (24000.0 / 1001.0). The resulting fps will be virtually the same as using "AssumeFPS(24000, 1001)" as pdr suggested. The numerator and denominator values may be confusing but they basically evaluate to the same result.

However, if you want the num/den values to be the same as you entered you have to use AssumeFPS.

wonkey_monkey
24th August 2018, 10:35
First I tried using this script:
Code:

ImageSource("E:\image.bmp", end=119, fps=23.976 , use_DevIL=false)

This was reported back:
Code:

avs [info]: 1920x1080p 1:1 @ 12570329/524288 fps (cfr)

Not exactly what I was expecting.

That's because 24000/1001 is not 23.976. 12570329/524288 is (presumably) the simplest fraction which does equal 23.976.

24000/1001 is actually 23.976 023976 023976 023976...

To clarify what Groucho said, asking for "24000/1001" - without forcing those numbers to be floats, by adding .0 - does an integer division, and rounds down to 23 exactly.

MrVideo
24th August 2018, 10:42
You can add AssumeFPS(24000,1001)

But you probably have other problems with your avisynth install
I seriously doubt it. Otherwise I would have tons of other issues over the years.
Where is avs [info] coming from ? what program ?
AVIsynth, as called by x264.
What avs version are you using ?
AviSynth_260_150419.exe
Installed on Win7-64.

MrVideo
24th August 2018, 10:56
That's because 24000/1001 is not 23.976. 12570329/524288 is (presumably) the simplest fraction which does equal 23.976.

24000/1001 is actually 23.976 023976 023976 023976...
Ah yes. the infinite 023976 fraction. I should have realized that it would be fussy.
To clarify what Groucho said, asking for "24000/1001" - without forcing those numbers to be floats, by adding .0 - does an integer division, and rounds down to 23 exactly.
Sigh! :mad:

I guess I'll have to remember to always use the "24000/1001", or "24000.0/1001.0" for the math (depending on which plugin I use).

Thanks for clearing up this foggy old mind. Learn something new every day. Now to go fix my script.

MrVideo
24th August 2018, 11:19
The "fps" parameter in ImageSource() is of the type float. So, you have to use float values (24000.0 / 1001.0).
Is the plugin broken because using "24000.0/1001.0" in ImageSource() results in "6285171/262144" being passed on to the x264 encoder, instead of 24000/1001. Or, is it a limitation of the 32bit math? That said, MediaInfo reports that the frame rate is "23.976 (24000/1001)", in the MKV wrapped output.

On the other hand, AssumeFPS(24000, 1001) does pass 24000/1001 on to x264.

Therefore, is it best to use AssumeFPS() and not use "fps=" in ImageSource()?

Oh, and a curse on the NTSC committee for deciding that we needed to have a 30000/1001 frame rate. They could have done a true 30fps rate. It has come back to bite us in the ass. :mad:

Groucho2004
24th August 2018, 12:56
Is the plugin broken because using "24000.0/1001.0" in ImageSource() results in "6285171/262144" being passed on to the x264 encoder, instead of 24000/1001. Or, is it a limitation of the 32bit math?Neither. It's simply how Avisynth internally calculates the numerator and denominator for a given float value. Nothing is broken. :)

Therefore, is it best to use AssumeFPS() and not use "fps=" in ImageSource()?Whatever floats (no pun intended) your boat. Even using "23.976" is accurate enough for most purposes. However, if you insist on having x264 showing these num/den values then use AssumeFPS and omit the fps parameter in ImageSource.

wonkey_monkey
24th August 2018, 17:32
Neither. It's simply how Avisynth internally calculates the numerator and denominator for a given float value. Nothing is broken. :)

It's not very accurate then: 23.976024627685546875

Shouldn't a float be accurate to more than 7 digits?

Groucho2004
24th August 2018, 17:56
It's not very accurate then: 23.976024627685546875

Shouldn't a float be accurate to more than 7 digits?
I had a look at the code and it is actually ImageReader()/ImageSource() that calculates the num/den values.

This is the code in ImageSeq.cpp:
double num = _fps; // calculate fps as num/denom for vi
unsigned denom = 1;
while (num < 16777216 && denom < 16777216) { num*=2; denom*=2; } // float mantissa is only 24 bits
vi.SetFPS(unsigned(num+0.5), denom); // And normalize

MrVideo
24th August 2018, 18:17
Looks like I'll be avoiding ImageSource(fps=) and be using AssumeFPS(num,den) instead. :D