sharmila
sharmila

Reputation: 39

Video player to play .avi , .flv , .swf, .mpeg videos in website

I want to play avi, flv, swf, mp4, mpeg videos [which are stored in my system] in my website.

I need swf file for the video player so that i can place videos and player.swf files in my application.

Is there a single player to play all these video formats? Please provide the links.

Upvotes: 1

Views: 6317

Answers (1)

siberiantiger
siberiantiger

Reputation: 305

You could do what YouTube does and transcode (convert the video formats of) your uploaded videos into FLV or SWF files using FFmpeg or similar software and then play the output video within the SWF player.

You can download FFmpeg from this link.

Here is a bit of code that I run from a command prompt to transcode videos into Flash;

ffmpeg -i video.mp4 -acodec libmp3lame -ab 64k -ar 22050 -ac 1 -vcodec libx264 -b:v 250k -r 30 -s 320x240 -f flv -y video.flv

"ffmpeg" is the executable file to be run. "-i video.mp4" is the input video that you want to manipulate. "-acodec" is the audio codec you wish to use, and in this case, "libmp3lame" or mp3 audio. "-ab 64k" is the audio bitrate which is set at 64kbits/s. "-ar 22050" is the audio sampling rate which is set at 22,050 hertz. "-ac 1" sets the number of audio channels ("-ac 2" will give you stereo sound or two audio channels). "-vcodec" is the video codec you want to use, which in the case of this code is "libx264" or h264. "-b:v 250k" sets the video bitrate to 250kbits/s. "-r 30" sets the frame rate to 30 fps. "-s 320x240" sets the image resolution to 320 pixels wide and 240 pixels high. "-f flv" I think sets the video format you want, which in your case should be "flv" or "swf". And finally, "-y video.flv" sets the name of the output file that you want to create.

After transcoding your videos, you can then load the output SWF or FLV file into your SWF player by adding a bit of ActionScript to your player. This link should provide you with the ActionScript that you need to play external SWFs or FLVs within your player SWF.

Alternatively, if you are using HTML5, you could simply use to HTML5 video tag as shown below to play your MP4 videos;

<video width="320" height="240" controls="controls"><source src="movie.mp4" type="video/mp4" /></video>

However, HTML5 is not yet universally supported and will not be a W3C Recommendation until around 2014. Plus, I don't think FLV and SWF videos work within the HTML5 video tag, and the formats that can be played using the HTML5 video tag varies between browsers. For example, you can play MP4 videos using the video tag in Internet Explorer 9, Google Chrome 6, and Apple Safari 5, but not Firefox 4.0 or Opera 10.6. For those two, you would have to convert them to Ogg or WebM videos.

Hope this helps.

Upvotes: 3

Related Questions