duanditang2916 2016-09-22 00:17
浏览 915

在JAVASCRIPT中运行FFMPEG命令

I'm trying to extract some frames from a video with ffmpeg when the video file is selected (not submittet) so i can create a video thumbnail preview. All i could come up with was this php version, but i'd like the preview to be live, so it needs to be a javascript function. For a js noob, how do i make javascript do the same as this php?

  <input type="file" name="video" onchange="JSfunction-that-extracts-video-frames();"/>

  <?php 
         $ffmpeg = "/usr/local/bin/ffmpeg";
         $size = "320x180";
         $videoFile = $_FILES['file']['tmp_name'];

         for($num = 1; $num <= 15; $num++)
         {
           $interval = $num * 3;
           shell_exec("$ffmpeg -i $videoFile -an -ss $interval -s $size videos/$num.png");
         }
   ?>
  • 写回答

1条回答 默认 最新

  • dongsheng9203 2016-09-22 00:39
    关注

    I would recommend making PHP save the screenshot into a folder or Base64 it. Then once PHP has done it, use AJAX to display the screenshot the client. Loading the screenshot dynamically for the client via plain javascript wouldn't work properly.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作