Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg doesn't always return false when it fails - here's how to catch it #198

Open
richardpickett opened this issue Mar 1, 2023 · 0 comments

Comments

@richardpickett
Copy link

As the title states, ffmpeg doesn't always return false when it fails, this patch below is to put a filesize() check in place to make sure the thumbnail was actually created.

Not having this check in place causes the entire import to fail with a stacktrace whenever the synchronize is performed and ffmpeg can't generate a thumbnail from a mp4.

Having this check in place allows processing to continue, with the failed thumbnail noted in the "error" section of the results page.

# diff -u piwigo-videojs-master/include/function_sync2.php function_sync2.php 
--- piwigo-videojs-master/include/function_sync2.php    2022-08-15 13:29:40.000000000 -0500
+++ function_sync2.php  2023-03-01 11:55:02.646411728 -0600
@@ -188,7 +188,7 @@
                 //echo $ffmpeg;
                 $log = system($ffmpeg, $retval);
                 //$infos[] = $filename. ' poster : retval:'. $retval. ", log:". print_r($log, True);
-                if($retval != 0 or !file_exists($out))
+                if($retval != 0 or !file_exists($out) or !filesize($out))
                 {
                     $errors[] = "Error poster running ffmpeg/avconv, try it manually, check your webserver error log:\n<br/>". $ffmpeg;
                 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant