17 April 2008

On the fly video encoding with classic ASP and ffmpeg


Finding proper information about encoding videos uploaded to your site is quite hard. I have created couple of sites where users would upload videos and then script would take thumbnail of the video but couldn't managed to re-encode the video and/or insert a logo in it like those big companies who has the money and human power to do it.




Not anymore :). After 5 days i have managed to encode uploaded video en insert whatever i want in it. Code below can be implemented to run on the fly but it would be too much resource intensive, so i advise you to create may be an admin page where you can select uploaded videos and encode one by one.




You need;






Once you have done those settings use code below in your classic asp code to encode and insert your logo to any uploaded videos. Below code encodes videos as mobile mp4 but you can find information about detailed encoding options from http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html






<%

logo=Server.Mappath("logo.png")

encoderPath=Server.Mappath("bin")

originalFile=Server.Mappath("myfile.wmv")

encodedFile=Server.Mappath("encoded_myfile.wmv")

runme="ffmpeg.exe -i "&originalFile&" -vhook ""vhook/imlib2.dll -x 0 -y 0 -i "&logo&""" -acodec libfaac -ac 1 -ar 12000 -ab 12kb -vcodec mpeg4 -r 15 -s 240x184 -b 128kb "&encodedFile





set WShell = CreateObject("WScript.Shell")

WShell.CurrentDirectory = encoderPath

WShell.run runme, 0, TRUE

set WShell = nothing

%>




Comments:
It's very useful information about new mobile in your blog..... very interesting so i m impress......For more information about FESTIVAL

thank
 
Post a Comment





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]