Log in

View Full Version : Problem with avisynth BlankClip()


JeanMarc
31st December 2012, 00:31
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:
# 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:
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:
BlankClip(color=$0000FF)No problem, so BlankClip is accepted in that case.
If I want to use:
BlankClip(color=$0000FF)
video = KillAudio(last) # Eliminate audio stream
audio = Blankclip(video, audio_rate=48000) # Create blank audio stream
Audiodub(vid2, audio) # RemuxVirtualDub 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.

StainlessS
31st December 2012, 01:55
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:

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.

JeanMarc
31st December 2012, 06:20
I dont know what vid2 meansWell, 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:
BlankClip(color=$0000FF)
Killaudio()
Blankclip(audio_rate=48000) # OK
# Last.Blankclip(audio_rate=48000) # NOT OKIt 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.

Gavino
31st December 2012, 12:07
# 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.

JeanMarc
31st December 2012, 14:46
:thanks: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:
BlankClip(color=$0000FF)
video = KillAudio(last)
audio = Blankclip(video, audio_rate=48000)
Audiodub(video, audio) doesn't work, while
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!

StainlessS
31st December 2012, 15:15
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. :)

JeanMarc
31st December 2012, 16:14
Same with me.
Happy New Year!

Gavino
31st December 2012, 17:23
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.)

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

StainlessS
1st January 2013, 12:30
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. :)

gencom
7th November 2014, 20:19
how can i make pattern blankclip with two colors?

raffriff42
7th November 2014, 20:27
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: audio = Blankclip(video, audio_rate=48000) # wrong
audio = Blankclip(audio_rate=48000) # rightYou don't want to give BlankClip a template without audio - unless you want a blank clip without audio.

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

creaothceann
7th November 2014, 20:31
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)

gencom
15th November 2014, 13:34
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:thanks:

http://s30.postimg.org/ozduqemht/asd.png

for this?

Wilbert
15th November 2014, 16:56
Create two clips, dark and light blue. Combine them like this: http://avisynth.nl/index.php/WeaveColumns.

StainlessS
15th November 2014, 21:07
WeaveColumns/Rows v2.60 only.