Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

uploaded video convert into flv

Posted on 2011-09-19
7
Medium Priority
?
515 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 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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 1500 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

670 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