First step to create a video sharing library we need to have
all videos in a FLV flash format in order to play them on webpage,
Sounds familiar, yeah the famous youtube.com does that, how exactly we can do something similar to youtube?
How to convert files uploaded by people in FLV format?
There are different open source tools available for
converting different formats of videos to other formats, unfortunately there
are issues and bugs in these tools, and less support, we can not use one tool for convert videos in FLV format, we have to mix two different tools for this purpose, below are the steps how can
we achieve that using FFMPEG and FLVTOOL.
Step # 1:
Download FFMPEG (search it on Google, download it build it)
Download FLVTOOL (search it on Google, download it build it)
Or simply download my pre build copy from
·
http://www.filefactory.com/file/b131a99/n/sample.3gp
http://www.filefactory.com/file/b131bgf/n/beelden.zip
Extract following in a folder, (I supposed d:\ffmpeg
folder)
Step # 2:
Run following command-line commands form your programming
language exp C#.
1)
Convert to AVI first
because some formats are not directly convert able into FLV
D:\FFmpeg>ffmpeg
-i sample.3gp -s 470X320 -ar 44100 s22.avi
2)
Take snap from video file
D:\FFmpeg>ffmpeg
-i s22.avi -ss 3 t11.jpg
3)
Convert to required FLV
format
D:\FFmpeg>ffmpeg
-i s22.avi -s 470X320 t11.flv
4)
fix errors using flvtool
D:\FFmpeg\>flvtool2 -UP t11.flv out2.flv
Step # 3
Download FW flash player (search it from Google)
Extract it into the same folder
Step # 4
Create a new HTML file and paste and save the following code:
<html>
<body>
<script type='text/javascript'
src='swfobject.js'><script>
<div id='Div1'
style="border:solid:2px:black">
<div id='mediaspace'>This text will be replaced<div>
<div>
<script type='text/javascript'>
var so = new SWFObject('player.swf','ply','468','348','9','#ffffff');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess',
'always');
so.addVariable('image',
't11.jpg');
so.addVariable('skin',
'beelden.zip');
so.addParam('wmode','opaque');
so.addVariable('file','out2.flv');
so.write('mediaspace');
<script>
<body>
<html>
Step # 5
Preview your newly saved HTML in web browser.
No comments:
Post a Comment