Hi - this is from a script I've just done:
e=trim(0,142)+trim(144,212)+trim(214,279)+trim(281 ,403)+trim(405,465)+trim(468,638)+trim(640,750)+tr im(753,888)+trim(890,937)+trim(939,1034)
f=trim(1036,1382)+trim(1384,1449)+trim(1451,1605)+ trim(1608,1870)+trim(1872,1901)+trim(1903,2010)+tr im(2012,2102)+trim(2104,2272)+trim(2274,2378)
g=trim(2381,2591)+trim(2593,2628)+trim(2631,2712)+ trim(2714,2767)+trim(2769,2807)+trim(2809,2881)+tr im(2883,3026)+trim(3028,3112)+trim(3114,3171)
h=trim(3173,3391)+trim(3393,3635)+trim(3637,3670)+ trim(3672,3741)+trim(3743,3912)+trim(3914,4181)+tr im(4183,4328)+trim(4331,4867)+trim(4869,5231)
i=trim(5233,5458)+trim(5461,5553)+trim(5556,5740)+ trim(5742,6627)+trim(6629,6801)+trim(6803,6880)+tr im(6882,7302)+trim(7304,7386).fout(11)
e+f+g+h+i
The video was from the 70's and the last frame of each scene had a nasty splice mark. Is there a better way of scripting this e.g. a command that effectively says "trim(0,10000) but ignore frames 22, 87,213..."?
Many thanks.
+ Reply to Thread
Results 1 to 12 of 12
-
-
You know you're wrecking the audio synch, don't you?
There's always the DeleteFrame command. Me, I fix them. Begin reading here:
https://forum.videohelp.com/threads/385260-Blending-problem-still-exist-after-and-befo...MC#post2497707 -
Thanks for that. I did think about the A/V sync and my thinking was this: my script begins with a=video, b=audio,audiodub(a,b) followed by all the trims. When using audiodub, a simple trim(x,y) gives you the audio and video between frames x and y, yes? In which case, all the trims in my ungainly script should all, individually, be in sync. What there WILL be, I thought, is audio dropout but, because I'm losing the final frame of each scene, there's no audio worth worrying about – the line will have been spoken. Even a dropped frame in the middle of a scene shouldn't be noticeable.
That was my thinking. Is it wrong? -
The audio is in the script? Then you should be using AlignedSplice (++). Still, why use a ton of trims when DeleteFrame can do the job. Or, better, since you're going through the whole thing anyway replace all the bad frames at scene changes
-
Yes, I remembered about using '++' when I went to your DeleteFrame link. Let's assume this script:
a=video, b=audio,audiodub(a,b)
trim(0,142)++trim(144,212)++trim(214,279)++trim(28 1,403)++trim(405,465)++trim(468,638)
Changing it to the DeleteFrame method would be:
trim(0,638).DeleteFrame(143,213,280,404) #is that right?
But I reckon that would definitely put the sync off. To ensure good sync, I think you'd need to say:
trim(0,143).DeleteFrame(143)++trim(144,213).Delete Frame(213) etc etc which is a worse script than my original.
When you say 'replace all the bad frames at scene changes' are you speaking of your Function? -
manono's automated scene change fixer:
Code:A=Last prev = A.selectevery(1,-1) next = A.selectevery(1,1) SCclean = A.SCSelect(next,prev,A,dfactor=2.0) # 2.0 ~ 5.0 return(SCclean) # return(restore) for NO scenechange cleanup
Code:function CleanSceneChanges(clip v, float "threshold") { threshold = default(threshold, 2.0) # 2.0 ~ 5.0 prev = v.selectevery(1,-1) next = v.selectevery(1,1) return(v.SCSelect(next,prev,v,dfactor=threshold)) }
Code:WhateverSource() CleanSceneChanges(3.0)
-
Yes, FreezeFrameMC. The easier one jagabo mentions is automatic, requiring no intervention from you. But it has its own drawbacks. That one isn't mine, though, but was created by Didee at Doom9.
I don't think you should be using either all the trims or Deleteframe, not when you're intending to mess with the audio. Even FreezeFrame would be better to remove the garbage at scene changes. -
A modification of the earlier function which allows you to specify fixing only the frame before the scene change, or the frame after the scene change:
Code:############################################################################## # # Clean scene changes with copies of prior and later frames. # Fixes both by default, otherwise select which to fix. # ############################################################################## function CleanSceneChanges(clip v, float "threshold", bool "fix_previous", bool "fix_next") { threshold = default(threshold, 2.0) # 2.0 ~ 5.0 fix_previous = default(fix_previous, true) fix_next = default(fix_next, true) prev = fix_previous ? v.selectevery(1,-1) : v next = fix_next ? v.selectevery(1,1) : v return(v.SCSelect(next,prev,v,dfactor=threshold)) } ##############################################################################
Code:CleanSceneChange(3.0, true, false)
-
Ah, good one. If it's as he says - that the bad frame is always the one before the scene change - this could be very helpful to pooksahib.
-
I really appreciate the assistance you two give – in this thread and in many previous ones. Unfortunately, my old brain doesn't always understand what you're telling me or how to turn it into usable script. Let's say I want to make a short video comprising the first 3 scenes (2 scene changes) of a DVD - it would normally look like this:
Code:a=video, b=audio,audiodub(a,b) trim(0,279)
Code:a=video, b=audio,audiodub(a,b) trim(0,142)++trim(144,212)++trim(214,279)
(Is it CleanSceneChange or CleanSceneChanges? Both appear in post #8.)
This is the part where I struggle, how to script it. If I write:
Code:function CleanSceneChanges(clip v, float "threshold", bool "fix_previous", bool "fix_next") { threshold = default(threshold, 2.0) # 2.0 ~ 5.0 fix_previous = default(fix_previous, true) fix_next = default(fix_next, true) prev = fix_previous ? v.selectevery(1,-1) : v next = fix_next ? v.selectevery(1,1) : v return(v.SCSelect(next,prev,v,dfactor=threshold)) } ### usual file source stuff ### trim(0,279)
My continued thanks. -
You are only creating the function there. Just like any other function, you need to call it in order for it to be used:
Code:# create a function called CleanSceneChanges: function CleanSceneChanges(clip v, float "threshold", bool "fix_previous", bool "fix_next") { threshold = default(threshold, 2.0) # 2.0 ~ 5.0 fix_previous = default(fix_previous, true) fix_next = default(fix_next, true) prev = fix_previous ? v.selectevery(1,-1) : v next = fix_next ? v.selectevery(1,1) : v return(v.SCSelect(next,prev,v,dfactor=threshold)) } ### usual file source stuff ### trim(0,279) CleanSceneChanges(2.0, true, false) # call it
Beware that an automated function like that may lead to false positives (a big change between frames may be seen as a scene change though it's not, leading to jerky motion) or false negatives (a true scene change isn't detected). The higher the threshold the bigger the change needs to be to be detected as a scene change. But you may not be able to find a setting that detects all scene changes with no false positives.Last edited by jagabo; 8th Oct 2017 at 09:04.
-
Ahhhh... I didn't realise it was automatic, I thought you 'called' it at specific points. I know that there are some areas of this DVD where the last 2 frames of a scene have splice marks so I could still end up with a bad frame here and there but I think I can live with that. I'll give it a go - thanks for the explanation.
Similar Threads
-
Avisynth total frames does not equal VirtualDub total frames
By EasyFeet in forum EditingReplies: 12Last Post: 14th May 2017, 00:20 -
Problem with Avisynth - frames
By Colek in forum EditingReplies: 3Last Post: 6th Sep 2015, 09:58 -
Virtual dub-deleting frames
By Mr_Flintstone in forum EditingReplies: 4Last Post: 7th May 2014, 10:15 -
Help: Applying Avisynth Filters to Certain Frames and to All Frames
By DarkSamus993 in forum EditingReplies: 4Last Post: 27th Dec 2013, 13:24 -
Bad frames fixing or deleting without screwing audio
By mammo1789 in forum RestorationReplies: 5Last Post: 16th Oct 2012, 17:28