dqcj32855
dqcj32855
2015-04-28 12:53

FFMpeg在命令行中工作,但不在shell_exec中工作

已采纳

When I convert a video using command line(ffmpeg -i dust.mp4 -s 320x240 video.flv 2>&1) it does the conversion fine. But when I use the php code it does not. The code is as follows:

echo "Starting ffmpeg...

";
$ffmpeg = "~/ffmpeg_sources/ffmpeg";
echo exec("$ffmpeg  -i dust.mp4 -s 320x240 video.flv 2>&1");
echo "Done.
";

And the output is :

Starting ffmpeg... sh: 1: ~/ffmpeg_sources/ffmpeg: not foundDone.

Any help will be appreciated.

Thanks in advance

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • doulao7998636570 doulao7998636570 6年前

    I have already answered for this same question just look at that answer,you will know what n=mistake you done.

    For Video Thumbnail creation we use ffmpeg.

    In Linux Systems(centos 6.x) Ffmpeg installation process and Php example:-

    This process is done in my centos 6 and created thumbnails using php.

    Just click on this link Ffmpeg for video thumbnail creation

    点赞 评论 复制链接分享
  • dougong7850 dougong7850 6年前

    Use the full path:

    echo exec("/root/example/ffmpeg_sources/ffmpeg -i /home/site/etc/dust.mp4 -s 320x240 /home/site/etc/video.flv 2>&1");
    

    Make sure php has read/execute permissions to:

    /root/example/ffmpeg_sources/ffmpeg
    

    write permissions in:

    /home/site/etc/

    And read permissions to:

    /home/site/etc/dust.mp4
    
    点赞 评论 复制链接分享

为你推荐