Solved

uploaded video convert into flv

Posted on 2011-09-19
7
502 Views
Last Modified: 2012-05-12
i am using "ffmpeg" encoder to convert video file into flv format but not able to succeed. can anyone help me with PHP Script to convert video file into FLV.
0
Comment
Question by:BhavinKrish
7 Comments
 
LVL 8

Expert Comment

by:psychogr
ID: 36565177
0
 
LVL 7

Expert Comment

by:boon86
ID: 36565281
try:
                   
    //convert video
						if($video_resize == '1')
						{
							$encodecommand = "/usr/local/bin/mencoder /path/to/your/input/video.mpg -o /path/to/your/output/video.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=750:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -vop scale=450:320 -srate 48000";
						}
						else 
						{
							$encodecommand="/usr/local/bin/mencoder /path/to/your/input/video.mpg -o /path/to/your/output/video.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=750:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -srate 48000";
						}

                        exec($encodecommand, $output); 

			            //get video duration
						exec("/usr/local/bin/mplayer -vo null -ao null -frames 0 -identify /path/to/your/input/video.mpg", $difh);
    					while (list($k,$v)=each($difh))
    					{
        	    			if ($length = strstr($v,'ID_LENGTH='))
        	    				break;
    					}
						
    					$lx = explode("=",$length);
    					$runtime = $lx[1];

Open in new window


i used mplayer + mencoder for above example.  following is php.ini setting that required:

max_execution_time = 3600
max_input_time = 3600
safe_mode off
open_basedir off
exec() should be allowed
register_argc_argv on

try check above requirement on phpinfo.php
<?php
phpinfo();
?>

hope that help
0
 

Author Comment

by:BhavinKrish
ID: 36565783
I am working on video uploading functionality. i have uploaded video files and it is stored  into flv format using below code
exec(ffmpeg -i $video -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv ".$flv_video);

Open in new window

Now i want to play this *.flv file on my web page. How can I do that?
I got embed code for swf but it is not playing flv file.
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 7

Expert Comment

by:boon86
ID: 36565810
you need to use jwplayer, here is the wizard with step by step:

http://www.longtailvideo.com/support/jw-player-setup-wizard

and download the player.swf here:

http://www.longtailvideo.com/players/

hope that help.
0
 
LVL 3

Expert Comment

by:garykristen
ID: 36565877
Hi BhavinKrish

You need to just execute command for convert video file to flv.

$pth=$JPATH_ROOT."//ffmpeg//ffmpeg.exe";
$vname=$uploadFile = Document root path.'/video_upload/videos/'.video file name."."."flv";

exec("$pth -i $dest -ar 22050 -ab 32 -f flv -s 426×234 $vname");
0
 
LVL 7

Accepted Solution

by:
boon86 earned 500 total points
ID: 36565902
if the video dont work with the player, you need to metainject the flv files, because player.swf need to read the meta header of the flv files inorder to player it and try again after you injected, there is 2 tools you can use is:

yamdi
flvtool2
 

usage:
/usr/bin/yamdi -i /path/to/your/input/video.flv -o /path/to/your/output/video.flv

or

/usr/bin/flvtool2 -Uv /path/to/your/input/video.flv  /path/to/your/output/video.flv

Open in new window

0
 

Author Closing Comment

by:BhavinKrish
ID: 36967179
good solution
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now