SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using exec(): Program sends output to STDERR instead of STDOUT

    I am using exec() and ffmpeg to generate thumbnails from video files. ffmpeg apparently sends its output to STDERR instead of STDOUT because the output appears in my Apache error log instead of the $out array. How can I make it send the output to STDOUT? Here's my code:

    PHP Code:
    <?php

    $out 
    = array();
    exec('path/to/ffmpeg.exe -i "path/to/some_movie.avi" -ss 00:00:10 -vframes 1 -vcodec mjpeg -f image2 "path/to/screenshot.jpg"',$out,$ret);
    echo 
    "<pre>";
    print_r($out);
    echo 
    "</pre>";
    echo 
    "Return: " $ret;

    ?>
    This echoes:

    Code:
    Array
    (
    )
    
    Return: 0

  2. #2
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    add 2>&1 to your command

  3. #3
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stereofrog View Post
    add 2>&1 to your command
    That worked. Thanks a million!


Bookmarks

Posting Permissions

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