Log in

View Full Version : My Script is not working, Exceptions


zerowalker
23rd February 2014, 12:45
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

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)

Groucho2004
23rd February 2014, 13:06
Try LWLibavVideoSource instead if AVISource.

zerowalker
23rd February 2014, 13:09
The AVISource shouldn't be a problem, as Decoding the video itself is no problem.
It's Overlay that makes the Exceptions.

Groucho2004
23rd February 2014, 13:19
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+.

zerowalker
23rd February 2014, 13:35
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.

innocenat
23rd February 2014, 15:48
What version of AVS+ are you using? It doesn't crash for my with latest dev build, and also doesn't with r1576.

zerowalker
23rd February 2014, 16:24
I got the latest Released version, so it's probably cured in a dev version.

innocenat
23rd February 2014, 17:10
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?

raffriff42
23rd February 2014, 18:05
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 (http://avisynth.nl/index.php/Resize), so I don't know.
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

zerowalker
23rd February 2014, 18:07
AVS+ r1561 is the information.

innocenat
23rd February 2014, 18:14
Please try upgrade to r1576 (latest official release) and test.

zero9999
23rd February 2014, 18:26
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 (http://avisynth.nl/index.php/Resize), 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:

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

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):

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

Gavino
23rd February 2014, 18:47
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.

zerowalker
24th February 2014, 01:40
It seems to work with the latest version:


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.

zero9999
24th February 2014, 06:56
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.

zerowalker
25th February 2014, 10:24
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:

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).

innocenat
25th February 2014, 15:14
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.

zerowalker
27th February 2014, 03:35
It seems the error is from Avspmod, and not an Avisynth error, i guess it somehow fails to produce the preview or something.

raffriff42
27th February 2014, 04:06
Pay attention to your error messages. They can be very helpful. These are from my VirtualDub log:[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.
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