quasarstream / PHP-FFmpeg-video-streaming

📼 Package media content for online streaming(DASH and HLS) using FFmpeg
https://www.quasarstream.com/op/php/ffmpeg-streaming?u=php-ff
MIT License
514 stars 117 forks source link

Error while trying to convert mp4 file to hls larger than 1gb #57

Closed aumkarthakur closed 4 years ago

aumkarthakur commented 4 years ago

Describe the bug At first I thought it must be memory issue so I increase my instance memory to 3gb but still it's keep crashing. I am converting .mp4 file which has size of 1.3gb to hls format with r_480p.

Error Log

[47.247.29.52:49950-Q:A42210924CD33A09-9#wordpress] [STDERR] PHP Fatal error: Uncaught Symfony\Component\Process\Exception\ProcessTimedOutException: The process "'/usr/bin/ffmpeg' '-y' '-i' '/var/www/html/ffmpeg/1782829481.mp4' '-c:v' 'libx264' '-c:a' 'aac' '-bf' '1' '-keyint_min' '25' '-g' '250' '-sc_threshold' '40' '-hls_list_size' '0' '-hls_time' '10' '-hls_allow_cache' '1' '-hls_segment_type' 'mpegts' '-hls_fmp4_init_filename' '1782829481_480p_init.mp4' '-hls_segment_filename' '/tmp/php_ffmpeg_video_streaming/5ebb0032cee24/1782829481_480p_%04d.ts' '-s:v' '854x480' '-b:v' '750k' '-strict' '-2' '/tmp/php_ffmpeg_video_streaming/5ebb0032cee24/1782829481_480p.m3u8' '-c:v' 'libx264' '-c:a' 'aac' '-bf' '1' '-keyint_min' '25' '-g' '250' '-sc_threshold' '40' '-hls_list_size' '0' '-hls_time' '10' '-hls_allow_cache' '1' '-hls_segment_type' 'mpegts' '-hls_fmp4_init_filename' '1782829481_1080p_init.mp4' '-hls_segment_filename' '/tmp/php_ffmpeg_video_streaming/5ebb0032cee24/1782829481_1080p_%04d.ts' '-s:v' '1920x1080' '-b:v' '4096k' '-strict' '-2' '/tmp/php_ffmpeg_video_streaming/5ebb0032cee24/1 in /var/www/html/ffmpeg/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php on line 95
--
aumkarthakur commented 4 years ago

It turned out that problem was not with memory but timeout. I fixed it by setting the value of timeout to 0.

$config = [
    'timeout'          => 0 // The timeout for the underlying process
];

$ffmpeg = Streaming\FFMpeg::create($config, null);