Solved

uploaded video convert into flv

Posted on 2011-09-19
7
508 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

751 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