View Full Version : Reducing fps in ratio of 11/15
kolak
5th August 2015, 12:49
Hi,
I need a math formula to reduce fps in ratio of 11/15.
22fps signal was recorded as 30p, so there are repeated frames.
Need to find formula to remove repeated frames.
I had similar case but source was 20fps and this was easy:
if n % 3 == 2 than remove (reducing frames by 1.5x)
22p looks more complicated.
Is this going to work (by logic):
if n % 15 == 11 ?
n=frame number
Please help :)
sneaker_ger
5th August 2015, 13:13
If the pattern is perfect you can try SelectEvery(). If not I'd try TDecimate.
colours
5th August 2015, 15:11
To get it down from 30 fps to 22 fps, you'd have to remove four frames every fifteen. If you use "if n % 15 == 11 then remove", you'd only be removing one frame out of every 15. An alternative would be "if n % 15 >= 11 then remove", which does remove four frames out of fifteen, but then the four decimated frames would be consecutive, which is probably not what you want.
If you assume that the duplicate frames are as evenly distributed as possible, then you could use something like "if (n % 15) % 4 == 0 then remove". Of course, this'll decimate the wrong frames if you don't add an appropriate offset to n first, and it's not something you could directly use in AviSynth anyway, unless you rewrite it as a SelectEvery() (as sneaker_ger has already suggested).
kolak
5th August 2015, 16:37
I just need a formula for bash script.
Looks like things have changed and now it's 22 out of 60.
I need to remove frames:
5 9 13 16 20 24 28 31 35 39 43 46 60 54 58 out of 60 frames.
There is one condition which is;
n % 15 == 1, but then looks like there are at least 2 others. I can use "OR", so this helps
So pattern is there, but not easy one.
Bloax
5th August 2015, 22:53
Looks like things have changed and now it's 22 out of 60.
I need to remove frames:
5 9 13 16 20 24 28 31 35 39 43 46 60 54 58 out of 60 frames.
Well clearly you could just do the hackiest solution possible out of that tidbit and in case the first frame is 1;
n = framenum % 60
if (n == 0 or n == 5 or n == 9 or n == 13 or n == 16 or n == 20 or n == 24 or n == 28 or n == 31 or n == 35 or n == 39 or n == 43 or n == 46 or n == 54 or n == 58) then remove
Of course it's possible to cook up a less hacky looking solution for this pattern of numbers, but why bother?
StainlessS
6th August 2015, 01:15
Have you considered Multidecimate or this ? :- http://forum.doom9.org/showthread.php?p=1715423&highlight=mdec2#post1715423
kolak
6th August 2015, 22:25
Well clearly you could just do the hackiest solution possible out of that tidbit and in case the first frame is 1;
n = framenum % 60
if (n == 0 or n == 5 or n == 9 or n == 13 or n == 16 or n == 20 or n == 24 or n == 28 or n == 31 or n == 35 or n == 39 or n == 43 or n == 46 or n == 54 or n == 58) then remove
Of course it's possible to cook up a less hacky looking solution for this pattern of numbers, but why bother?
I have done something similar. Removed frames up to 16th as a 1st step and than got a more clear pattern which repeats every 16 frames, so I added 2nd counter which gets reset every 16 frames and removes 4th, 8th, 12th and 15th frame. It works.
Looks like you way won't work as for example it won't remove eg. frame 61.
kolak
8th August 2015, 22:22
Another issue- beginning of the pattern is different for different recordings, so it's a nightmare.
Ended up using ffmpeg to detect repeated frames in first 30 frames, than find beginning where pattern is constant and use math formula to deleted them.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.