Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to remove every 25th dupe frame from h264 video
#1
Here's the situation - I have a h264 mkv of some remastered docu that was shot on film, and it shows as 25 fps in media info but every 25th frame is a dupe (I checked it frame by frame) which makes that annoying stutter, especially visible in panning shots. I'd like to try using ffmpeg to drop every 25th dupe frame and make it a 24 fps video that plays smooth and doesn't lose sync with audio, but I'm a noob at ffmpeg and got kinda lost looking thru documentation... If some kind soul with knowledge would spell it for me I'd be one happy noob.
Reply
Thanks given by:
#2
Using AviSynth:
Code:
tdecimate(cycle=25)
Reply
Thanks given by: Plissken1138
#3
Also Avisynth:

Code:
SelectRangeEvery(25,24,0,true)
assumefps("film")
Reply
Thanks given by: Plissken1138
#4
If a 24fps video has been converted to 25fps by duplicating every twenty-fourth frame, then althor's solution will work.  If a 23.976fps video has been converted to 25fps through duplication, there will be an additional duplicate every thousand frames, in which case using Telecide() or an equivalent function might be better.  It's worth checking to see if there are additional duplicates.
Reply
Thanks given by: Plissken1138
#5
Uh, oh, avisynth...

Does it work with ffmpeg (if at all possible)?

Tried opening .avs in VirtualDub,

directshowsource("input.mp4")
tdecimate(cycle=25)

it said it didn't recognize tdecimate, then tried

directshowsource("input.mp4")
SelectRangeEvery(25,24,0,true)
assumefps("film")

it opened the file but didn't do anything from what I could see - rendered sample still had every 25th dupe.
Reply
Thanks given by:
#6
For SelectRangeEvery you may may need to specify the correct offset, otherwise it will be removing the wrong frames.

For tdecimate, you need to install the plugin first possibly?

Personally I prefer SelectRangeEvery when possible to use, as it's more controlled, where I think TDecimate could run into problems if the footage has intended duplicate frames in some places (like slow motion).
Reply
Thanks given by: Plissken1138
#7
I'm worse in finding my way around avisynth then around ffmpeg so this is all going a bit over my head but I guess it's cracked.

Since first dozen hundred frames or so are just some film restoration info (white text on black background)
I determined this pattern of dupe frames from earliest visible and moving shot:

1350,1351
1375,1376
1400,1401
1425,1426
1450,1451
1475,1476
...
1975,1976
2000,2001
...
2975,2976
3000,3001

so, deducing backward, it starts with dupe frames

0000,0001
0025,0026

and I also guessed that 23.976 scenario Chewtobacca mentioned isn't the case here...

Now, I made input.avs like this

directshowsource("input.mp4")
SelectRangeEvery(25,24,1,true) <--- as I understood, this means "from every 25 frames take 24, starting with 1"
assumefps("film")

and, by going thru VDub timeline, looks like that's the winning combo!

Thanks to everyone!
Reply
Thanks given by:
#8
Great, glad it worked for ya!
Reply
Thanks given by:
#9
Another potential complication is that as this is a documentary, it might draw on different sources and handle them differently.  If that is the case, it's worth double-checking such sections to see if the same solution works with all the material.  But it does sound as if you are lucky and this is a straightforward case of 24-to-25fps conversion through duplication.  I wish problematic videos were always so easily handled...
Reply
Thanks given by: TomArrow


Possibly Related Threads…
Thread Author Replies Views Last Post
  Interlaced video in HQ codec pipefan413 10 1,109 2020-05-19, 02:13 AM
Last Post: pipefan413
  Best UT video codec? alleycat 4 948 2019-10-09, 11:49 AM
Last Post: alleycat
  [Help] Correct Bad Frame Rate Conversion CSchmidlapp 29 10,767 2019-05-24, 10:17 PM
Last Post: zoidberg
  [Help] 25fps PAL video mastered at 24fps with dupe frames SpaceBlackKnight 3 1,300 2019-03-26, 03:59 AM
Last Post: SpaceBlackKnight
  please help me i can't remove that kamihikouki 23 13,533 2017-05-12, 07:26 AM
Last Post: kamihikouki
  Bitrate and video encoding spoRv 0 1,517 2017-05-01, 11:19 AM
Last Post: spoRv
  Exported video has 'glitches' crissrudd4554 38 19,691 2017-04-02, 02:08 PM
Last Post: crissrudd4554
  Converting .h264 and .dts for editing FrankT 15 7,373 2016-10-02, 09:22 PM
Last Post: FrankT
  Remove Duplicate Frames PDB 10 7,812 2015-07-01, 02:39 AM
Last Post: Valeyard
  Which lossless video codec to use? spoRv 29 27,140 2015-06-09, 12:27 AM
Last Post: spoRv

Forum Jump:


Users browsing this thread: 1 Guest(s)