“Encoding failed” FFMPEG laravel ProtoneMedia\LaravelFFMpeg\Exporters\EncodingException(code: 0):

tried to upload a video with ffmpeg, got an error

(ProtoneMedia\LaravelFFMpeg\Exporters\EncodingException(code: 0): Encoding failed at /app/vendor/pbmedia/laravel-ffmpeg/src/Exporters/EncodingException.php:12)

the strange thing is that there are only a few videos that can and can’t be uploaded like an example data with video:

  1. test-video1.mp4 (success)
  2. test-video2.mp4 (failed)

Implementation


$mediaName= "425d17680ae04eb853d4c2e1da24a5aa.mp4"
$mediadisk= "media"
$tmpPath = $file->store('/tmp', temp_disk'));
$pathPrefix = 'member/2';

$ffMpeg = FFMpeg::fromDisk(config('temp_disk'))->open($tmpPath);

$dimension = $ffMpeg->getVideoStream()->getDimensions();

$ffMpeg
->export()
->toDisk($mediadisk)
->save($videoPath = "{$pathPrefix}/videos/{$mmediaName}")
->getFrameFromSeconds(5)
->export()
->toDisk($thumbnailDisk = config('asset-inventory.image_disk'))
->save($thumbnailPath = $pathPrefix . '/media/thumbnail/' . $mediaName . '.png');

return [
'path' => $videoPath,
'thumbnail_disk' => $thumbnailDisk,
'thumbnail_path' => $thumbnailPath,
'duration' => $ffMpeg->getDurationInSeconds(),
'width' => $dimension->getWidth(),
'height' => $dimension->getHeight()
];

Result :

ffmpeg failed to execute command '/usr/bin/ffmpeg' '-y' '-i'

"[object] (ProtoneMedia\LaravelFFMpeg\Exporters\EncodingException(code: 0): Encoding failed at /app/vendor/pbmedia/laravel-ffmpeg/src/Exporters/EncodingException.php:12)
[stacktrace]
#0 /app/vendor/pbmedia/laravel-ffmpeg/src/Exporters/MediaExporter.php(172): ProtoneMedia\LaravelFFMpeg\Exporters\EncodingException::decorate(Object(FFMpeg\Exception\RuntimeException))

FFMPEG Version :

ffmpeg version 4.3.2-0+deb11u2 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr --extra-version=0+deb11u2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100```

from Newest questions tagged laravel-5 – Stack Overflow https://ift.tt/2Z1YK7A
via IFTTT

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.