VideoHelp Forum
Closed Thread
Results 1 to 2 of 2
Thread
  1. Member
    Join Date
    Jun 2011
    Location
    London
    Search Comp PM
    Hi

    I am trying to convert videos in some format into flv using ffmpeg. The converted video that is create is 0 kb. I need some help to get it working thanks.

    This is the code:

    <?Php


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

    $srcFile = "Videos/robot.avi";
    $destFile = "Videos/robot.flv";
    $ffmpegPath = "ffmpeg";
    $flvtool2Path = "flvtool2";


    $ffmpegObj = new ffmpeg_movie($srcFile);


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


    $command = $ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile;
    $convert = exec($command);



    if(!$convert){
    echo "FAILED!!!";
    }

    ?>

    I must say I do not have flvtools on my server but I guess it does not matter as flvtools is only used for getting meta data.

    Thanks.

  2. Mod Neophyte Super Moderator redwudz's Avatar
    Join Date
    Sep 2002
    Location
    USA
    Search Comp PM
    Tonybot, Do not post the same topic on several forums.
    Please do not cross post, once is enough.

    Continue in: https://forum.videohelp.com/threads/335647-php-ffmpeg-video-conversion

    Moderator redwudz




Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!