convert video

Discussion in 'PHP' started by gaurang24, Jan 5, 2012.

  1. #1
    hi.

    i'm using this code for video convert mp4 to flv.

    but out put come in 0kb.

    <?php
    $srcFile = "upload_v/El-Bahia-Video.mp4";
    $destFile = "upload_v/El-Bahia-Video.flv";
    $ffmpegPath = "/usr/bin/ffmpeg";
    $flvtool2Path = "/usr/bin/flvtool2";
    // Create our FFMPEG-PHP class
    $ffmpegObj = new ffmpeg_movie($srcFile);
    // 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($ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile);


    /*exec($ffmpegPath." -i " . $srcFile ." -ar " . 22050 ." -ab ". 32 . " -f flv -s " . $srcWidth . "x" . $srcHeight .$destFile);*/
    // Make multiples function
    function makeMultipleTwo ($value)
    {
    $sType = gettype($value/2);
    if($sType == "integer")
    {
    return $value;
    } else {
    return ($value-1);
    }
    }
    ?>
     
    gaurang24, Jan 5, 2012 IP
  2. Icecube_media

    Icecube_media Peon

    Messages:
    656
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    hi
    thanks but these day video converting is easy. one can use total video converter.
     
    Icecube_media, Jan 5, 2012 IP
  3. gaurang24

    gaurang24 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hi..

    i want to convert video in php and use ffmpeg for video convert.

    how can we get proper out put.

    i'm using above code for video convert.
     
    gaurang24, Jan 5, 2012 IP