SMurf
15th August 2012, 02:42
Hello,
This may be the wrong tool for doing this, but I have a need to set up a MPC playlist of videos interspersed with slideshows featuring an audio track. This will run full screen on a display in a waiting room. The images used in the slideshows will change regularly, so I don't think it's a good idea to try to produce a single large video from the playlist every time.
I installed Avisynth and created a simple user-defined function to load an image, scale/center it to the screen size and show it for three seconds:-
function SlideImage(string image)
{
scrW = 1920
scrH = 1200
duration = 3
img = ImageSource(image, end=1, fps=1)
img = ((Float(scrW) / img.width) < (Float(scrH) / img.height)) ? Spline64Resize(img, scrW, Round((Float(scrW) / img.width) * img.height)) : Spline64Resize(img, Round((Float(scrH) / img.height) * img.width), scrH)
img = AddBorders(img, (scrW - img.width) / 2, (scrH - img.height) / 2, (scrW - img.width) / 2, (scrH - img.height) / 2)
img = AddBorders(img, 0, 0, scrW - img.width, scrH - img.height)
return Loop(img, duration)
}
I called this function a few times in the script, splicing the result into a clip variable called "video" and finished off with:-
return AudioDub(ChangeFPS(video, 25), DirectShowSource("bg.ogg"))
I had to change the frame rate to 25 fps because otherwise MPC displays nothing (but still plays the audio). Might be something to do with the VMR renderer, I don't know.
Although this works, it seems to lag and consume a ridiculous amount of memory. I believe this is because Avisynth is storing each frame in memory to allow seeking. Given the size of each frame this isn't practical! :o
I would prefer it if Avisynth produced non-indexed (not seekable) output, discarding each rendered frame. Is there a way to do this, or am I using the wrong software?
This may be the wrong tool for doing this, but I have a need to set up a MPC playlist of videos interspersed with slideshows featuring an audio track. This will run full screen on a display in a waiting room. The images used in the slideshows will change regularly, so I don't think it's a good idea to try to produce a single large video from the playlist every time.
I installed Avisynth and created a simple user-defined function to load an image, scale/center it to the screen size and show it for three seconds:-
function SlideImage(string image)
{
scrW = 1920
scrH = 1200
duration = 3
img = ImageSource(image, end=1, fps=1)
img = ((Float(scrW) / img.width) < (Float(scrH) / img.height)) ? Spline64Resize(img, scrW, Round((Float(scrW) / img.width) * img.height)) : Spline64Resize(img, Round((Float(scrH) / img.height) * img.width), scrH)
img = AddBorders(img, (scrW - img.width) / 2, (scrH - img.height) / 2, (scrW - img.width) / 2, (scrH - img.height) / 2)
img = AddBorders(img, 0, 0, scrW - img.width, scrH - img.height)
return Loop(img, duration)
}
I called this function a few times in the script, splicing the result into a clip variable called "video" and finished off with:-
return AudioDub(ChangeFPS(video, 25), DirectShowSource("bg.ogg"))
I had to change the frame rate to 25 fps because otherwise MPC displays nothing (but still plays the audio). Might be something to do with the VMR renderer, I don't know.
Although this works, it seems to lag and consume a ridiculous amount of memory. I believe this is because Avisynth is storing each frame in memory to allow seeking. Given the size of each frame this isn't practical! :o
I would prefer it if Avisynth produced non-indexed (not seekable) output, discarding each rendered frame. Is there a way to do this, or am I using the wrong software?