I'm trying to convert video format using FFMPG but not working. Heres my code:
$name = $_FILES['video']['name']; $upload_path = __DIR__.'/upload/'.uniqid('video').'.mp4'; $ffmpegPath = shell_exec( __DIR__.'/ffmpeg 2>&1'); // ffmpeg file convert = $ffmpegPath . shell_exec(" ffmpeg -i ".$name." -c:v libx264 -preset ultrafast -crf 21 -c:a copy ".$upload_path.".mp4 2>ffmpeg_vid.log"); if($convert){ print_r(''.$convert.'
');
}
else{ echo 'NO';
}
**output: **
ffmpeg version N-77715-gfc703f5 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.2.0 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib libavutil 55. 12.100 / 55. 12.100 libavcodec 57. 21.100 / 57. 21.100 libavformat 57. 21.101 / 57. 21.101 libavdevice 57. 0.100 / 57. 0.100 libavfilter 6. 23.100 / 6. 23.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}... Use -h to get full help or, even better, run 'man ffmpeg'
also I've try same code without using any MVC and work fine.
$currentPath=$_FILES['video']['name'];
shell_exec("ffmpeg.exe"); shell_exec("ffmpeg -i ".$currentPath." -c:v libx264 -preset ultrafast -crf 21 -c:a copy ./output/".uniqid('video_').".mp4"); echo "Ok";
By the by Im using Codeigniter. Thanks in advance.