damianociarla / node-ffmpeg

ffmpeg module for nodejs
MIT License
604 stars 140 forks source link

Command Failed on large files #59

Open raghuchahar007 opened 5 years ago

raghuchahar007 commented 5 years ago

I tried on some basic commands of ffmpeg, they worked fine on my local environment, but when i deployed it. Large files i.e approx 200MB starts failing with error command failed. After some research i found it may be because of less CPU and RAM configurations.So I increased it , after which it starts failing on 500 MB files.Can someone please suggest how much resource ffmpeg needs or some pattern by which i can identify which type and size of files would work fine on how much resource.

500MB mp4 failed on 1500m CPU and 1000 Mi RAM

Function for conversion is :: const convertWithFFMPEG = ({ fileName, path, dimensions, type, tempFiles, extension }) => { return new Promise((resolve, reject) => { const inputFilePath = path + "/" + fileName; var process = new ffmpeg(inputFilePath); let { height, width } = dimensions; process.then( command => { let vf; vf = ``thumbnail,scale=${width}:${height}``; let outputFilePath = ${path}/${fileName}_converted.${extension}``; command.addCommand("-frames:v 1"); command.addCommand("-compression_level", 100); command.addCommand("-vf", vf); command.save(outputFilePath, (error, file) => { if (error) { reject(error); } tempFiles.push(outputFilePath); resolve(outputFilePath); }); }, err => { reject(err); } ); }); };

Error is :: Command failed: ffmpeg -i /usr/src/app/src/temp/video100mb___e839e9ef_07db_43af_8a4a_62f0cbec294c.mp4 -frames:v 1 -compression_level 100 -vf thumbnail,scale=144:256 /usr/src/app/src/temp/video100mb___3942b363_4e4e_4c7d_b236_edc23659f02d_ffmpeg_thumb.jpegffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 8.2.0 (Alpine 8.2.0) configuration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --disable-debug libavutil 56. 14.100 / 56. 14.100 libavcodec 58. 18.100 / 58. 18.100 libavformat 58. 12.100 / 58. 12.100 libavdevice 58. 3.100 / 58. 3.100 libavfilter 7. 16.100 / 7. 16.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 1.100 / 5. 1.100 libswresample 3. 1.100 / 3. 1.100 libpostproc 55. 1.100 / 55. 1.100Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/usr/src/app/src/temp/video100mb___e839e9ef_07db_43af_8a4a_62f0cbec294c.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2018-10-07T14:00:12.000000Z location : -23.5573-046.7765/ location-eng : -23.5573-046.7765/ com.android.version: 8.0.0 Duration: 00:00:46.85, start: 0.000000, bitrate: 17258 kb/s Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 16996 kb/s, SAR 1:1 DAR 16:9, 29.98 fps, 30 tbr, 90k tbn, 180k tbc (default) Metadata: rotate : 90 creation_time : 2018-10-07T14:00:12.000000Z handler_name : VideoHandle Side data: displaymatrix: rotation of -90.00 degrees Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default) Metadata: creation_time : 2018-10-07T14:00:12.000000Z handler_name : SoundHandleStream mapping: Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))Press [q] to stop, [?] for help[swscaler @ 0x564a3aac4a80] deprecated pixel format used, make sure you did set range correctlyOutput #0, image2, to '/usr/src/app/src/temp/video100mb___3942b363_4e4e_4c7d_b236_edc23659f02d_ffmpeg_thumb.jpeg': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 com.android.version: 8.0.0 location : -23.5573-046.7765/ location-eng : -23.5573-046.7765/ encoder : Lavf58.12.100 Stream #0:0(eng): Video: mjpeg, yuvj444p(pc), 144x256 [SAR 1:1 DAR 9:16], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default) Metadata: encoder : Lavc58.18.100 mjpeg creation_time : 2018-10-07T14:00:12.000000Z handler_name : VideoHandle Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1 displaymatrix: rotation of -0.00 degreesframe= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x

sonu-c247 commented 5 years ago

+1

joaojlf4 commented 4 years ago

+1