Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: Roger Allott on May 16, 2016, 10:10:25 PM

Title: How to remove duplicate frames from video that's NOT interlaced?
Post by: Roger Allott on May 16, 2016, 10:10:25 PM
I have a piece of video that's exactly 30 fps but every fifth frame is a (visually exact) duplicate of its predecessor, suggesting that its true framerate was 24 (or perhaps 23.976) fps. It is not interlaced.

Viewing it in a typical media player looks too jerky for my liking, so I'd like to delete the duplicated frames and end up with my video running at the 'true' speed of 24 fps.

I've used Avidemux for many years and I think it's wonderful for something that's completely free open-source, but getting it to delete duplicate frames has caused me to pull my hair out many times over!

I've tried using Avidemux's deinterlacing filters (Decomb Telecide & Decomb Decimate) even though the source file isn't interlaced. However, my struggles have come from the tutorials out there being a bit light on detail when it comes to selecting the options.

Telecide options:
Strategy - No strategy, 3-2 pulldown, PAL/SECAM, NTSC converted from PAL
Field order - Top, Bottom (this seems completely superfluous as my source isn't interlaced, but I have to select one of these)
Postprocessing - None, None but compute, Postproc on best match, Postproc and show zones, Process image (not fields), Process image (not fields) debug
Try backwards - Never, If still combed, Always
- values for various threshold settings, etc.

Decimate options:
Cycle - integer value - I presume I want 5 in this?
Mode - Discard closer, Replace (interpolate), Discard longer dupe, Pulldown dupe removal
- values for two threshold settings

Based on the above information, could someone guide me on which options I need to select to get what I'm trying to get?
Title: Re: How to remove duplicate frames from video that's NOT interlaced?
Post by: mean on May 17, 2016, 05:26:09 AM
true using the "remove ivtc dupe" filter in the nightly
Title: Re: How to remove duplicate frames from video that's NOT interlaced?
Post by: Roger Allott on May 17, 2016, 07:33:25 AM
Quote from: mean on May 17, 2016, 05:26:09 AM
true using the "remove ivtc dupe" filter in the nightly
Thanks. I used the default settings, which gives interesting results, but not what I was wanting.

It removes duplicate frames, but it doubles the amount of time given to the first of them, which results in playback quality that's identical to my source! Instead of constant 30 fps, it gives me variable framerate output of 30 fps and 15 fps.

The closest I've come to getting my desired output came from using only the Decomb Decimate filter (i.e. without Telecide), although for some reason it failed after processing just 8 seconds of footage.
Title: Re: How to remove duplicate frames from video that's NOT interlaced?
Post by: mean on May 17, 2016, 09:20:52 AM
Normally no
It creates 24 fps if the source is 30 fps
Could you upload a short sample of your video somewhere ? (mega, rapidshare,...)
10 seconds is enough
Title: Re: How to remove duplicate frames from video that's NOT interlaced?
Post by: Roger Allott on May 17, 2016, 11:13:46 AM
Quote from: mean on May 17, 2016, 09:20:52 AM
Could you upload a short sample of your video somewhere ? (mega, rapidshare,...)
10 seconds is enough

http://depositfiles.com/files/dwwc92r86 (33 MB)

That's a zip file containing:

As you can see, both 2 & 3 failed shortly after the source file's first keyframe encountered.
Title: Re: How to remove duplicate frames from video that's NOT interlaced?
Post by: mean on May 17, 2016, 05:39:07 PM
Thanks for the sample
It seems the win64 binaries were lagging behing
I've regenerated the nightly, it should work now. Could you confirm ?
I processed the file on linux, and the result looks ok (on linux)
Title: Re: How to remove duplicate frames from video that's NOT interlaced?
Post by: Roger Allott on May 18, 2016, 07:05:30 AM
I installed the latest nightly (160517) but unfortunately I'm still getting the same problem, both with frame durations and with it failing shortly after it encounters the first keyframe. I cannot tell whether these two issues are related or completely distinct. I also cannot tell whether the fail is due to the software/codec/filter or a corruption in my source file.

http://depositfiles.com/files/vbekcvy7g (< 5 MB)
Title: Re: How to remove duplicate frames from video that's NOT interlaced?
Post by: mean on May 18, 2016, 01:54:43 PM
The problem is actually in the muxer
IF you use mkv or MP4V2, it should work fine (it seems ok here, also checked on win64)
Title: Re: How to remove duplicate frames from video that's NOT interlaced?
Post by: Roger Allott on May 18, 2016, 06:17:53 PM
Ah!!! Yes, I can confirm that MP4v2 seems to have done the trick fine, from what I can tell at the moment. Thank you for your help.

A bit of an oddity though is that MediaInfo reports that the output file is still at a constant 30 fps, although if I reimport it into Avidemux and select the Change FPS filter, it's telling me that the current framerate is 26.69. I then run this filter trying to enforce 25 fps, but the output doesn't give me frames that are nice and neatly of consistent 0.040 seconds duration.

The frame times are:
0.302 (I've never understood why the first frame isn't 0.000!)
0.346
0.391
0.435
0.480
0.524
0.569
0.613
.... etc.

see http://depositfiles.com/files/yefxznixc

I can recall a comment from you quite a long time ago that we shouldn't use MP4v2 because it's just there for testing purposes. I presume that's no longer valid, so could you explain what the differences are between it and the main MP4 muxer?
Title: Re: How to remove duplicate frames from video that's NOT interlaced?
Post by: mean on May 18, 2016, 08:00:30 PM
you should try using resample fps to 23.976  or 24 fps
it should be smooth

Title: Re: How to remove duplicate frames from video that's NOT interlaced?
Post by: Roger Allott on May 19, 2016, 06:04:58 AM
Thanks. I've noticed that you've changed the default for 'Frame Rate Change' in the Remove IVTC Dupe filter from Full to Fast. Could you tell me what each of the options mean?
Title: Re: How to remove duplicate frames from video that's NOT interlaced?
Post by: mean on May 19, 2016, 07:34:10 AM
Basically it makes a diff between 2 frames to find which one are closest
In full mode, every line is processed
In fast mode, every 3rd line is processed
In very fast mode, every 9th line is processed

So, fast should be 3 times faster, and "good enough"
Very fast would be even faster, but the accuracy goes down
Title: Re: How to remove duplicate frames from video that's NOT interlaced?
Post by: Roger Allott on May 25, 2016, 11:05:43 AM
A quick question relevant to this issue that's probably not worth starting a new thread.

In the IVTC filter, what does the number selected for 'Noise' mean?
Title: Re: How to remove duplicate frames from video that's NOT interlaced?
Post by: mean on May 25, 2016, 11:35:46 AM
If you have 2 identical frames, they could be slightly different due to noise
Difference lower than noise (per pixel) are ignored