I just installed FFMPEG on a server and I am testing it to see if it works. I am new to this, so I don't know if I'm doing it correctly. I want to scale and compress an image. I am doing it by following php code -
exec("ffmpeg -i $inputImg -vf \"scale='-2':'min(480, ih)\" $outputImg 2>&1", $output, $returnStatus);
print_r($output);
echo '<br>'.$returnStatus;
The thing is it works for some images and for images it gives an error. For ex. I have tried to compress an image and it returns with error -
ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developers
[1] => built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36)
[2] => configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg
--incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man
--arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64
-mtune=generic' --extra-ldflags='-Wl,-z,relro ' --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3
--enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa
--enable-libass --enable-libcdio --enable-libdc1394 --enable-libfdk-aac
--enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm
--enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus
--enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex
--enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264
--enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter
--enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping
--shlibdir=/usr/lib64 --enable-runtime-cpudetect
[3] => libavutil 54. 31.100 / 54. 31.100
[4] => libavcodec 56. 60.100 / 56. 60.100
[5] => libavformat 56. 40.101 / 56. 40.101
[6] => libavdevice 56. 4.100 / 56. 4.100
[7] => libavfilter 5. 40.101 / 5. 40.101
[8] => libavresample 2. 1. 0 / 2. 1. 0
[9] => libswscale 3. 1.101 / 3. 1.101
[10] => libswresample 1. 2.101 / 1. 2.101
[11] => libpostproc 53. 3.100 / 53. 3.100
[12] => /tmp/phpjLYmRd: Invalid data found when processing input
Am I doing it incorrectly or what? Because it does work with some images and for some it doesn't! Also, is this the correct way to scale and compress an Image using FFMPEG, would love to get some insights.