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 23rd February 2014, 12:45   #1  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,100
My Script is not working, Exceptions

I am trying to use a script, which simply will resize an area (containing a timestamp) and than use overlay to put it on the video, meaning only that part is resized to maintain certain quality.


But i get exceptions, and have no idea why.

http://www.sendspace.com/file/bxe63b

Code:
c=Avisource("test.avi")

c


timer=Crop(0, 470, -586, 0).Overlay(BlankClip(length=framecount(last), width=2, height=8, pixel_type="RGB32", fps=framerate(last), fps_denominator=1, audio_rate=44100, channels=1, sample_type="16bit", color=$000000), x=57, y=00, opacity=1.0, mode="blend", greymask=true, ignore_conditional=false, pc_range=false)
c.Crop(16, 10, -16, -14).AddBorders(16, 10, 16, 14, color=$000000).Spline64Resize(1280,720, src_left=0.0, src_top=0.0, src_width=0.0, src_height=0.0)   #  ConvertToYV12(matrix="Rec601", interlaced=false)  
      
Overlay(   timer.PointResize(Width(timer)*2, Height(timer)*2, src_left=0.0, src_top=0.0, src_width=0.0, src_height=0.0), x=0, y=Height(last)-Height(timer)*2, opacity=1.0, mode="blend", greymask=true, ignore_conditional=false, pc_range=false)
zerowalker is offline   Reply With Quote
Old 23rd February 2014, 13:06   #2  |  Link
Groucho2004
 
Groucho2004's Avatar
 
Join Date: Mar 2006
Posts: 3,786
Try LWLibavVideoSource instead if AVISource.
Groucho2004 is offline   Reply With Quote
Old 23rd February 2014, 13:09   #3  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,100
The AVISource shouldn't be a problem, as Decoding the video itself is no problem.
It's Overlay that makes the Exceptions.
zerowalker is offline   Reply With Quote
Old 23rd February 2014, 13:19   #4  |  Link
Groucho2004
 
Groucho2004's Avatar
 
Join Date: Mar 2006
Posts: 3,786
Quote:
Originally Posted by zerowalker View Post
The AVISource shouldn't be a problem, as Decoding the video itself is no problem.
It's Overlay that makes the Exceptions.
Your script works for me with Avisynth 2.6. However, it crashes with the latest AVS+ (MT). Post this in the AVS+ thread, assuming you are indeed using AVS+.

Last edited by Groucho2004; 23rd February 2014 at 13:21.
Groucho2004 is offline   Reply With Quote
Old 23rd February 2014, 13:35   #5  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,100
Ah that explains it, i am using AVS+, will post it and hope for a solution, cause i have been using this script before, pretty certain on the same version, but i guess something has changed anyway.
zerowalker is offline   Reply With Quote
Old 23rd February 2014, 15:48   #6  |  Link
innocenat
Registered User
 
innocenat's Avatar
 
Join Date: Dec 2011
Posts: 77
What version of AVS+ are you using? It doesn't crash for my with latest dev build, and also doesn't with r1576.
__________________
AviSynth+
innocenat is offline   Reply With Quote
Old 23rd February 2014, 16:24   #7  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,100
I got the latest Released version, so it's probably cured in a dev version.
zerowalker is offline   Reply With Quote
Old 23rd February 2014, 17:10   #8  |  Link
innocenat
Registered User
 
innocenat's Avatar
 
Join Date: Dec 2011
Posts: 77
The latest release on official website is r1576. I cannot reproduce this problem. Can you run Version() to check if we are talking about same version?
__________________
AviSynth+
innocenat is offline   Reply With Quote
Old 23rd February 2014, 18:05   #9  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,377
First thing to do was format it with line breaks. It works for me (avisynth 2.6) but I don't think it should.
src_width=0.0, src_height=0.0 does not sound right. No mention of this argument in the wiki, so I don't know.
Code:
c=Avisource("test.avi")
c

timer=Crop(0, 470, -586, 0) /* note Last must be > 470x586 */
\        .Overlay(
\            BlankClip(length=framecount(last), 
\                width=2, height=8, pixel_type="RGB32", 
\                fps=framerate(last), fps_denominator=1, 
\                audio_rate=44100, channels=1, sample_type="16bit", 
\                color=$000000), 
\            x=57, y=00, 
\            opacity=1.0, mode="blend", 
\            greymask=true, 
\            ignore_conditional=false, pc_range=false)
/* return Last ## 1280x720 */
/* return timer ## 694x250 */

c.Crop(16, 10, -16, -14)
\.AddBorders(16, 10, 16, 14, color=$000000)
\.Spline64Resize(
\     1280, 720, 
\     src_left=0.0, src_top=0.0, 
\     src_width=0.0, src_height=0.0) /* what is this? */   
#  ConvertToYV12(matrix="Rec601", interlaced=false)  
/* return Last ## 1280x720 */
      
Overlay(
\    timer.PointResize(
\        Width(timer)*2, Height(timer)*2, 
\        src_left=0.0, src_top=0.0, 
\        src_width=0.0, src_height=0.0), /* what is this? */ 
\        x=0, y=Height(last)-Height(timer)*2, 
\        opacity=1.0, mode="blend", 
\        greymask=true, 
\        ignore_conditional=false, pc_range=false)
return Last ## 1280x720

Last edited by raffriff42; 23rd February 2014 at 18:07. Reason: typo
raffriff42 is offline   Reply With Quote
Old 23rd February 2014, 18:07   #10  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,100
AVS+ r1561 is the information.
zerowalker is offline   Reply With Quote
Old 23rd February 2014, 18:14   #11  |  Link
innocenat
Registered User
 
innocenat's Avatar
 
Join Date: Dec 2011
Posts: 77
Please try upgrade to r1576 (latest official release) and test.
__________________
AviSynth+
innocenat is offline   Reply With Quote
Old 23rd February 2014, 18:26   #12  |  Link
zero9999
Registered User
 
Join Date: Oct 2011
Posts: 52
Quote:
Originally Posted by raffriff42 View Post
First thing to do was format it with line breaks. It works for me (avisynth 2.6) but I don't think it should.
src_width=0.0, src_height=0.0 does not sound right. No mention of this argument in the wiki, so I don't know.
these parameters are for cropping (the wiki mentions them), but they are all 0 by default, so setting them all to 0.0 does exactly nothing.
As does most of the script.

It boils down to this:
Code:
timer=Crop(0, 470, 58, 0).AddBorders(0,0,50,0)
Spline64Resize(1280,720)
Overlay(timer.PointResize(timer.Width*2, timer.Height*2), y=Height-timer.Height*2)
or
Code:
timer=PointResize(116, 20, 0, 470, 58, 0).AddBorders(0,0,100,0)
Spline64Resize(1280,720)
Overlay(timer, y=Height-timer.Height)
or (probably faster):
Code:
ow = 1280
oh =720
ty = 470
tw = 58
timer=PointResize(tw*2, (Height-ty)*2, 0, ty, tw, 0).AddBorders(0,0,ow-tw*2,0)
StackVertical(Spline64Resize(ow,oh,0,0,0,ty),timer)
and it works

Last edited by zero9999; 23rd February 2014 at 19:52.
zero9999 is offline   Reply With Quote
Old 23rd February 2014, 18:47   #13  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,380
Quote:
Originally Posted by zero9999 View Post
they are all 0 by default
src_width and src_height do not default to zero, but to the input width and height respectively. Of course, if src_left and src_top are both zero (their defaults), then (and only then) the default values for src_width and src_height have the same effect as zero.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 24th February 2014, 01:40   #14  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,100
It seems to work with the latest version:

Quote:
c=Avisource("...")
c
timer=Crop(0, 470, -600, 0).Overlay(BlankClip(length=framecount(last), width=7, height=8, pixel_type="RGB32", fps=framerate(last)), x=57, y=0)
Spline64Resize(1280,720)
Overlay(timer.PointResize(Width(timer)*2, Height(timer)*2), x=0, y=Height(last)-Height(timer)*2)
ConvertToYV12(matrix="Rec601", interlaced=false)
zero9999, your versions doesn't seem to work as intended, it only get's the left timestamp and borders the rest.
zerowalker is offline   Reply With Quote
Old 24th February 2014, 06:56   #15  |  Link
zero9999
Registered User
 
Join Date: Oct 2011
Posts: 52
Quote:
Originally Posted by zerowalker View Post
It seems to work with the latest version:

zero9999, your versions doesn't seem to work as intended, it only get's the left timestamp and borders the rest.
oh, after a quick glimpse at your original script, i thought the first overlay was for the purpose of covering up a part of the timer. turns out it actually does nothing but cover up stuff that is already black.
just use the last code snippet and increase the tw parameter as you see fit.
zero9999 is offline   Reply With Quote
Old 25th February 2014, 10:24   #16  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,100
The purpose was simply to put black on a place that was showing the clip, there was a glap to cover up.


Anyhow, i am getting problems with exceptions still, but other causes, and i think you can produce it simply with Blankclips as well.

Can anyone try this:

Quote:
c=BlankClip(length=240, width=720, height=480, pixel_type="RGB32", fps=24.0, fps_denominator=1, audio_rate=44100, channels=1, sample_type="16bit", color=$000000)
c
timer=Crop(0, 470, -600, 0).Overlay(BlankClip(length=framecount(last), width=7, height=8, pixel_type="RGB32", fps=framerate(last), fps_denominator=1, audio_rate=44100, channels=1, sample_type="16bit", color=$000000), x=57, y=00, opacity=1.0, mode="blend", greymask=true, ignore_conditional=false, pc_range=false)
Crop(16, 0, -16, -0)
AddBorders(16, 0, 16, 0, color=$000000)
Spline64Resize(1280,720)
ConvertToYV12(matrix="Rec601", interlaced=false)
Overlay(timer.PointResize(Width(timer)*2, Height(timer)*2, src_left=0.0, src_top=0.0, src_width=0.0, src_height=0.0), x=0, y=Height(last)-Height(timer)*2, opacity=1.0, mode="blend", greymask=true, ignore_conditional=false, pc_range=false)
intro=BlankClip(length=240, width=1280, height=72, pixel_type="RGB32", fps=24.0, fps_denominator=1, audio_rate=44100, channels=1, sample_type="16bit", color=$000000)
intro++last
Hmm, okay when i try to play the clip, it's simply a Format (YV12) error, but it seems that it's AVSpmod that's giving me exceptions and not showing the video that should show the Avisynth exception.
So please try with Avspmod and see if it returns an exception (a text log opens up instead of the actual video preview).

Last edited by zerowalker; 25th February 2014 at 10:27.
zerowalker is offline   Reply With Quote
Old 25th February 2014, 15:14   #17  |  Link
innocenat
Registered User
 
innocenat's Avatar
 
Join Date: Dec 2011
Posts: 77
Quote:
Originally Posted by zerowalker View Post
Anyhow, i am getting problems with exceptions still, but other causes, and i think you can produce it simply with Blankclips as well.
I get "Splice: Frame size doesn't match" error on last line. Individual "last" or "intro" plays fine.
__________________
AviSynth+
innocenat is offline   Reply With Quote
Old 27th February 2014, 03:35   #18  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,100
It seems the error is from Avspmod, and not an Avisynth error, i guess it somehow fails to produce the preview or something.
zerowalker is offline   Reply With Quote
Old 27th February 2014, 04:06   #19  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,377
Pay attention to your error messages. They can be very helpful. These are from my VirtualDub log:
Code:
[E] Error: Avisynth open failure:
    Splice: Frame sizes don't match
    (D:\VideoProjects\_scripts\test_05.avs, line 63)
. . . 
[E] Error: Avisynth open failure:
    Splice: Video formats don't match
    (D:\VideoProjects\_scripts\test_05.avs, line 63)
Problem 1: Last=1280x720, intro=1280x72; can't splice 'em.
Problem 2: Last=YV12, intro=RGB32; can't splice 'em.
Arguments that duplicate the defaults do nothing but invite error; they have been commented out.
Code:
c=BlankClip(length=240, width=720, height=480, pixel_type="RGB32", fps=24.0,
\ fps_denominator=1, audio_rate=44100, channels=1, sample_type="16bit", color=$000000)
c
timer=Crop(0, 470, -600, 0).Overlay(Last.BlankClip(/*length=framecount(last), */width=7,
\ height=8/*, pixel_type="RGB32", fps=framerate(last), fps_denominator=1, audio_rate=44100,
\ channels=1, sample_type="16bit", color=$000000*/), x=57, y=00/*, opacity=1.0, mode="blend",
\ greymask=true, ignore_conditional=false, pc_range=false*/)
Crop(16, 0, -16, -0)
AddBorders(16, 0, 16, 0, color=$000000)
Spline64Resize(1280,720)
ConvertToYV12(matrix="Rec601"/*, interlaced=false*/)
Overlay(
\ timer.PointResize(Width(timer)*2, Height(timer)*2/*, src_left=0.0, src_top=0.0, src_width=0.0, src_height=0.0*/),
\ x=0, y=Height(last)-Height(timer)*2/*, opacity=1.0, mode="blend", greymask=true,
\ ignore_conditional=false, pc_range=false*/)
intro=Last.BlankClip(length=240/*, width=1280, height=72, pixel_type="RGB32",
\ fps=24.0, fps_denominator=1, audio_rate=44100, channels=1, sample_type="16bit", color=$000000*/)
intro++last

Last edited by raffriff42; 27th February 2014 at 04:31.
raffriff42 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 05:16.


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