0

Whenever I am running this script, it compresses my MP4 video but the output is 0 bytes.

It works well for AVI & FLV format. Please help me understand what I am doing wrong?

 @session_start();

    @include_once("start.php");

         $command = '/usr/local/bin/ffmpeg -i '. FILEPATH .'/video_1244579292.mp4'.' -strict -2 -crf 20 '. COMPRESSPATH .'/my_video.mp4';

        shell_exec($command);
        echo "<br><br><br>";
        echo $command;
Riyaz Khan
  • 23
  • 1
  • 9
  • Show the ull log of the MP4 execution. – Gyan Dec 01 '17 at 10:29
  • I didn't get you. How I can see it? – Riyaz Khan Dec 01 '17 at 11:14
  • Add `-report` to the command. Share the report file generated. – Gyan Dec 01 '17 at 11:39
  • I couldn't find report file by adding -report in command. I have another command which is doing compress mp4 video but its increase the size of the compressed video. "-codec:v mpeg4 -codec:a libmp3lame -qscale:v 4 -qscale:a 5" – Riyaz Khan Dec 01 '17 at 12:43
  • By increasing qscale:v value. Search for a filename of the type `ffmpeg-YYYYMMDD-HHMMSS.log` on your whole system. – Gyan Dec 01 '17 at 13:12
  • Thanks, Mulvya. I did it, now it works but its not decreasing too much what I expected. My file is 46 MB and its compressed 27MB. Can we compress more? – Riyaz Khan Dec 01 '17 at 13:27
  • 1
    Not using `mpeg4`. Link to the report when you find it. – Gyan Dec 01 '17 at 13:32
  • Mulvya, please tell me where I put -report in command, from the begining or at last? I am working on c-panel. Any idea where i can see that log file in cpanel folder? – Riyaz Khan Dec 02 '17 at 06:29
  • You can put `-report` anywhere, – Gyan Dec 02 '17 at 08:04
  • I am trying to do that but it prevents run my command. – Riyaz Khan Dec 02 '17 at 08:49
  • Hello Mulvya, I have now received log file. Check please https://drive.google.com/open?id=1-2T7UQpCPymN9UhkwfFF482MoV5ozpJR – Riyaz Khan Dec 02 '17 at 09:08
  • This is for command with `mpeg4` and output is 42MB. Need to see report for 0-byte output. – Gyan Dec 02 '17 at 09:33
  • Ohkkkk...wait. 2 minute – Riyaz Khan Dec 02 '17 at 09:34
  • Sorry net was slow please check this link with 0 byte. https://drive.google.com/file/d/1L4qjDsxOe4W3xcTj7lPMnOs2IVlKDq3H/view – Riyaz Khan Dec 02 '17 at 10:03
  • Are u there ? @Mulvya – Riyaz Khan Dec 02 '17 at 11:54
  • Add `-vf setsar=1` and check. – Gyan Dec 02 '17 at 12:30
  • no its not working bro. – Riyaz Khan Dec 02 '17 at 12:45
  • Mulvya, is there any other way which can make my online videos fast? http://www.machinerytube.com/video/MjQwMw==/press-brake-videos/400-ton-x-14-used-accurpress-cnc-hydraulic-press-brake,-mdl.-740014,-flush-floor-machine,-all-above-ground,-no-pit-required!,-foot-pedal,-light-curtains,-a5056 – Riyaz Khan Dec 02 '17 at 13:11
  • There's no useful error message in the report to debug, but something looks wrong with the libx264 build. – Gyan Dec 02 '17 at 13:36
  • So, its not possible to compress mp4 with same qualitty? – Riyaz Khan Dec 05 '17 at 04:13
  • It is, but your binary is failing with no useful error message. Get another binary and try. – Gyan Dec 05 '17 at 05:12
  • Check this log file. I have 1.29GB video and after compressing it showing 21.0 KB. https://drive.google.com/file/d/1dg3JCte03bFbAtox0bYrSe9y-ovFVwFh/view?usp=sharing – Riyaz Khan Dec 05 '17 at 07:09
  • Awesome compression rate! ;) Seriously, though, it looks like your input video may be broken in a way. Or you ffmpeg executable is. What you should do is try to execute ffmpeg manually on your file and play around with it on the command until it works as you want. And then use the result inside your php. – TheSHEEEP Dec 05 '17 at 07:13
  • Your ffmpeg command is so simple there shouldn't be many problems. Since there are, I suspect a broken video file or a broken ffmpeg executable. – TheSHEEEP Dec 05 '17 at 07:16
  • @TheSHEEEP you mean to say i execute this command manually? – Riyaz Khan Dec 05 '17 at 09:05
  • Yes, to find out what is going wrong. As I said, play around with it until you know. This isn't really something others could do for you, as we'd just do the same. – TheSHEEEP Dec 05 '17 at 10:33

0 Answers0