NerdWithNoLife
14th October 2010, 20:03
Hello. I'm trying to use AviSynth for something it was never designed to do, and not surprisingly have run into some problems. Hopefully a clever doom9's forum member can help me find a solution. The intent is to source a cheezy (public domain) film and my camera's input, and create Mystery Science Theater style silhouette effect - on the fly - for a live web show. Unfortunately, an audio sync issue has appeared, especially when the CPU is being taxed.
I am using this insane setup because: A) Budget is an issue so dropping cash on VidBlaster or Wirecast or a faster PC can only be done after exhausting other options. B) To do a live show, pre-capturing isn't an option.
Probably what's happening is when the processor gets too bogged down for realtime it continues playing the audio while waiting for the video, or the opposite. Since this effects work is being done on top of encoding live video, I'm very CPU conscious and have found the line where the CPU is at 70-90%, and try not to do anything special. The less I do, the better it stays in sync.
The workflow is: An AviSynth script that does this effects work and creates anamorphic video behind the back of >> ManyCam, which acts as the switcher then off to >> Adobe's Flash Media Live Encoder, which resizes and encodes a proper 1:1 16:9 live video. Here's the script:
## Assign image of theater seats
seats=ImageSource("seats.png",pixel_type="rgb32")
## Assign movie of the week
## Since this is an example we'll use a blue clip instead
#Cheese=AviSource("Gorilla-AVI.avi").ConvertToRGB32().AddBorders(40,0,40,0)
Cheese=Blankclip(seats,color=$0000FF).PointResize(240,240).AddBorders(40,0,40,0)
## Load live video from filter graph. The result is 30000/1001fps RGB.
## Since this is an example we'll comment that line out and use a sample image instead:
# DirectShowSource("live.grf",framecount=216000,audio=false)
ImageSource("Cam.png",pixel_type="RGB32")
## Clip "almost whites", consider everything else black
Greyscale().Levels(0,1,200,0,255)
Levels(254,1,255,0,255)
## Cropping so there's not a black line on the top
Crop(0,4,0,0)
## Shrink me
ConvertToRGB32().BilinearResize(100,76)
## Assign this to clip Cam
Cam=last
## Layer and position my silhouette over the movie
Layer( Cheese , Mask( Blankclip(Cam) ,Cam.Invert()) , x=186,y=164)
## Layer a row of movie seats on top of that
Layer(last,seats,x=-14)
The result looks like this:
http://img834.imageshack.us/img834/9982/examplel.png (http://img834.imageshack.us/i/examplel.png/)
Here are enough files to demonstrate it "working":
http://www.mediafire.com/?1y9hf0lwy8d9nnc
So knowing this is less than ideal, is there even a way to force AviSynth to operate in realtime, dropping frames or pausing if need be, but staying in sync? I'm interested to hearing some suggestions before I spend more money on software / equipment.
I am using this insane setup because: A) Budget is an issue so dropping cash on VidBlaster or Wirecast or a faster PC can only be done after exhausting other options. B) To do a live show, pre-capturing isn't an option.
Probably what's happening is when the processor gets too bogged down for realtime it continues playing the audio while waiting for the video, or the opposite. Since this effects work is being done on top of encoding live video, I'm very CPU conscious and have found the line where the CPU is at 70-90%, and try not to do anything special. The less I do, the better it stays in sync.
The workflow is: An AviSynth script that does this effects work and creates anamorphic video behind the back of >> ManyCam, which acts as the switcher then off to >> Adobe's Flash Media Live Encoder, which resizes and encodes a proper 1:1 16:9 live video. Here's the script:
## Assign image of theater seats
seats=ImageSource("seats.png",pixel_type="rgb32")
## Assign movie of the week
## Since this is an example we'll use a blue clip instead
#Cheese=AviSource("Gorilla-AVI.avi").ConvertToRGB32().AddBorders(40,0,40,0)
Cheese=Blankclip(seats,color=$0000FF).PointResize(240,240).AddBorders(40,0,40,0)
## Load live video from filter graph. The result is 30000/1001fps RGB.
## Since this is an example we'll comment that line out and use a sample image instead:
# DirectShowSource("live.grf",framecount=216000,audio=false)
ImageSource("Cam.png",pixel_type="RGB32")
## Clip "almost whites", consider everything else black
Greyscale().Levels(0,1,200,0,255)
Levels(254,1,255,0,255)
## Cropping so there's not a black line on the top
Crop(0,4,0,0)
## Shrink me
ConvertToRGB32().BilinearResize(100,76)
## Assign this to clip Cam
Cam=last
## Layer and position my silhouette over the movie
Layer( Cheese , Mask( Blankclip(Cam) ,Cam.Invert()) , x=186,y=164)
## Layer a row of movie seats on top of that
Layer(last,seats,x=-14)
The result looks like this:
http://img834.imageshack.us/img834/9982/examplel.png (http://img834.imageshack.us/i/examplel.png/)
Here are enough files to demonstrate it "working":
http://www.mediafire.com/?1y9hf0lwy8d9nnc
So knowing this is less than ideal, is there even a way to force AviSynth to operate in realtime, dropping frames or pausing if need be, but staying in sync? I'm interested to hearing some suggestions before I spend more money on software / equipment.