douchui4459 2015-10-20 16:09
浏览 25

针对未知问题的PHP和FFMPEG建议/解决方案

I am having a live video streaming website and I allow people to upload all the video files to the site till now everything is ok.

What I am doing is that I am using FFMPEG to convert the video to mp4 and also get a image out of the video after 20 seconds.

The code that I am using is that:

 require 'vendor/autoload.php';
        $getEXT_check=substr(@$_FILES['profileimage99']['name'],-3);
        if($getEXT_check !='mp4' && $getEXT_check !='MP4'){
        exec('ffmpeg -i '.$uploadfile.' -f mp4 -s 896x504 '.$new_flv.''); }
        //execute ffmpeg and create thumb
        exec('ffmpeg  -i '.$uploadfile.' -ss 00:00:20 -vframes 1  '.$new_image_path);
        $theduration=exec('ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 '.$uploadfile.' 2>&1');
        $theduration_val=round($theduration/60, 2);

What issue I am having is that

  1. sometimes the code dosent extract the image out of video
  2. video conversation takes very long time for non mp4 video (I am not converting mp4 videos)

Some info what I have done on server. During the development of site I installed ffmpeg on my pc and downloaded the vendor directory by composer.json file. But I have not done these things on my server I have a dedicated server from bluehost and have ffmpeg installed at this location.

/usr/local/bin/ffmpeg
/usr/local/bin/mplayer
/usr/local/bin/mencoder
/usr/bin/flvtool2
/usr/local/bin/MP4Box
/usr/local/bin/yamdi

During uploading the site what I did is that I also uploaded the vendor directory and all the files and made the site live. I haven't used any of the path as given by my server admin after asking.

Please suggest me something where I am doing wrong.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
    • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
    • ¥60 pb数据库修改与连接
    • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
    • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
    • ¥20 神经网络Sequential name=sequential, built=False
    • ¥16 Qphython 用xlrd读取excel报错
    • ¥15 单片机学习顺序问题!!
    • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
    • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)