Recently I did a project to create an application for a big winter vacation agency. It is photo and video uploading website, where people can upload photos/videos and have their friends vote on them. Photo part is easy, what interesting is the video part. I thought it would be as simple as uploading mp3 files and create flash player to load whatever people have uploded, as my colleague told me, but then I realized that it is not as simple as handling mp3 files because videos have to be converted to FLV in order for flash player to play the video.
I've done a lot of research but I can't find how to stream WMV, MPG directly from flash, they have to be converted to FLV first. I found a really useful tool that can be used to convert almost any video file to FLV, or to image (JPG, PNG, etc.). It is called ffmpeg, it is an executable file (.EXE). The problem is that it is not a good idea to grant permission for ASP.NET account on the server to be able to run executable file. If people find out about this, then your server is in danger, because people can execute command to format your harddrive, for example.
The solution was to create a simple windows service program or you can also make desktop application to handle all the video convertion process. The code is shown below:
You probably wonder what flvtool is. We use flvtool to index the FLV file in order to add the correct metadata inside FLV file.
This is actually a simple form of a youtube-like application. You let people upload videos, convert them to FLV and create thumbnails for the preview. However, this kind of technique doesn't work in a shared hosing environment because you usually can't install any program on the server.