Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.