Try StreamFab All-in-One and rip streaming video! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!

# Restore 30fps out of 25 with deleted frames

1. I have a video, with a consistent pattern of one missing frame every five frames. Is it possible to simply interpolate every 5 frames? And if so, what would that script look like?

Thanks.
2. 1 out of every 5 usually means 23.976 to 29.97 (29.97 video that had every 5th frame dropped)

It would look like this post just change the numbers to match your video .
3. You could use FrameRateConverter() followed by SelectEvery(). Say you have the sequence 1,2,4,5 -- frame 3 is missing:

FrameRateConverter(FrameDouble=true) will give you:

1, 1.5, 2, 3, 4, 4.5, 5, 5.5

then SelectEvery(8, 0, 2,3,4,6) will give you the sequence:

1, 2, 3, 4, 5

where 3 is motion interpolated between 2 and 4.

The problem is that this will not adapt to changes in the pattern.
4. Originally Posted by poisondeathray
1 out of every 5 usually means 23.976 to 29.97 (29.97 video that had every 5th frame dropped)

It would look like this post just change the numbers to match your video .
What would you expect the pattern to usually be for a 30fps video decimated down to 25?
5. Originally Posted by embis2003
Originally Posted by poisondeathray
1 out of every 5 usually means 23.976 to 29.97 (29.97 video that had every 5th frame dropped)

It would look like this post just change the numbers to match your video .
What would you expect the pattern to usually be for a 30fps video decimated down to 25?
29.97 to 25 is 1 in 6
6. The script I gave earlier is easily adapted for 1-in-6 rather than 1-in-5. And if you don't like FrameRateConverter() you can use any other frame rate doubler.
7. Same with the other script, 6,2 would mean every 6 with offset of 2

29.97 to 25 with every 5th missing probably means something else was done, such as 29.97 to 23.976, then sped up to 25
8. You have to post a short clip that is cut from your video (do not re-encode). A missing frame every fifth frame could be caused by any number of things. Also, simply inserting a motion-estimated frame every fifth frame will almost certainly not work because the cadence of many videos often changes at scene changes or where the original video was edited.

Detecting where a frame is missing is actually not easy. However, I was able to create a script which does a pretty decent job at finding where there is a drop, and replacing it.

Automatically fix dups followed (eventually) by drops

The problem I was trying to solve in that thread is the more typical problem of a bad capture, where the capture hardware/software can't keep up, drops a frame, and then, to keep the audio in sync then duplicates a frame several frames later. (The dups are trivially easy to detect.)
9. Originally Posted by johnmeyer
You have to post a short clip that is cut from your video (do not re-encode). A missing frame every fifth frame could be caused by any number of things. Also, simply inserting a motion-estimated frame every fifth frame will almost certainly not work because the cadence of many videos often changes at scene changes or where the original video was edited.

Detecting where a frame is missing is actually not easy. However, I was able to create a script which does a pretty decent job at finding where there is a drop, and replacing it.

Automatically fix dups followed (eventually) by drops

The problem I was trying to solve in that thread is the more typical problem of a bad capture, where the capture hardware/software can't keep up, drops a frame, and then, to keep the audio in sync then duplicates a frame several frames later. (The dups are trivially easy to detect.)

The video was shot on film, mastered at 30fps, but vevo did a pal conversion down to 25, which was encoded in 2013 (way after the original video was made), which means there should be no cadence changes, as the conversion was done after mastering using modern tools. And I've scrubbed through and its looks consistent.

I'll try the FrameRateConverter and get back to yall, if it doesn't work well ill post a sample. thanks for the replies.
10. Originally Posted by poisondeathray
Originally Posted by embis2003
Originally Posted by poisondeathray
1 out of every 5 usually means 23.976 to 29.97 (29.97 video that had every 5th frame dropped)

It would look like this post just change the numbers to match your video .
What would you expect the pattern to usually be for a 30fps video decimated down to 25?
29.97 to 25 is 1 in 6
Forgive me I just miscounted the drops, this is actually the pattern.
11. Originally Posted by johnmeyer
You have to post a short clip that is cut from your video (do not re-encode). A missing frame every fifth frame could be caused by any number of things. Also, simply inserting a motion-estimated frame every fifth frame will almost certainly not work because the cadence of many videos often changes at scene changes or where the original video was edited.

Detecting where a frame is missing is actually not easy. However, I was able to create a script which does a pretty decent job at finding where there is a drop, and replacing it.

Automatically fix dups followed (eventually) by drops

The problem I was trying to solve in that thread is the more typical problem of a bad capture, where the capture hardware/software can't keep up, drops a frame, and then, to keep the audio in sync then duplicates a frame several frames later. (The dups are trivially easy to detect.)
Welp, turns out you were right, the pattern is not consistent lol. Here is the video: https://drive.google.com/file/d/1jYxddioVHnf9VuHwb3Xfb2DVJMH7J_Ip/view?usp=sharing

Here is what I know: The original video is a mix of VHS and film footage mastered at 30i. But the VEVO rip (this file) was deinterlaced at the original frame rate, making 30p, and then converted to PAL. I never understood why VEVO does this as they are an American company but I digress. There are DVD rips that can be deinterlaced to 60p, but obviously they aren't as sharp as the HD VEVO master. But for the VHS sections, the detail is low anyway, so I will probably edit in sections from the VOB file to get clean 60p VHS sections, with some sharpening to match, so those sections not being smooth when restoring this file is not that big of a deal.

Its difficult for me to count the drop pattern, but its either 1 every 5 or 1 every 6, but if its one every five, like poisondeathray said, that would mean it was 30p, IVTC'd to make 24p, and then sped up to 25p. But that isn't possible as it is the same exact length as the 24p YouTube master and the VOB file.

But what I need is to recover the film sections at 24p, as they have more visual detail than any other source of this video. The only issue is the frame rate problem. If there is no fixing this, I do have a 720 backup source that is close in detail to this, but I'm trying my hardest to salvage it.
12. When you said "consistent", you didn't actually mean "consistent"

In general, vevo takes 23.976p music videos and adds frames to make it 25p. For 90% of other videos on vevo, you would use tdecimate (cycler=1,cycle=25)

But this is a mix . There are dropped frames from the 29.97p video sections, and added frames to the 23.976p sections. Also, it's not a clean conversion (unlike like other vevo videos) . Some of the 23.976p sections have both drops and duplicates. Some of the duplicates are inserted "place holder" frames for the drops, but some are not.

I don't see a way to automatically do everything perfectly.

Add a placeholder frame where there are true drops and interpolate over it , drop frames where there are true duplicates, interpolate over placeholder duplicates. It's a bit tricky because some of the 23.976p sections have interlaced fades. To keep everything in sync you'd have to use VFR timestamps because the original content is mixed framerate. I'd use v1 timestamps because it's easier to specify ranges of frames for sections, thus less work
13. I agree with PDR. The characterization of the video simply missing one of every N frames is way off the mark.
14. Originally Posted by poisondeathray
When you said "consistent", you didn't actually mean "consistent"

In general, vevo takes 23.976p music videos and adds frames to make it 25p. For 90% of other videos on vevo, you would use tdecimate (cycler=1,cycle=25)

But this is a mix . There are dropped frames from the 29.97p video sections, and added frames to the 23.976p sections. Also, it's not a clean conversion (unlike like other vevo videos) . Some of the 23.976p sections have both drops and duplicates. Some of the duplicates are inserted "place holder" frames for the drops, but some are not.

I don't see a way to automatically do everything perfectly.

Add a placeholder frame where there are true drops and interpolate over it , drop frames where there are true duplicates, interpolate over placeholder duplicates. It's a bit tricky because some of the 23.976p sections have interlaced fades. To keep everything in sync you'd have to use VFR timestamps because the original content is mixed framerate. I'd use v1 timestamps because it's easier to specify ranges of frames for sections, thus less work
Hmm, so it seems salvaging the original film rate is unlikely? I'm sure it could be done with manual work, but that's not something I'm willing to dedicate time to, especially considering I have another source that pretty close in quality, and is original 30p.
15. Originally Posted by embis2003
Hmm, so it seems salvaging the original film rate is unlikely? I'm sure it could be done with manual work, but that's not something I'm willing to dedicate time to, especially considering I have another source that pretty close in quality, and is original 30p.
I probably wouldn't bother, but it depends on how much time you want to spend on it vs. condition of the 720 version

As you are already aware - missing frames don't necessarily interpolate that well, and you might have to do some touch up or photoshop/compositing to clean up generated artifacts. You can try mix/match the best parts of higher quality frames (masking/compositing) too if there is a significant difference, or to help tidy up the interploated frames using parts from the clean 720 version. (And if the 720p29.97 version is clean cadence wise - then the 23.976 sections must be "jerky" with duplicates, but that's better than missing frames). Or add detail to the 720 version from the 1080 version, if it's there
16. OK, so I was right about it not being consistent. Almost no video that is more than a few minutes in duration has consistent cadence throughout.

I'll have to look at the video on my main computer to see if the old script I linked to can fix it. I was helped by Didée and a few of other gurus at doom9.org.

Your video DOES have lots of dups in certain sections, but not in others. My guess is that the video will have to be split into sections, with different fixes applied to each different section.