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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 14th October 2022, 16:27   #1  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
ReplaceFrameX & InsertFrameX

ReplaceFrameX is an Avisynth function for replacing bad frames. It can't look for bad frames itself, only replace those you tell it to. Frames can be replaced with duplicates, blended versions of the surrounding frames, or by interpolating frames using FrameRateConverter or MVTools2. The default is to replace frames with duplicates.

InsertFrameX is similar to ReplaceFrameX, but new frames are inserted into the video increasing the frame count (ie to add missing frames). There's an additional argument for inserting silent audio to match, although by default any audio is passed through untouched.

StartBlack, EndBlack, ReplaceBlack, AddBlack & AppendBlack are functions for adding black frames.

Usage instructions at the top of each script.

Edit 2023-01-07 Re-uploaded ReplaceFrameX to fix an error when the number of frames to be replaced wasn't specified. The version date remains the same.
ReplaceFrameX 2022-12-17.avsi
InsertFrameX 2022-12-17.avsi
Black (Start, End, Replace, Add, Append) 2022-10-16.avsi

Some ReplaceFrameX "Blend" and "FRC" examples.

ReplaceFrameX(56488, Mode="Blend", Position=true) - Replacing frame 56488



ReplaceFrameX(56488, Mode="FRC", Position=true) - Replacing frame 56488



ReplaceFrameX(56488, 2, "Blend", Position=true) - Replacing frames 56488 & 56489



ReplaceFrameX(56488, 2, "FRC", Position=true) - Replacing frames 56488 & 56489



ReplaceFrameX(56488, 3, "Blend", Position=true) - Replacing frames 56488, 56489 & 56490



ReplaceFrameX(56488, 3, "FRC", Position=true) - Replacing frames 56488, 56489 & 56490


Last edited by hello_hello; 7th January 2023 at 03:35.
hello_hello is offline   Reply With Quote
Old 14th October 2022, 18:51   #2  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
Thanks! I may have a use for this down the road.
johnmeyer is offline   Reply With Quote
Old 14th October 2022, 19:33   #3  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
You're welcome.
hello_hello is offline   Reply With Quote
Old 14th October 2022, 21:40   #4  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
I just realised the handling of the first couple, and possibly last couple of frames is bad (otherwise it's okay). I'll upload a new version dated 2022-10-16 sometime soon(ish).

Last edited by hello_hello; 14th October 2022 at 21:44.
hello_hello is offline   Reply With Quote
Old 15th October 2022, 19:30   #5  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 223
Quote:
ReplaceFrameX(56488, Mode="FRC", Position=true) - replacing frame 56488
This version looked great.
coolgit is offline   Reply With Quote
Old 16th October 2022, 04:17   #6  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Quote:
Originally Posted by coolgit View Post
This version looked great.
You can thank the author of FrameRateConverter for that.

There's a link for the fixed version dated 2022-10-16 in the opening post.

To atone for my silliness, I've also added a link for some functions for replacing frames with black ones, or appending black frames to the beginning and/or end of the video.
hello_hello is offline   Reply With Quote
Old 16th October 2022, 05:09   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
replacing frames with black ones
Replace single frame with previous or next frame is quite handy and easily implemented.
(handy for quite common bad frame before/after scene change)
__________________
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 16th October 2022, 08:08   #8  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Yeah, those functions were specifically for messing with black frames. A couple of them are due to my OCD for beginning and ending every encode with a blank frame.

ReplaceFrameX can replace a frame or frames with duplicates (maximum of 3 in succession). It's usually better for animation as there's lots of duplicates anyway.

ReplaceFrameX(56488, 1, Mode="DupP") - Replaces frame 56488 with a duplicate of the previous frame.
ReplaceFrameX(56488, 1, Mode="DupN") - Replaces frame 56488 with a duplicate of the next frame.

Last edited by hello_hello; 16th October 2022 at 08:23.
hello_hello is offline   Reply With Quote
Old 16th October 2022, 12:58   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Whoa!,
U dont mess about do U. [dat were a bit qwik]

Tanks.
__________________
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 17th October 2022, 08:10   #10  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
You're welcome, but the duplicate modes already existed. Replacing the first or last frame with a duplicate was something I forgot to check so that was what I had to fix.
hello_hello is offline   Reply With Quote
Old 5th December 2022, 01:10   #11  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
I've added a link for a function called InsertFrameX to the opening post. It's quite similar to ReplaceFrameX, but instead of replacing existing frames it inserts new ones.

There's also a link for a new version of ReplaceFrameX dated 2022-12-05. It's functionality hasn't changed but I fixed an error message relating to "out of range" frame numbers.
hello_hello is offline   Reply With Quote
Old 5th December 2022, 08:57   #12  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
but instead of replacing existing frames it inserts new ones.
I have not looked at it at all, but might be good idea to point out caveat, where all frames after inserted frame are
shifted 1 frame later, so any subsequent insertions later in clip will be off by 1 with respect to src (then off by 2 etc).

User really needs to do in reverse order, from end, to start, of insertions. (where multiple insertions)
__________________
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 17th December 2022, 01:45   #13  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Based on some info posted by poisondeathray and jagabo at VideoHelp I've updated the scripts so there's links to new versions of ReplaceFrameX/InsetFrameX in the opening post.

Added support for Dogway's two flavours of FrameRateConverter, along with new modes for the RIFE presets. I've also added MVTools2 modes based on jagabo's scripts.

Mode = "Dup", "DupP", "DupN", "Blend", "FRC", "FRCEX", "FRCMIX", "MFlow", "MBlock"
Means
Duplicate Previous/Next, Blend, FrameRateConverter, FrameRateConverterEX, FrameRateConverterMIX, MFlowFPS or MBlockFPS (MVTools2).

Preset (for FrameRateConverter) = "Slowest", "Slower", "Slow", "Normal", "Fast", "Faster", "Anime", "Rife", "RifeHQ" or "RifeAnime".

There's updated instructions at the top of each script.

Quote:
Originally Posted by StainlessS View Post
I have not looked at it at all, but might be good idea to point out caveat, where all frames after inserted frame are
shifted 1 frame later, so any subsequent insertions later in clip will be off by 1 with respect to src (then off by 2 etc).

User really needs to do in reverse order, from end, to start, of insertions. (where multiple insertions)
For InsertFrameX the position argument displays the original frame numbers over the video, and after inserting frames it includes a reminder to add the number of inserted frames to the displayed frame number.
ie Frame 4672 (+3)
It's useful if you're inserting frames once, otherwise yes, it might be easier to use a different method for displaying frame numbers and to work backwards.

Last edited by hello_hello; 17th December 2022 at 02:05.
hello_hello is offline   Reply With Quote
Reply


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 03:52.


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