nLL

Mobile web, .Net, Android, gadgets and some random stuff

On the fly video encoding with classic ASP and ffmpeg

Update: For more advanced .Net C# version of this see http://nolovelust.com/post/Another-Simple-C-Wrapper-For-FFmpeg.aspx

 

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;




latest Ffmpeg (Win32 Shared build with devel libs includes VHooks) from http://ffmpeg.arrozcru.org/builds/


access to your server to set application pool of your site to run as local service (iis manager>application pools>your site's pool>properties>identity > predefined> local system.

Keep in mind that with this setting is a big security compromise, I would isolate it and close access from the internet.


a simple transparent logo in png format to insert in to video



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

On the fly video thumbnailing with Movie Thumbnailer & Classic Asp

Update: For more advanced .Net C# version of this see http://nolovelust.com/post/Another-Simple-C-Wrapper-For-FFmpeg.aspx

 

Here is another simple code to get thumbnails of uploaded videos.

You need to;

Get MTN from http://moviethumbnail.sourceforge.net/index.en.html 
Extract it in a folder called thumbnailer under your web root 
Get ASPEXEC.rar (135.80 kb). Install aspexec.dll to your server (regsvr32 %pathtodll%) 

Create an upload script with your favorite upload component

Edit your upload script and insert below code after upload process

thumbnailpath=Server.Mappath("thumbnails")

Set objExecutor = Server.CreateObject("ASPExec.Execute")

objExecutor.Application = Server.Mappath("thumbnailer/mtn.exe")

objExecutor.TimeOut = 9000

objExecutor.Parameters = "-b 1 -j 100 -o .jpg -c 1 -r 1 -i -t -P -w 0 -O "&thumbnailpath&"\thumbnail.jpg"

objExecutor.ShowWindow = False

Set objExecutor = Nothing

 

Open source ASP - WAP mobile web site with forums, chat rooms and instant messaging

This is a wap site source code written in asp and wml. This code is a starter level wap site for people who wants to build their own wap/mobile internet community. If you don't know what i am talking about don't bother to download it. But if you know about wml,wap,mobile internet,hosting etc. this application would be quite fun for you. It has been running on various wap sites since 2004. 


How to / Installation
Open all .asp files and replace MySiteName string with your site name; you can use Editplus text editor to do that.
If you want to change forum names open default.asp and find "sub gbv" and there change Forum1,Forum2... to your forum names. You can add unlimited forums.
If you want to chat room names, find "sub csec" and change room names. You can add unlimited chat rooms.
Admin page is admin.asp and default pw is "admin" to change it find "sub checklogin" in admin.asp and change it to what ever you want.
adminRenamer.asp is a security measure and lets you to rename admin.asp whenever you want. There is no special software needed to run this application. All you need is a windows based hosting and 5-10 mb space.
In addition, you might want to cheek if you have read/write access to Ms Access database files. Without it site will not work.
Once you have uploaded it use your phone or a wml editor software to access your site. This application released under GNU General Public License (GPL).
You cannot sell or claim money out of this application.
Although it is not necessary, i would like you to mention my site or nick name in your wap site.

Features
Main features are Forums,Chat room and Instant messaging.
Admin section allows you to delete forum posts,ban users.
There are some other small stuff but i don't have time to explain here and it is pretty basic to find out. 

FAQ Answers
Yes site only for mobile phones.
Well if you don't know how to use your phone for internet access you shouldn't be reading this.
No, there could be no colour on wml and this is wml.
Yes you can easily broke the source if you do not know what you doing.
Yes, source is too messy and full off bugs but it has been running on many sites over 3 years.
Yes, it can slow down your server if you have more than 10-12 people online at same time.
No there is no SQL version. Download asp wap site

site.zip (148.72 kb)

siteadvanced.zip (341.66 kb)