<tfoot id='x47g9'></tfoot>

    <i id='x47g9'><tr id='x47g9'><dt id='x47g9'><q id='x47g9'><span id='x47g9'><b id='x47g9'><form id='x47g9'><ins id='x47g9'></ins><ul id='x47g9'></ul><sub id='x47g9'></sub></form><legend id='x47g9'></legend><bdo id='x47g9'><pre id='x47g9'><center id='x47g9'></center></pre></bdo></b><th id='x47g9'></th></span></q></dt></tr></i><div id='x47g9'><tfoot id='x47g9'></tfoot><dl id='x47g9'><fieldset id='x47g9'></fieldset></dl></div>

    <small id='x47g9'></small><noframes id='x47g9'>

        • <bdo id='x47g9'></bdo><ul id='x47g9'></ul>
      1. <legend id='x47g9'><style id='x47g9'><dir id='x47g9'><q id='x47g9'></q></dir></style></legend>

        sh:ffmpeg:通过php运行命令时找不到命令

        时间:2023-09-20
        <legend id='y04ZK'><style id='y04ZK'><dir id='y04ZK'><q id='y04ZK'></q></dir></style></legend>
            <tfoot id='y04ZK'></tfoot>

              <i id='y04ZK'><tr id='y04ZK'><dt id='y04ZK'><q id='y04ZK'><span id='y04ZK'><b id='y04ZK'><form id='y04ZK'><ins id='y04ZK'></ins><ul id='y04ZK'></ul><sub id='y04ZK'></sub></form><legend id='y04ZK'></legend><bdo id='y04ZK'><pre id='y04ZK'><center id='y04ZK'></center></pre></bdo></b><th id='y04ZK'></th></span></q></dt></tr></i><div id='y04ZK'><tfoot id='y04ZK'></tfoot><dl id='y04ZK'><fieldset id='y04ZK'></fieldset></dl></div>

                • <bdo id='y04ZK'></bdo><ul id='y04ZK'></ul>
                    <tbody id='y04ZK'></tbody>

                  <small id='y04ZK'></small><noframes id='y04ZK'>

                  本文介绍了sh:ffmpeg:通过php运行命令时找不到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我已经在 Centos 6 机器的根目录上成功安装了 FFMpeg (https://trac.ffmpeg.org/wiki/CompilationGuide/Centos).

                  I have installed successfully installed FFMpeg on root of my Centos 6 machine (https://trac.ffmpeg.org/wiki/CompilationGuide/Centos).

                  我的 apache/php 工作场所是/var/www/html

                  My workplace of apache/php is /var/www/html

                  现在我在/var/www/html 目录上成功运行以下命令以从视频文件中捕获帧.它正在捕获一帧.

                  Now I'm running below command successfully on /var/www/html directory to capture frame from the video file. It's capturing a frame.

                  [root@localhost html]# ffmpeg -i video.mpg -an -ss 30  -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg -s 160x100 frame8  2>&1
                  

                  我想通过 php 并使用 shell_exec() 或 exec() php 函数运行此命令.我用于运行命令的 php 代码是:

                  I want to run this command through php and using shell_exec() or exec() php functions. My php code for running the command is:

                  $cmd = "/root/bin/ffmpeg -i /project/app/webroot/videos/video.mpg -ss 00:00:14.435 -f image2 -vframes 1 /project/app/webroot/videothumbnails/example-thumb.jpg";
                  $locale = 'en_IN.UTF-8';
                  setlocale(LC_ALL, $locale);
                  putenv('LC_ALL='.$locale);
                  echo shell_exec($cmd);
                  

                  当我尝试通过上面的 php 代码运行命令时,出现以下错误:

                  When I'm trying to run command through above php code, I'm getting below error:

                  sh: ffmpeg: command not found
                  

                  请帮我解决这个问题.

                  推荐答案

                  对于视频缩略图的创建,我们使用 ffmpeg.

                  For Video Thumbnail creation we use ffmpeg.

                  在Linux系统(centos 6.x)下Ffmpeg安装过程和Php例子:-

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

                  这个过程是在我的 centos 6 中完成的,并使用 php 创建了缩略图.

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

                  步骤 1:-请检查您的 linux 服务器中是否有任何现有的 ffmpeg 可用.如果可用,请删除该文件.

                  Step1:- Please check If any existing ffmpeg available or not in your linux server .If available please remove that files.

                  第 2 步:-对于新的 ffmpeg 安装,请点击此链接
                  http://root.uabid.com/compile-ffmpeg-on-centos-6-x/ .

                  Step2:- For New ffmpeg installation follow this link
                  http://root.uabid.com/compile-ffmpeg-on-centos-6-x/ .

                  Step3:- 安装完成后检查您的 ffmpeg 安装在哪里.

                  Step3:- After installation complete check whereis your ffmpeg installed.

                  命令:whereis ffmpeg

                  Command: whereis ffmpeg

                  在 linux 命令行中键入此命令并检查.例如,您的 ffmpeg 路径在 (/usr/local/bin/ffmpeg) 中.在您的代码中使用此路径.

                  type this command in linux command line and check.If for example your ffmpeg path in (/usr/local/bin/ffmpeg). Use this path in your code.

                  PHP 示例:-

                  <?php
                  
                      if($extension === 'mp4' OR $extension == 'MP4' )
                      {
                      $video = $timestamp.$imagename;
                      $videoname=substr($imagename,0, -4).$timestamp;
                      $image = "sites/default/files/content_images/{$videoname}-thumb.jpg";
                  
                      var_dump($video);
                  
                      $cmd = "/usr/local/bin/ffmpeg -i    /opt/lampp/htdocs/myproject/sites/default/files/content_videos/".$video." -ss   00:00:01.435 -f image2 -vframes 1       /opt/lampp/htdocs/myproject/sites/default/files/content_images/".$videoname."-  thumb.jpg";
                  
                      $cmdstr = $cmd;
                      $locale = 'en_IN.UTF-8';
                      setlocale(LC_ALL, $locale);
                      putenv('LC_ALL='.$locale);
                      echo exec($cmd);
                  ?>
                  

                  流程 2:-这是用于静态文件路径:

                  Process 2:- This is for static file paths:

                  <?php    
                      $cmd = "/root/bin/ffmpeg -i /var/www/html/project/app/webroot/videos/example.mp4 -ss   00:00:01.435 -f image2 -vframes 1 /var/www/html/project/app/webroot/videothumbnails/example-thumb.jpg";
                      $cmdstr = $cmd;
                      $locale = 'en_IN.UTF-8';
                      setlocale(LC_ALL, $locale);
                      putenv('LC_ALL='.$locale);
                      echo exec($cmd);
                  ?>
                  

                  希望这对你有帮助 &其他..

                  Hope this helps to you & others..

                  这篇关于sh:ffmpeg:通过php运行命令时找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:为文本文件生成缩略图 下一篇:如何使用 ffmpeg 转换视频

                  相关文章

                  最新文章

                  <i id='ljjLv'><tr id='ljjLv'><dt id='ljjLv'><q id='ljjLv'><span id='ljjLv'><b id='ljjLv'><form id='ljjLv'><ins id='ljjLv'></ins><ul id='ljjLv'></ul><sub id='ljjLv'></sub></form><legend id='ljjLv'></legend><bdo id='ljjLv'><pre id='ljjLv'><center id='ljjLv'></center></pre></bdo></b><th id='ljjLv'></th></span></q></dt></tr></i><div id='ljjLv'><tfoot id='ljjLv'></tfoot><dl id='ljjLv'><fieldset id='ljjLv'></fieldset></dl></div>

                • <tfoot id='ljjLv'></tfoot>
                  <legend id='ljjLv'><style id='ljjLv'><dir id='ljjLv'><q id='ljjLv'></q></dir></style></legend>

                    <small id='ljjLv'></small><noframes id='ljjLv'>

                      <bdo id='ljjLv'></bdo><ul id='ljjLv'></ul>