Jump to content

FFMPEG help


rmail2006

Recommended Posts

Sorry if this is in the wrong section, wasn't too sure.

 

I have been running FFMPEG on Windows 7 using Xampp.

 

It's all set up and I can read the Wildlife.wmv file but it doesn't convert it.

 

Here's my code:

 

<?php    // Set our source file    $ffmpegPath = "C:\xampp\ffmpeg\ffmpeg.exe";    $flvtool2Path = "C:\xampp\flvtool2\flvtool2.exe";    // Create our FFMPEG-PHP class    $ffmpegObj = new ffmpeg_movie('C:\xampp\htdocs\Video\uploads\Wildlife.wmv');    // Save our needed variables    $srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());    $srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());    $srcFPS = $ffmpegObj->getFrameRate();    $srcAB = intval($ffmpegObj->getAudioBitRate()/1000);    $srcAR = $ffmpegObj->getAudioSampleRate();    // Call our convert using exec()    exec("ffmpeg -i wildlife.wmv -ar 22050 -ab 32 -f flv -s 1280x720 wildlife.flv");    // Make multiples function    function makeMultipleTwo ($value)    {    $sType = gettype($value/2);    if($sType == "integer")    {    return $value;    } else {    return ($value-1);    }    }?>

 

 

I've heard people mentioning the exec might not be working. Is there anyway to get it working if so?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/215630-ffmpeg-help/
Share on other sites

I've Cut down my code and added a check and it turns out the exec is working but its always failing.

 

 

<?php    exec("C:\xampp\ffmpeg\ffmpeg -i C:\xampp\htdocs\Video\video.wmv -ar 22050 -ab 32 -f flv -s 1280x720 C:\xampp\htdocs\Video\video.flv");    if ($result !== 0) {        echo 'Command failed!<br>';        print_r($command_output);        die();    }    echo 'success!';    print_r($command_output);?>

 

Link to comment
https://forums.phpfreaks.com/topic/215630-ffmpeg-help/#findComment-1121150
Share on other sites

Me again. I got the ffmpeg to convert my file from wmv to flv and it plays great but when it converts it it still comes up saying Command Failed!

 

<?php
    exec('C:\xampp\ffmpeg\ffmpeg.exe -i C:\xampp\htdocs\Video\video.wmv -ar 22050 -ab 32 -f flv -s 1280x720 C:\xampp\htdocs\Video\video.flv');
    echo $result.'<br/>';
    if ($result !== 0) {
        echo 'Command failed!<br>';
        print_r($command_output);
        die();
    }

    echo 'success!';
    print_r($command_output);
?>

 

The problem is $result has no value in it when done so it will always say Command failed!

 

Is there a proper way to check if it has converted?

 

And the error before was the command to be executed should be wrapped in single quotations not double :)

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/215630-ffmpeg-help/#findComment-1121216
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.