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

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th May 2008, 03:59   #1  |  Link
grumpygamer
Registered User
 
Join Date: Feb 2008
Posts: 56
anime: scene change - bad frame replacement

Hello gurus,
I am attempting to find a solution to my strange problem.
It seems there has never been such discussion on the forum or I didn't find it although I did a looong search.

What I'm talking about is the bad montage (keyword i searched for with no result) or if you prefer bad editing or again bad frame pasting.
Actually I don't know what it's called but I find it so often that it's starting to annoy me, so I was wondering weather there is a way to eliminate this problem.

It seems that in old anime on every scene change there is a bad frame (1 or 2 at max) that results in an annoying frame jump and I was wondering if there was an automatic way to detect scene changes and replace the frame accordingly.

Example:
- detect scene change on frame 200
- replace frame at 200 with frame at 201

anyway here are a couple of screenshots so you can better understand what i mean:





You can see the distortion (or whatever it's called) at the top in the frame.

Thanks in advance for any help
-gg

edit:

appearently the keyword was "scene switch"
and freezeframe but the only solution is performed manually with yatta which is a bit time consuming...

edit:

still, only one topic... so in doom9 gurus I trust

Last edited by grumpygamer; 20th May 2008 at 04:08. Reason: topic found
grumpygamer is offline   Reply With Quote
Old 20th May 2008, 04:02   #2  |  Link
roozhou
Registered User
 
Join Date: Apr 2008
Posts: 1,181
Try temporal denoiser
roozhou is offline   Reply With Quote
Old 20th May 2008, 07:49   #3  |  Link
grumpygamer
Registered User
 
Join Date: Feb 2008
Posts: 56
Are you sure a temporal denoiser would solve my problem?
It seems very unlikely to me, but on the other hand...
grumpygamer is offline   Reply With Quote
Old 20th May 2008, 18:36   #4  |  Link
lamer_de
Member
 
lamer_de's Avatar
 
Join Date: Dec 2001
Location: somewhere far beyond
Posts: 270
You want something like Improvesceneswitch. It was once part of the removedirt filter:
http://forum.doom9.org/showthread.ph...ovesceneswitch
http://forum.doom9.org/showthread.ph...ovesceneswitch

Sclav by akupenguin should also help. No clue where you can find it atm, use forum search/google.
lamer_de is offline   Reply With Quote
Old 21st May 2008, 01:51   #5  |  Link
grumpygamer
Registered User
 
Join Date: Feb 2008
Posts: 56
thanks, seems nothing automated is available in 2008...

I could try and code it myself if I had the skills.
As already stated it is quite simple.

If (keyframe detected) and (scenehaschanged) then framereplace(thisFrame-1, thisFrame-2)

assuming the detection occurs on the second first frame of the scenechange and framereplace args are framereplace (thisframe, with thatframe)
meh...

kind'a hard
grumpygamer is offline   Reply With Quote
Old 21st May 2008, 02:36   #6  |  Link
thetoof
Sleepy overworked fellow
 
Join Date: Feb 2008
Location: Maple syrup's homeland
Posts: 933
Following = big guess because it's the first time I've ever seen this.
Maybe this it is the result of some bad ivtc... it looks like it's missing a line from one of the fields.

Could you upload a small unprocessed sample containing such a scene change?
__________________
AnimeIVTC() - v2.00
-http://boinc.berkeley.edu/-
Let all geeks use their incredibly powerful comps for the greater good (no, no, it won't slow your filtering/encoding :p)
thetoof is offline   Reply With Quote
Old 21st May 2008, 04:34   #7  |  Link
[P]ako
A geek wannabe
 
[P]ako's Avatar
 
Join Date: Apr 2007
Posts: 231
Sclav is part of YATTA's plugin pack.

While it seems quite simple to you, an automated approach to what you want it may leave you with broken pans. I know it's time consuming, but I think it is manual freezeframing with YATTA.

I recall somebody having the same issue as you and a user sugguested him to use this: http://avisynth.org/stickboy/RemapFrames.zip

Last edited by [P]ako; 24th May 2008 at 15:45. Reason: oops missing word
[P]ako is offline   Reply With Quote
Old 21st May 2008, 06:37   #8  |  Link
dbzgundam
Hates all his encodes
 
dbzgundam's Avatar
 
Join Date: Sep 2003
Posts: 166
These problems arise from older cel animation having their film literally cut together.

What you're seeing is glue and/or tape.

The easy fix is freezeframing, and this actually great, except it is not useful on panning shots or shots in which the very next frame is different... Also, this reduces jitter to an almost unnatural point (I know we encoders often try to reduce frame jitter, but let's face it, it's technically natural to the source), so it may look awkward to have a frame or two of absolute steadiness.

The hard solution is painstakingly photoshopping these frames as some newer anime remasters do. They digitally remove the splices of these frames, but by no means is this automated...

EDIT: Here's an example of *Terrible* case of a scene change, and the restored version on the right. (2000 R1 vs. 2007 R2)
__________________
http://thevideophile.blogspot.com/ Watch and be amazed by my frustration over the video world!

Last edited by dbzgundam; 21st May 2008 at 06:40.
dbzgundam is offline   Reply With Quote
Old 21st May 2008, 07:16   #9  |  Link
grumpygamer
Registered User
 
Join Date: Feb 2008
Posts: 56
I understand your idea of photoshopping the bad frames, but believe me at the time being I don't have THAT amount of time!
Also replacing them manually is a not feasible at the moment. So i guess I'll try Remapframes and hope for the best.

@thetoof
hi! come to help me over here as well?? (now where is that donate button) :P
you can see the same artifacts in scene changes also on the other thread's samples

http://forum.doom9.org/showthread.php?t=137893

if you already have them samples downloaded you can just check at the bottom of the frame before a scene change, they occur at the bottom there but the concept is the same: glue or cellar tape, damn them, what cheap stakes!

Anyway scene change detection is still a problem, manual freezeframe is not a viable solution for me so I guess I'll just have to wait for a remaster or some other guru that might come up with a ultra-sophisticated function!
grumpygamer is offline   Reply With Quote
Old 21st May 2008, 15:14   #10  |  Link
Comatose
Registered User
 
Join Date: Dec 2007
Posts: 639
I noticed the frame movement after scene changes as well, in Flanders no Inu.
It's better there... but the colors change a bit as well.

first frame of scene | second frame of scene
sample 1 - 1 | 2
sample 2 - 1 | 2

sample 3 (color/brightness change is more visible here) - 1 | 2

I remember there was one scene where the change was horrible. It was a dark scene, and it looked like somebody did Tweak(bright=10) on the first frame. Very blergh.

Is there something I can use to detect scene changes?
This happens on *every* scene change with no exception, so using that script to freezeframe the first frame of each scene would be sufficient.
Later, I could play only those frames with interleave to make sure I didn't lose any motion.
Comatose is offline   Reply With Quote
Old 21st May 2008, 16:10   #11  |  Link
grumpygamer
Registered User
 
Join Date: Feb 2008
Posts: 56
Quote:
Originally Posted by Comatose View Post
... so using that script to freezeframe the first frame of each scene would be sufficient.
Later, I could play only those frames with interleave to make sure I didn't lose any motion.
Which script do you mean?
grumpygamer is offline   Reply With Quote
Old 21st May 2008, 16:15   #12  |  Link
TheRyuu
warpsharpened
 
Join Date: Feb 2007
Posts: 788
Quote:
Originally Posted by [P]ako View Post
Sclav is part of YATTA's plugin.

While it seems quite simple to you, an automated approach to what you want it may leave you with broken pans. I know it's time consuming, but I think it is manual freezeframing with YATTA.

I recall somebody having the same issue as you and a user sugguested him to use this: http://avisynth.org/stickboy/RemapFrames.zip
Scxvid is the newer one, sclavc is old and screws up too much. If you're going to use it please use scxvid. you can find them all at ivtc.org.
TheRyuu is offline   Reply With Quote
Old 21st May 2008, 17:31   #13  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Try this:

Code:
function BadSCReplace(clip i, int "thr") {
thr = default(thr, 50)
test = i.YDifferenceFromPrevious()
change = ( test > thr ) ? i.trim(0,1) : i
return change }
BadSCReplace(last,50)
--> ajust the "thr" as you like the result (low = accurate, high = useless)

Last edited by LaTo; 21st May 2008 at 17:34.
LaTo is offline   Reply With Quote
Old 21st May 2008, 18:19   #14  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
LaTo, that ain't work at all. Functions of Avisynth's conditional environment can only be used - you guess it - in Avisynth's conditional environment.

Besides, a simple thresholded difference to the previous frame isn't smart enough. That diff might be rather low e.g. in dark scenes, and might be rather high e.g. in pannings, explosion scenes and such, yielding to frame freezes in places where you definetly don't want them.
This method has been used already yeeaars ago. The result is it works in some places and in some not. High thresholds will miss many scenechanges, low thresholds give many false detections. In between, you get a mix of both.

I'd rather try try examining the 2nd derivative ... example: look at the diff-to-previous over three frames. If the middle one is reasonably bigger then the surrounding two ones, then a scenechange is likely. To be sure, take a 5-frame window, and evaluate the proportion of the diff-of-differences at the start & the end of that window to the one in the middle.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 21st May 2008 at 18:23.
Didée is offline   Reply With Quote
Old 21st May 2008, 18:42   #15  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by Didée View Post
LaTo, that ain't work at all. Functions of Avisynth's conditional environment can only be used - you guess it - in Avisynth's conditional environment.
Oups...
Any way to do this outside of Avisynth's conditional environment ???
LaTo is offline   Reply With Quote
Old 21st May 2008, 19:23   #16  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
Why outside? It's not that difficult. In the Avisynth doc's, we read:

Quote:
Originally Posted by Avisynth documentation / Conditional Filter
Code:
# This will replace the last frame before a scenechange
# with the first frame after the scenechange:
ConditionalFilter(last, last, last.trim(1,0), "YDifferenceToNext()", ">", "10", true)
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 21st May 2008, 20:30   #17  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by Didée View Post
Why outside?
Outside because I would use "the value returned by YPlaneMax()" as a parameter for an another function... No way?
LaTo is offline   Reply With Quote
Old 21st May 2008, 20:45   #18  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
No, no way. The Conditional Filters give runtime results on a frame-per-frame basis. Function parameters are static, their input parameters are determined when the script gets initialized.

Depending on what exactly you want to to, you probably can include the content of your "other function" into the Conditional Environment, so that it can evaluate the results of those runtime functions.

(Not that it were a shiny example of clean coding, but - ) you might have a look into the script "Restore24". There, there is lots of stuff going on in the conditional environment, a good bunch of userdefined functions are running completely within the Cond.Env., feeding each other with their results etc.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 22nd May 2008, 02:33   #19  |  Link
grumpygamer
Registered User
 
Join Date: Feb 2008
Posts: 56
erm...
love your debate but what is your suggestion?
-gg
grumpygamer is offline   Reply With Quote
Old 22nd May 2008, 10:43   #20  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by Didée View Post
(Not that it were a shiny example of clean coding, but - ) you might have a look into the script "Restore24". There, there is lots of stuff going on in the conditional environment, a good bunch of userdefined functions are running completely within the Cond.Env., feeding each other with their results etc.
Thanks... I will have a look
LaTo is offline   Reply With Quote
Reply

Tags
anime

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:39.


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