Requirements for a Video Website

June 23rd, 2008 by Sajith M.R

If you are planing to start a video website like youtube, here is some things to keep in mind.

FLV PLAYER
========

You know in now a days most of the video streaming websites use flash player for video streaming. The video file is in flv format. So you need a flash video player for this purpose.
You can download a free flash / flv player from : http://www.jeroenwijering.com/?item=JW_FLV_Player
or http://flowplayer.org/

FORMAT CONVERSION
===============

Now you need videos in flv file format. In normal cases, most of the videos uploaded by an user will be in avi, dat ,mpg,mp4 or 3gp. So you need a flv converter. You can use either ffmpeg library or mencoder for this purpose

Here is a sample video emmbedding method.



codebase=”http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0″
width=”450″ height=”375″ id=”/YouTube_video/youtube” align=”middle”>




bgcolor=”#ffffff” width=”450″ height=”375″ type=”application/x-shockwave-flash”
pluginspage=”http://www.macromedia.com/go/getflashplayer” />;

Here src parameter points the swf file, the flash palyer and video parameter points the flv file. This is the format of player i used in http://www.amvizone.com

ffmpeg also can be used for making thumbnails and video watermarking

STORAGE and BANDWIDTH
=====================

Where would you save flv files. In yourown server ? If there is a minimum number of videos, your server might handle it. But consider the case having a large number of videos, your server bandwidth will get used soon. So we have to switch into a CDN (Content Data Network) like amazone S3. What you have to do is just register with any CDN website and use their webservices for uploading and manipulating your video files. These CDN have very reasonable cost for the bandwidth usage and storage space.

Comment here if any queries
Regards

Sajith M.R

ffmpeg sample code

June 12th, 2007 by Sajith M.R

ffmpeg.jpg

Install ffmpeg library in your server first.

Place a video file of any type on current directory (or anywhere), here it is clock.avi .

Click more for source code:

extension_loaded('ffmpeg') or die('Error in loading ffmpeg');

$ffmpegInstance = new ffmpeg_movie('clock.avi');
echo "getDuration: " . $ffmpegInstance->getDuration() .
"getFrameCount: " . $ffmpegInstance->getFrameCount() .
"getFrameRate: " . $ffmpegInstance->getFrameRate() .
"getFilename: " . $ffmpegInstance->getFilename() .
"getComment: " . $ffmpegInstance->getComment() .
"getTitle: " . $ffmpegInstance->getTitle() .
"getAuthor: " . $ffmpegInstance->getAuthor() .
"getCopyright: " . $ffmpegInstance->getCopyright() .
"getArtist: " . $ffmpegInstance->getArtist() .
"getGenre: " . $ffmpegInstance->getGenre() .
"getTrackNumber: " . $ffmpegInstance->getTrackNumber() .
"getYear: " . $ffmpegInstance->getYear() .
"getFrameHeight: " . $ffmpegInstance->getFrameHeight() .
"getFrameWidth: " . $ffmpegInstance->getFrameWidth() .
"getPixelFormat: " . $ffmpegInstance->getPixelFormat() .
"getBitRate: " . $ffmpegInstance->getBitRate() .
"getVideoBitRate: " . $ffmpegInstance->getVideoBitRate() .
"getAudioBitRate: " . $ffmpegInstance->getAudioBitRate() .
"getAudioSampleRate: " . $ffmpegInstance->getAudioSampleRate() .
"getVideoCodec: " . $ffmpegInstance->getVideoCodec() .
"getAudioCodec: " . $ffmpegInstance->getAudioCodec() .
"getAudioChannels: " . $ffmpegInstance->getAudioChannels() .
"hasAudio: " . $ffmpegInstance->hasAudio();

//___________________________________Code end here_____________________________________

I also can be used for file format conversion

Eg: exec(’ffmpeg -i ‘.$SourcePath.’ ‘.$Destination);

Here $SourcePath any file of any format , and destionation also another format.

eg: exec(’ffmpeg -i saji.3gp saji.flv’);