View Full Version : 24 to 23.976 fps by deleting frames
Reel.Deel
1st June 2023, 01:39
Hello,
For some reason Amazon encodes some of their videos in 24fps instead of 23.976. But they don't speed up the sound, instead they duplicate frames. The duplicate pattern goes like this: 501, 1502, 2503, 3504, 4505, 5506, etc. I would like to remove those duplicates. I tried SelectRangeEvery(every=1000, length=999, offset=501) but it's not giving me the desired result. Any ideas?
StainlessS
1st June 2023, 02:13
Not exactly what you want, but might perhaps give some ideas.
24p->25p woes - "Euro Pulldown"? [circa 2009]:- https://forum.doom9.org/showthread.php?t=151372
Took some time for me to find, and even if it aint any good to you, I'de like to be able to find it again.
EDIT: Found it using Google Search (google working pretty good now for d9 search), failed to find using D9 native search.
Reel.Deel
1st June 2023, 02:27
Thanks StainlessS. After some trial and error I was able to figure it out.
a = DGSource("amazon24fps.dgi")
b = a.Trim(0,500)
c = a.SelectRangeEvery(every=1001, length=1000, offset=502)
a = b ++ c
I didn't know SelectRangeEvery discarded the frames before the offset.
StainlessS
1st June 2023, 02:49
Cooool dude.
StainlessS
1st June 2023, 02:51
RD, is an effect of your prob that sound stutters every now and then [If so then I have at least one of those].
(slight gap in sound)
johnmeyer
1st June 2023, 04:07
I would think that SelectEvery would get fooled by any interruption in the cadence. You'd be better off with a tool that looked for true duplicates. Here is some code that will give you all the frames which are perfect duplicates. You can then use one of the decimation plugins which accept frame numbers and then delete the actual, true duplicates.
#This script finds exact duplicate frames and outputs the frame numbers
global blankthreshold=0.1
filename = "e:\output_duplicate_frames.txt"
AVISource("e:\fs.avi").killaudio()
i=AssumeBFF.ConvertToYV12
#This line below will output EVERY frame that is below threshold, which results in LOTS of frames
WriteFileIf(last, filename, "(YDifferenceFromPrevious(i)<=blankthreshold)", "current_frame+1", append = false)
#The line below writes the FIRST frame that falls below the threshold
#WriteFileIf(last, filename, "(YDifferenceFromPrevious(i)>blankthreshold)&&YDifferenceToNext(i)<=blankthreshold", "current_frame", append = false)
#Use this instead of WriteFile in order to determine blankthreshold
ScriptClip("Subtitle(String(YDifferenceFromPrevious(i)))")
You could also TDecimate with a really large (>1000) Cycle/CycleR, although it will be pretty slow.
Reel.Deel
1st June 2023, 04:20
I would think that SelectEvery would get fooled by any interruption in the cadence.
That's the thing, there is no interruption in the cadence. I've checked like 6 movies and pattern is always consistent. Amazon for some reason encodes movies at 24fps, while the very same movie on HBO Max is 23.976. Yeah I know I can use a duplicate frame detector but wanted to do it manually since dup filters can sometimes have false positives.
StainlessS
1st June 2023, 11:44
rd, is an effect of your prob that sound stutters every now and then [if so then i have at least one of those].
(slight gap in sound)
bump bump bump
johnmeyer
1st June 2023, 15:32
bump bump bumpI hate people who bump their posts. :)
kedautinh12
1st June 2023, 15:59
I hate people who bump their posts. :)
It's only a stainroid, don't attention to it :D
Reel.Deel
1st June 2023, 21:37
RD, is an effect of your prob that sound stutters every now and then [If so then I have at least one of those].
(slight gap in sound)
Not sure what you mean here. I'm not doing any processing to the audio. I add back the original audio to the newly 23.976 encoded video and it all works out.
StainlessS
1st June 2023, 21:43
I just meant, does your problem clip exhibit regular perceptible gaps in the audio. [I got one that does]
I hate people who bump their posts. :)
Nobody cares what you do or do not hate.
[You is always hatin' on something. :) RD did not reply, and I guessed he missed my post, forum would not permit single bump, too short a post)].
Reel.Deel
1st June 2023, 21:54
I just meant, does your problem clip exhibit regular perceptible gaps in the audio. [I got one that does]
No, no gaps in the audio. Amazon basically takes the video and converts it to 24fps and leaves the audio intact. Some 29.970 videos also get the same treatment, they convert it to 30fps :confused:. Luckily it is always the same frame repeating pattern (every 1000th frame, starting at 500).
StainlessS
2nd June 2023, 01:00
Tanx RD.
[EDIT: I hate people, that hate people that bump posts. (So there!)]
Frank62
2nd June 2023, 10:31
a = DGSource("amazon24fps.dgi")
b = a.Trim(0,500)
c = a.SelectRangeEvery(every=1001, length=1000, offset=502)
a = b ++ c
Good to know!
johnmeyer
2nd June 2023, 20:03
Tanx RD.
[EDIT: I hate people, that hate people that bump posts. (So there!)]If you think I'm going to follow you by saying that I hate people who hate people that hate people ... well, I'm not going to do it, because I hate that sort of thing.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.