Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st June 2023, 01:39   #1  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
24 to 23.976 fps by deleting frames

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?
Reel.Deel is offline   Reply With Quote
Old 1st June 2023, 02:13   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
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.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 1st June 2023 at 02:15.
StainlessS is offline   Reply With Quote
Old 1st June 2023, 02:27   #3  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Thanks StainlessS. After some trial and error I was able to figure it out.

Code:
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.
Reel.Deel is offline   Reply With Quote
Old 1st June 2023, 02:49   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Cooool dude.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 1st June 2023, 02:51   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
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)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 1st June 2023, 04:07   #6  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
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.
Quote:
#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.
johnmeyer is offline   Reply With Quote
Old 1st June 2023, 04:20   #7  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Quote:
Originally Posted by johnmeyer View Post
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.
Reel.Deel is offline   Reply With Quote
Old 1st June 2023, 11:44   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by stainlesss View Post
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
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 1st June 2023, 15:32   #9  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
Quote:
Originally Posted by StainlessS View Post
bump bump bump
I hate people who bump their posts.
johnmeyer is offline   Reply With Quote
Old 1st June 2023, 15:59   #10  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
Quote:
Originally Posted by johnmeyer View Post
I hate people who bump their posts.
It's only a stainroid, don't attention to it
kedautinh12 is offline   Reply With Quote
Old 1st June 2023, 21:37   #11  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Quote:
Originally Posted by StainlessS View Post
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.
Reel.Deel is offline   Reply With Quote
Old 1st June 2023, 21:43   #12  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I just meant, does your problem clip exhibit regular perceptible gaps in the audio. [I got one that does]

Quote:
Originally Posted by johnmeyer View Post
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)].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 1st June 2023 at 21:46.
StainlessS is offline   Reply With Quote
Old 1st June 2023, 21:54   #13  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Quote:
Originally Posted by StainlessS View Post
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 . Luckily it is always the same frame repeating pattern (every 1000th frame, starting at 500).
Reel.Deel is offline   Reply With Quote
Old 2nd June 2023, 01:00   #14  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Tanx RD.
[EDIT: I hate people, that hate people that bump posts. (So there!)]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 2nd June 2023 at 01:02.
StainlessS is offline   Reply With Quote
Old 2nd June 2023, 10:31   #15  |  Link
Frank62
Registered User
 
Join Date: Mar 2017
Location: Germany
Posts: 234
Quote:
Originally Posted by Reel.Deel View Post
Code:
a = DGSource("amazon24fps.dgi")
b = a.Trim(0,500)
c = a.SelectRangeEvery(every=1001, length=1000, offset=502)
a = b ++ c
Good to know!
Frank62 is offline   Reply With Quote
Old 2nd June 2023, 20:03   #16  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
Quote:
Originally Posted by StainlessS View Post
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.
johnmeyer is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 14:56.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.