need help for FFMPEG

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    need help for FFMPEG

    i use this code for getting preview of videos in a directory/folder..but i m getting error
    Code:
    <?php
    $dir = "/full path to directory/";
    $thumb_dir = "/full path to directory for thumbnails/";
    if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
            while (($file = readdir($dh)) !== false) {
    $file=str_replace(" ", "\ ", $file);
    $file=str_replace("-", "\-", $file);
    $file=str_replace("(", "\(", $file);
    $file=str_replace(")", "\)", $file);
    echo $file."<br/>";
    //$file=str_replace("'", "\ ", $file);
                $ext = strtolower(end(explode('.', $file)));
                if($ext=='mp4')
                   exec("/usr/local/bin/ffmpeg -itsoffset -105 -i ".$dir.$file."  -vcodec mjpeg -vframes 1 -an -f rawvideo -s 100x100 ".$thumb_dir.$file.".jpg");
            }
            closedir($dh);
        }
    }
    ?>
    error i m getting

    Strict Standards: Only variables should be passed by reference in H:\xampp\htdocs\ffmpeg.php on line 13
    ..

    Strict Standards: Only variables should be passed by reference in H:\xampp\htdocs\ffmpeg.php on line 13


    pls help....i want to generate thumbnails from videos with same name..i.e girl.mp4 to girl.mp4.jpg

    #2
    PHP Code:
    <?php
    $dir 
    "/full path to directory/";
    $thumb_dir "/full path to directory for thumbnails/";
    if (
    is_dir($dir)) {
        if (
    $dh opendir($dir)) {
            while ((
    $file readdir($dh)) !== false) {
    $file=str_replace(" ""\ "$file);
    $file=str_replace("-""\-"$file);
    $file=str_replace("(""\("$file);
    $file=str_replace(")""\)"$file);
    echo 
    $file."<br/>";
    //$file=str_replace("'", "\ ", $file);

                
    $ext end(explode('.'$file));
                
    $ext strtolower($ext);
    ///the problem was right at the top of this
                
    if($ext=='mp4')
                   
    exec("/usr/local/bin/ffmpeg -itsoffset -105 -i ".$dir.$file."  -vcodec mjpeg -vframes 1 -an -f rawvideo -s 100x100 ".$thumb_dir.$file.".jpg");
            }
            
    closedir($dh);
        }
    }
    ?>
    Mobile chat, iphone chat, android chat, chat, rooms http://www.aiochat.com

    Comment


      #3
      thanks bro but still m getting same error!!

      Comment


        #4
        I'm not sure what you are trying to achieve by this line
        PHP Code:
        $file=str_replace("'""\ "$file); 
        But the backslash escapes the double quotes. That line should be
        PHP Code:
        $file=str_replace("'""\""$file); 
        or maybe
        PHP Code:
        $file=str_replace("'"" "$file); 
        depending on what you want to replace with
        libra.wen.ru

        Comment

        Working...
        X