• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ffmpeg and php video conversion

Explorer ,
Jun 02, 2011 Jun 02, 2011

Copy link to clipboard

Copied

Hello

I have recently been trying to covert uploaded video into flv so that its playable on a flash player. I trying to use ffmpeg which is installed

on my hosting plan server.

I have been able to grab thumbnails using ffmpeg but now need to convert the video into flv. The code I have does a conversion but the

file is 0kb when its outputted to the Videos folder;

This is the code:

$src = "Videos/robot.avi";
$output = "Videos/robot.flv";
$ffmpegPath = "ffmpeg";
$flvtool2Path = "flvtool2";

$ffmpegObj = new ffmpeg_movie($src);

$srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
$srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
$srcFPS = $ffmpegObj->getFrameRate();
$srcAB = intval($ffmpegObj->getAudioBitRate()/1000);
$srcAR = $ffmpegObj->getAudioSampleRate();

exec($ffmpegPath . " -i " . $src . " -ar " . $srcAR . " -ab " . $srcAB . " -vcodec wmv1 -acodec adpcm_ima_wav -s " . $srcWidth . "x" . $srcHeight . " " . $output. " | " . $flvtool2Path . " -U stdin " . $output);

// Make multiples function
function makeMultipleTwo ($value)
{
$sType = gettype($value/2);
if($sType == "integer")
{
return $value;
} else {
return ($value-1);
}
}

I dont have flvtools but they are not nessary as they only collect meta data.

Thank you,

TOPICS
ActionScript

Views

203.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 02, 2011 Jun 02, 2011

Copy link to clipboard

Copied

I've got a feeling that this topic may be a little out of place here.

Have you had a look at PHPMotion, a free, open source video upload/conversion/sharing script?

http://www.phpmotion.com/

You could download and take it apart to see how it works... it's free and won't cost you anything to at least look at it.

I use it on one of my sites for file conversion and it seems to work just fine.

Best wishes,

Adninjastrator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 02, 2011 Jun 02, 2011

Copy link to clipboard

Copied

Hello

Thanks alot for the reply. I have check out the phpmotion it seems really good but I really need to use ffmpeg. The reason is I have a hosting plan that has ffmpeg installed on the server which works well with my exsisting code. I have already used ffmpeg to grab thumbnail every time some one uploads a file but now I just need to convert uploaded files into flv. The code I uploaded does that but the converted file for some reason is 0 kb when inside folder.


Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 02, 2011 Jun 02, 2011

Copy link to clipboard

Copied

PHPMotion is ffmpeg based and is open source.

My suggestion was to download the source code and see how they use it for file conversion.

Best wishes,

Adninjastrator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 03, 2011 Jun 03, 2011

Copy link to clipboard

Copied

Hi

Thank again for the reply. I am trying to download php motion to check it out. I have actually made an video conversion with the

code above but for some reason the coverted file is 0KB.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 03, 2011 Jun 03, 2011

Copy link to clipboard

Copied

OK, Good.

Another place to check for info is:

http://www.ffmpeg.org/

and there are a number of pretty smart folks over at:

http://forum.videohelp.com/forums/11-Video-Conversion

Best of luck!

Adninjastrator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 07, 2011 Jun 07, 2011

Copy link to clipboard

Copied

LATEST

Hi

Thanks for the reply. I have registers with http://forum.videohelp.com/forums/11-Video-Conversion

and have been recieving some replies.I still have not solved the problem so any help is appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines