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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 31st December 2012, 00:31   #1  |  Link
JeanMarc
Registered User
 
Join Date: Aug 2006
Location: USA
Posts: 59
Problem with avisynth BlankClip()

I am just starting doing video work on a faster Windows 7 system, and I am puzzled with an issue I have with BlankClip.
I am using Avisynth 2.5.8 and Virtualdub 1.9.11 (32-bit)
I am using that BlankClip in some scripts where I don't need the audio stream, according to the avisynth wiki on BlankClip:
Code:
# adds a silent audio stream (with a samplerate of 48 kHz) to a video clip:
video = AviSource("E:\pdwork\DO-Heaven.AVI")
audio = BlankClip(video, audio_rate=48000)
AudioDub(video, audio)
This is not accepted by VirtualDub on my new system. VirtualDub opens the first frame, but when asked to play the video, it crashes:
Quote:
Ooops -- VirtualDub has crashed....blah blah...
Crash details (best guess as to cause)
An integer division by zero occurred in module 'VirtualDub'
If I replace the line 'audio = BlankClip(video, audio_rate=48000)' with a real audio stream, i.e. 'audio = NicMPG123Source("audio.mp2")', it works.

If I want to feed VirtualDub with just a one-line script:
Code:
BlankClip(color=$0000FF)
No problem, so BlankClip is accepted in that case.
If I want to use:
Code:
BlankClip(color=$0000FF)
video = KillAudio(last)				# Eliminate audio stream
audio = Blankclip(video, audio_rate=48000)	# Create blank audio stream
Audiodub(vid2, audio)				# Remux
VirtualDub crashes again.
I don't have any clue about what is going on. I have been using avisynth scripts with BlankClip for a long time on XP and Win7 without any problem.
I would greatly appreciate any comment on that issue.
Thanks.

Last edited by JeanMarc; 31st December 2012 at 00:35. Reason: Additional detail
JeanMarc is offline   Reply With Quote
Old 31st December 2012, 01:55   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by JeanMarc View Post
Code:
BlankClip(color=$0000FF)
video = KillAudio(last)				# Eliminate audio stream
audio = Blankclip(video, audio_rate=48000)	# Create blank audio stream
Audiodub(vid2, audio)				# Remux
Well for that one, I get something like:

Quote:
I dont know what vid2 means
Have not tried the others.

EDIT: If you change vid2 to video, you get a "unable to download appropriate decompressor" and a clip in blue. (mplayer2)
Audio problem, suspect problem in 2nd Blankclip, duplicating a null audio clip @ 48khz. (looks like a real bug to me, I'm on 2.6a3).
Trying to convert a null (zero) hz clip to 48khz produces a divide by zero.
Blankclip is trying to duplicate the properties of the first clip, and then convert to 48khz produces the /0.0
(perhaps mismatch between what KillAudio thinks is killed and convert sample rate thinks is dead).

EDIT:

BlankClip(color=$0000FF)
Killaudio()
Blankclip(audio_rate=48000) # OK
# Last.Blankclip(audio_rate=48000) # NOT OK

# Think this bug has already been reported and fixed (in some future release), implicit versus explicit Last
(implicit not really used, bug in explicit).

EDIT: think its been reported, searched, could not find.
__________________
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 StainlessS; 31st December 2012 at 03:15.
StainlessS is offline   Reply With Quote
Old 31st December 2012, 06:20   #3  |  Link
JeanMarc
Registered User
 
Join Date: Aug 2006
Location: USA
Posts: 59
Quote:
I dont know what vid2 means
Well, you're right, that was a typo. It was video, not vid2.
It might be a bug. But I need to do more tests tomorrow. I just realized that on the previous win7 system I am trying to move away from, these clips with BlankClip are also causing the same problems with VirtualDub. I just didn't see them as what I was doing was using that clip (with the blank audio) to encode them into an x264 mp4 video-only stream with ffmpeg. Ffmpeg complained about the audio, but I was getting the video stream I needed.
I will try to do a closer comparison of what is happening on the two platforms tomorrow. I will report here.
Regarding the script:
Code:
BlankClip(color=$0000FF)
Killaudio()
Blankclip(audio_rate=48000) # OK
# Last.Blankclip(audio_rate=48000) # NOT OK
It is not obvious to me that a blank audio has been added to the original video (which is what I was trying to do) as opposed to create a new default blank video stream, with the specified audio at 48 kHz. But it's interesting that this code is working.
JeanMarc is offline   Reply With Quote
Old 31st December 2012, 12:07   #4  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by JeanMarc View Post
Code:
# adds a silent audio stream (with a samplerate of 48 kHz) to a video clip:
video = AviSource("E:\pdwork\DO-Heaven.AVI")
audio = BlankClip(video, audio_rate=48000)
AudioDub(video, audio)
That code won't work if the original video has no audio at all.
BlankClip takes any unspecified properties from the source ('template') clip, so you need to specify all the audio properties together (audio_rate, channels and sample_type) if the template has no audio.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 31st December 2012, 14:46   #5  |  Link
JeanMarc
Registered User
 
Join Date: Aug 2006
Location: USA
Posts: 59
for this detail. I was wrongly assuming that blankclip would always provide the default stream definition (I think it's 44100 Hz, 1 channel, 16bit).
I can see now that:
Code:
BlankClip(color=$0000FF)
video = KillAudio(last)				
audio = Blankclip(video, audio_rate=48000)	
Audiodub(video, audio)
doesn't work, while
Code:
BlankClip(color=$0000FF)
video = KillAudio(last)				
audio = Blankclip(video, audio_rate=48000, channels = 2, sample_type = "24bit")	
Audiodub(video, audio)
works! That's an easy workaround.
Problem solved!
JeanMarc is offline   Reply With Quote
Old 31st December 2012, 15:15   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
OK, all audio parms should be provided, but divide by zero is still a bug.

I'm a bit knackered, think I'll take the rest of the year off.

Happy New Year.
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 31st December 2012, 16:14   #7  |  Link
JeanMarc
Registered User
 
Join Date: Aug 2006
Location: USA
Posts: 59
Same with me.
Happy New Year!
JeanMarc is offline   Reply With Quote
Old 31st December 2012, 17:23   #8  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by StainlessS View Post
OK, all audio parms should be provided, but divide by zero is still a bug.
The divide by zero is happening inside VDub, not BlankClip().
(BlankClip() doesn't need to do sample rate conversion, it just returns zeroes for all GetAudio() requests.)

The problem with the original script is that you end up with a clip with badly formed audio properties - a non-zero sample rate (so satisfies HasAudio()), but no audio channels and a sample type of 'NONE'. Perhaps it would be better if BlankClip(), when given a clip without audio, and explicit audio parameter(s), took the missing audio properties from the 'default' case, rather than from the source clip. (However - as now - when the template clip does not have an audio track, it should not add one if no audio parameters are provided.)

Quote:
Originally Posted by StainlessS View Post
# Think this bug has already been reported and fixed (in some future release), implicit versus explicit Last
You probably mean this - present in 2.58 and fixed in current 2.60.

Happy New Year, everyone!
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 1st January 2013, 12:30   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
One year later ...

Sorry to revive this old thread, but I dont think that was the thread I saw (sometime within last 6 months) but
about the same content.
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 7th November 2014, 20:19   #10  |  Link
gencom
Registered User
 
Join Date: Mar 2009
Posts: 14
how can i make pattern blankclip with two colors?
gencom is offline   Reply With Quote
Old 7th November 2014, 20:27   #11  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
There are many ways to make a pattern clip with two colors, but they should be discussed in a new thread. (BlankClip does not have patterns, it has one color only)



* EDIT - re original question:
Code:
audio = Blankclip(video, audio_rate=48000) # wrong
audio = Blankclip(audio_rate=48000)        # right
You don't want to give BlankClip a template without audio - unless you want a blank clip without audio.

* EDIT another way:
Code:
Tone(length=(video.FrameCount/video.FrameRate), samplerate=48000, channels=2, type="silence", level=0.0)

Last edited by raffriff42; 7th November 2014 at 20:50.
raffriff42 is offline   Reply With Quote
Old 7th November 2014, 20:31   #12  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 357
Code:
BlankClip(1, 16, 16, "RGB24")
StackHorizontal(last, last.Invert)
StackHorizontal(last, last)
StackHorizontal(last, last)
StackHorizontal(last, last)
StackHorizontal(last, last)
StackHorizontal(last, last)
StackVertical  (last, last.Invert)
StackVertical  (last, last)
StackVertical  (last, last)
StackVertical  (last, last)
StackVertical  (last, last)
creaothceann is offline   Reply With Quote
Old 15th November 2014, 13:34   #13  |  Link
gencom
Registered User
 
Join Date: Mar 2009
Posts: 14
Quote:
Originally Posted by creaothceann View Post
Code:
BlankClip(1, 16, 16, "RGB24")
StackHorizontal(last, last.Invert)
StackHorizontal(last, last)
StackHorizontal(last, last)
StackHorizontal(last, last)
StackHorizontal(last, last)
StackHorizontal(last, last)
StackVertical  (last, last.Invert)
StackVertical  (last, last)
StackVertical  (last, last)
StackVertical  (last, last)
StackVertical  (last, last)

great thanks



for this?

Last edited by gencom; 15th November 2014 at 13:56.
gencom is offline   Reply With Quote
Old 15th November 2014, 16:56   #14  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Create two clips, dark and light blue. Combine them like this: http://avisynth.nl/index.php/WeaveColumns.
Wilbert is offline   Reply With Quote
Old 15th November 2014, 21:07   #15  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
WeaveColumns/Rows v2.60 only.
__________________
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 ???
StainlessS is offline   Reply With Quote
Reply


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 07:42.


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