Virtually impossible for me to diagnose from here. The videos worked fine in my tests. There is no such thing as "random" failure ... It will only be random if the same file sometimes fails and sometimes succeeds. As I think you will find, it will be the same video files that fail on your system, and the same ones that succeed. For the ones that fail, there is a reason, and it will almost certainly be related to one of the reasons I noted earlier:
Karl
- Old FFMpeg version vs incompatible video codec.
- Massive video dimensions exceeds some memory limit for resizing.
If I could reproduce your error here, it would be easy to diagnose, but I can't. So if your FFmpeg is acting different from mine, it must either be related to video, codec or ffmpeg version itself.
You could try renaming one of them?
Below is the code for creating video thumbnail from PHP. You could adjust and try it manually in terminal:
private static $preview_cmd_video = '%APP_PATH% -ss 3 -t 1 -hide_banner -i "%PATH%" -frames:v 1 -an -vf "thumbnail,scale=min\'(%RESIZE%,iw)\':min\'(%RESIZE%,ih)\':force_original_aspect_ratio=decrease" -r 1 -y -f mjpeg "%CACHE%" 2>&1';
That code works here, but not on your server. Can you run it in terminal? I assume not, and then you should get an error response. If you can run it in terminal but not from Files Gallery, which I doubt very much, you would have a problem that your PHP is somehow under limitations when running exec commands (doubtful!).