View Full Version : Replacing one frame of video with one frame of ColorBars and Tone
dwilbank
20th September 2012, 21:14
Good sirs:
As a new, new, scripter, should I even attempt this?
"Replacing 1 frame of video with 1 frame of ColorBars and Tone"
Are there any examples of something like this for me to look at?
Looks like ColorBars provides tone for me anyway...
And it doesn't matter if they are broadcast quality or not (I saw the other threads)
if I wanted to replace frame 1000
I figure it would involve Trim and ++
Something like:
0-999 ++ blip ++ 1001-End
Thanks
Guest
20th September 2012, 22:30
stream=AVISource(...) # or your source filter
start=stream.trim(...)
end=stream.trim(...)
bars=ColorBars(...) .Trim(...) # use trim to decide the length of the color bars clip
return start++bars++end
See if you can fill in the ...'s
EDIT: Added HolyWu's correction.
dwilbank
21st September 2012, 04:26
Thanks sir.
That makes it look easy indeed.
The ColorBars for 1 frame is what I'm worried about though.
Looking at this:
http://avisynth.org/mediawiki/ColorBars
I see no examples of how to set a duration.
dwilbank
21st September 2012, 04:57
aha - I was just thinking that I had to add the trim argument to it.
Thanks! I think this might work!
dwilbank
21st September 2012, 16:16
v = FFVideoSource("R:\99423_PAL.mpg",fpsnum=25000,fpsden=1000).ConvertToYUY2()
a = FFAudioSource("R:\99423_PAL.mpg")
(HasAudio(a)==true) ? AudioDub(v,a).GetChannels(1,2) : v
Dub=AudioDub(v,a)
start = Dub.trim(0, 1247)
end = Dub.trim(1249, 0)
bars=ColorBars(720,576).ConvertToYUY2().Trim(0,-1).AssumeFPS(25, 1, true)
ResampleAudio(bars,48000)
start ++ bars ++ end
Good sirs, I've been following VirtualDub's suggestions, and it tells me to resample audio, but apparently I have it in the wrong place.
What's the theory here? I also tried it a few other places as well but VirtualDub still doesn't like it.
Thanks
Guest
21st September 2012, 16:36
Give us the exact VirtualDub error message and tell us when it occurs.
martin53
21st September 2012, 20:04
Are you aware, that line3 and line 8
(HasAudio(a)==true) ? AudioDub(v,a).GetChannels(1,2) : v
...
ResampleAudio(bars,48000)
define the implicit clip "last" and that no following lines use this?
Your script generates a "filter graph", that is, output-input connections between filters. The connecting lines have names, these are the clip variables you define. By referencing the variable, you connect the previously defined output to an input. When you play the clip, the frames are requested from the final output, i.e. the end of the script, upwards. Start and end in the last line request frames from Dub, which requests frames from a and v - but not from lines 3, nor 8.
Please consider completing these lines tov = (HasAudio(a)==true) ? AudioDub(v,a).GetChannels(1,2) : v
...
bars = ResampleAudio(bars,48000)
You are allowed to re-define the variables v and bars in this way. References to these names downward the script will simply use the last definition.
But I don't know what audio you expect from the one ColorBars frame. If you expect the audio to continue over that frame, I think the easier way is: do all the trimming and splicing before you use AudioDub. Like
v = FFVideoSource("R:\99423_PAL.mpg",fpsnum=25000,fpsden=1000).ConvertToYUY2()
a = FFAudioSource("R:\99423_PAL.mpg")
start = v.trim(0, 1247)
end = v.trim(1249, 0)
bars = ColorBars(720,576).ConvertToYUY2().Trim(0,-1).AssumeFPS(v.Framerate(), 1, true)
Splice = start ++ bars ++ end
(HasAudio(a)==true) ? AudioDub(Splice,a).GetChannels(1,2) : Splice
(please note that I am unexperienced with FFAudioSource() and did not understand or check that part of your script)
dwilbank
21st September 2012, 23:44
Thanks sirs.
Got it working using an mpg clip instead of ColorBars, but will definitely try the changes you listed above!
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.