protonemedia / laravel-ffmpeg

This package provides an integration with FFmpeg for Laravel. Laravel's Filesystem handles the storage of the files.
https://protone.media/en/blog/how-to-use-ffmpeg-in-your-laravel-projects
MIT License
1.62k stars 193 forks source link

Error: ffmpeg failed to execute command after reaching a certain number of characters #505

Closed mondersky closed 10 months ago

mondersky commented 10 months ago

I attempted to concatenate multiple filters using the same "drawtext" command, but I encountered an issue where it only functions correctly if the commands strings overal length does not exceed a certain characters length. This is the code I used: for($i = 0; $i < 38; $i++){ $video->addFilter('-vf', "drawtext=text=abc:x=3:y=640:fontsize=((37)+(55.5-37)*(0.25)):fontcolor=#2fb683:fontfile=assets/fonts/montserrat/bold.ttf:shadowcolor=black@0.7:shadowx=1:shadowy=1:enable='between(t\,0.25\,5)'"); } $video->export()->toDisk('multimedia')->inFormat(new \FFMpeg\Format\Video\X264)->save($targetFilename); I encountered an error message: "Error: ffmpeg failed to execute command." The error disappears if I reduce the number of filters or the length of the text in the filter command string. In this example, the "drawtext" text value is "abc" and the command executes successfully when I remove the "c." Please note that I am not referring to the "text" value when I talk about characters limit but to the whole command string,

The issue appears to be related to the character limit or filter count, possibly causing a problem with the generated FFmpeg command.

mondersky commented 10 months ago

The issue stemmed from a Windows-imposed maximum length limit for strings, which became apparent as I was running my PHP script on Wamp within a Windows environment. This limitation was obstructing the execution of the final command by Laravel-FFmpeg. Read more