Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Nov 2007
    Leeds, UK
    Thanked 19 Times in 19 Posts

    PHP FFMEPG Encoding to FLV not encoding but no error

    My Server allows the system command and has got all of the ffmepg files required install i used the ffmpeg-installer

    but for some reason i cant get ffmpeg to encode the files now this script is copied from another site in google after my way would not work and i get the same result can any one provide some insight into why this is not working?
    PHP Code:
    function encodeFile($srcFile){
    $ext end(explode('.',$srcFile));
    $destFile str_replace($ext'flv'$srcFile);
    $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);
    // Make multiples function
    function makeMultipleTwo ($value)
    $sType gettype($value/2);
    $sType == "integer")
        } else {
        return (
    /* The Video has changed and needs reencoding */
    $folderPath "";
    $path explode('/'$_SERVER['SCRIPT_FILENAME']);
    $i 0$i count($path); $i++){
    $i != (count($path)-1) && $i != (count($path)-1)){
    $folderPath .= $path[$i]."/";
    $folderPath .= "files/flash/";
    $target_path "";
    $names explode('.'$_FILES['tabVideo']['name']);
    $i 0$i count($names) -1$i++){
    $filenameTemp_1 .= $names[$i];
    $filenameTemp_1 .= time().".".end(explode('.'$_FILES['tabVideo']['name']));
    $target_path $folderPath $filenameTemp_1 
    move_uploaded_file($_FILES['tabVideo']['tmp_name'], $target_path);
    $tmp end(explode('.'$_FILES['tabVideo']['name']));
    $tmp str_replace($tmp'flv'$_FILES['tabVideo']['name']);
    $sql "UPDATE `flash_content` SET `video`='/files/flash/".$tmp."' WHERE `id`='2'";
    $sql "UPDATE `flash_content` SET `title`='".$_POST['tabContentTitle']."' AND `text`='".$_POST['tabContent']."' WHERE `id`='11'";
    header("Location: index.php?state=home");

    And the file is being saved to the filepath provided /files/flash/video.avi
    Last edited by barkermn01; 01-26-2010 at 06:25 PM.
    Working towards a Internet where we don't have website just browser applications Kill the Hyper-link and say hello to 3D Games in the browser :)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts