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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th August 2012, 03:45   #1  |  Link
cg2916
Registered User
 
Join Date: Jun 2011
Posts: 6
Trim Not Working

Whenever I use Trim, it doesn't give me any errors, but it doesn't trim out ANY of the video clip. How do I fix this?
cg2916 is offline   Reply With Quote
Old 19th August 2012, 04:11   #2  |  Link
AzraelNewtype
Registered User
 
AzraelNewtype's Avatar
 
Join Date: Oct 2007
Posts: 135
Yeah.......... you're going to have to post a sample script before getting an answer.

Last edited by Guest; 19th August 2012 at 14:05. Reason: 4
AzraelNewtype is offline   Reply With Quote
Old 19th August 2012, 04:20   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,406
@AzraelNewtype, dont be cruel, let the lad post his script, we all want to see it.

EDIT: No seriously cg2916, post the script. Anybody can make mistakes
or mis-assumptions, and I guarantee it will not be terminal.
__________________
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 ???

Last edited by Guest; 19th August 2012 at 14:06. Reason: 4
StainlessS is offline   Reply With Quote
Old 19th August 2012, 05:27   #4  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,407
With utmost probability, it's a case of one of the most-common misunderstandings: inherent last, and re-assignment of variables.

WRONG:
Code:
vid = avisource(...)

vid.trim(123,4567)

return(vid)
(The 2nd line performs "trim()", and / but, the result is stored in the inherent "last" variable. The clip variable "vid" is not changed. The unchanged "vid" is returned.)


Correct: variant #1:
Code:
vid = avisource(...)
vid.trim(123,4567)
return(last)
(The 2nd line performs "trim()", and stores the result in the inherent "last" variable. The content of "last" is returned.)


Correct: variant #2:
Code:
vid = avisource(...)
vid = vid.trim(123,4567)
return(vid)
(The 2nd line performs "trim()", and stores the result in the clip variable "vid" again. The updated "vid" is returned.)


Correct: variant #3:
Code:
avisource(...)
trim(123,4567)
return(last)
(Simple chain using only inherent "last", without explicit clip variables.)
__________________
- 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 20th August 2012, 23:18   #5  |  Link
cg2916
Registered User
 
Join Date: Jun 2011
Posts: 6
Code:
video = AviSource("C:\Users\Patricia\Videos\originaldvdrip.avi")

Trim(video,100,0)
Amplify(video, 4)
deVCR(video, 30)
Sharpen(0.8)
ConvertToYUY2()
FixLuminance(50, 1000)
ConvertToYV12()
MDeblock()

function DetectVCRLines(clip c,int threshold)
{
  spacial_data = GeneralConvolution(ConvertToRGB(c),0,"0 -1 0 0 2 0 0 -1 0")
  bar_data = ConvertToRGB(BilinearResize(spacial_data,16,c.height))
  st_data = Overlay(bar_data,Trim(bar_data,1,0),mode = "subtract")
  st_data2 = Greyscale(Levels(st_data,threshold,10.0,threshold+1,0,255,coring = false))
  st_data3 = Greyscale(Levels(st_data2,127,10.0,128,0,255,coring = false))
  st_data4 = Overlay(st_data3,st_data3,y = -1, mode = "add")
  return PointResize(st_data4,c.width,c.height)
}

function deVCR(clip c,int threshold)
{
  mybars = DetectVCRLines(c,threshold)
  return Overlay(c,Trim(c,1,0), mask = mybars,greymask = true)  
}

Last edited by cg2916; 20th August 2012 at 23:20. Reason: Easier to read
cg2916 is offline   Reply With Quote
Old 20th August 2012, 23:37   #6  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Did you even bother to read Didée's post?
Groucho2004 is offline   Reply With Quote
Old 20th August 2012, 23:39   #7  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Quote:
Originally Posted by cg2916 View Post
Code:
video = AviSource("C:\Users\Patricia\Videos\originaldvdrip.avi")

Trim(video,100,0)
Amplify(video, 4)
deVCR(video, 30)
Sharpen(0.8)
ConvertToYUY2()
FixLuminance(50, 1000)
ConvertToYV12()
MDeblock()

...
.....
IanB is offline   Reply With Quote
Old 21st August 2012, 01:10   #8  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Let's be kind and actually give him a solution:

Code:
video = AviSource("C:\Users\Patricia\Videos\originaldvdrip.avi")

Trim(video,100,0)
Amplify(4)
deVCR(30)
Sharpen(0.8)
ConvertToYUY2()
FixLuminance(50, 1000)
ConvertToYV12()
MDeblock()
Guest is offline   Reply With Quote
Old 21st August 2012, 01:13   #9  |  Link
cg2916
Registered User
 
Join Date: Jun 2011
Posts: 6
Quote:
Originally Posted by neuron2 View Post
Let's be kind and actually give him a solution:

Code:
video = AviSource("C:\Users\Patricia\Videos\originaldvdrip.avi")

Trim(video,100,0)
Amplify(4)
deVCR(30)
Sharpen(0.8)
ConvertToYUY2()
FixLuminance(50, 1000)
ConvertToYV12()
MDeblock()
Thank you, but the trimming still doesn't work.
cg2916 is offline   Reply With Quote
Old 21st August 2012, 01:28   #10  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,407
That script looks like it must work. Are you sure you got the trim() logic right? Trim(100,0) means "discard frames 0-99, keep frames 100 to [EndOfVideo]".

(Sorry if it's a dumb question, but since I don't see any problem in neuron's script, I have to ask that.)
__________________
- 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 August 2012 at 01:35.
Didée is offline   Reply With Quote
Old 21st August 2012, 02:23   #11  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Yes, indeed, please tell us what frames you are trying to delete and which you try to retain.
Guest is offline   Reply With Quote
Old 21st August 2012, 14:13   #12  |  Link
cg2916
Registered User
 
Join Date: Jun 2011
Posts: 6
Quote:
Originally Posted by Didée View Post
That script looks like it must work. Are you sure you got the trim() logic right? Trim(100,0) means "discard frames 0-99, keep frames 100 to [EndOfVideo]".

(Sorry if it's a dumb question, but since I don't see any problem in neuron's script, I have to ask that.)
I've got it right. It's not trimming the first 100 frames. It's not trimming anything.
cg2916 is offline   Reply With Quote
Old 21st August 2012, 14:17   #13  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Try removing all these lines and tell us the result:

Amplify(4)
deVCR(30)
Sharpen(0.8)
ConvertToYUY2()
FixLuminance(50, 1000)
ConvertToYV12()
MDeblock()

Your script will be just:

video = AviSource("C:\Users\Patricia\Videos\originaldvdrip.avi")
Trim(video,100,0)

You can also try:

AviSource("C:\Users\Patricia\Videos\originaldvdrip.avi")
Trim(100,0)

Last edited by Guest; 21st August 2012 at 14:20.
Guest is offline   Reply With Quote
Old 21st August 2012, 15:15   #14  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,407
Wild guess: If the very-last line (not posted here) is again "return(video)", well, then ...
__________________
- 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 August 2012, 15:16   #15  |  Link
librarian
Registered User
 
Join Date: Nov 2011
Posts: 63
Someone who knows "arcane stuff" like Fixluminance (only mentioned but non detailed in the docs) and uses a not often mentioned Mdeblock can't use Trim?
Copy & paste ok but only finding the original script requires experience...
librarian is offline   Reply With Quote
Old 21st August 2012, 15:33   #16  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Quote:
Originally Posted by Didée View Post
Wild guess: If the very-last line (not posted here) is again "return(video)", well, then ...
That's why I was careful to use the word "just":

Quote:
Your script will be just:

video = AviSource("C:\Users\Patricia\Videos\originaldvdrip.avi")
Trim(video,100,0)
I'm thinking your wild guess must be correct.
Guest is offline   Reply With Quote
Old 21st August 2012, 23:23   #17  |  Link
cg2916
Registered User
 
Join Date: Jun 2011
Posts: 6
Got it! Removing the video = AviSource(...) and taking out the video arguments in the functions worked! Thank you!
cg2916 is offline   Reply With Quote
Old 21st August 2012, 23:36   #18  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Sometimes you will need to retain that video= syntax, such as when dubbing.

video=AVISource()
audio=NicAC3Source()
AudioDub(video,audio)

The key is understanding the stuff that Didee posted about implicit last etc.
Guest is offline   Reply With Quote
Old 22nd August 2012, 09:27   #19  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by neuron2 View Post
The key is understanding the stuff that Didee posted about implicit last etc.
Or just reading the documentation.
However, be aware that reading the documentation can lead to understanding how Avisynth works!
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Reply

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 18:22.


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