Hello guest, if you like this forum, why don't you register? https://forum.fanres.com/member.php?action=register (December 14, 2021) x


How to remove every 25th dupe frame from h264 video

8 Replies, 3704 Views

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.
Using AviSynth:
Code:
tdecimate(cycle=25)
Also Avisynth:

Code:
SelectRangeEvery(25,24,0,true)
assumefps("film")
(This post was last modified: 2019-03-30, 10:55 AM by althor1138.)
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.
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.
(This post was last modified: 2019-03-30, 03:26 PM by Plissken1138.)
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).
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!
Great, glad it worked for ya!
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...

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Help] Easy way to perfectly remove silence from Laserdisc PCM rip? plisskin 2 4,823 2022-08-20, 06:31 PM
Last Post: plisskin
  AV1 (AOMedia Video 1) [main thread] spoRv 24 3,854 2022-01-08, 10:08 PM
Last Post: spoRv
  [Help] Sync audio to video (different fps and rips) JackForrester 14 1,759 2021-09-05, 01:57 AM
Last Post: JackForrester
  How to convert 50p (25p) to 23.976 with Dupe Frames? PDB 6 878 2021-08-13, 02:39 PM
Last Post: PDB
  [Help] Frame-accurate subtitles theprion 3 738 2021-05-15, 11:11 PM
Last Post: Beber
  Interlaced video in HQ codec pipefan413 10 3,219 2020-05-19, 02:13 AM
Last Post: pipefan413
  [Help] Correct Bad Frame Rate Conversion CSchmidlapp 29 16,208 2019-05-24, 10:17 PM
Last Post: zoidberg
  [Help] 25fps PAL video mastered at 24fps with dupe frames SpaceBlackKnight 3 2,369 2019-03-26, 03:59 AM
Last Post: SpaceBlackKnight
  please help me i can't remove that kamihikouki 23 17,380 2017-05-12, 07:26 AM
Last Post: kamihikouki
  Bitrate and video encoding spoRv 0 2,102 2017-05-01, 11:19 AM
Last Post: spoRv



Users browsing this thread: 1 Guest(s)