Title: FFMPEG Bug
Last modified: January 6, 2021

---

# FFMPEG Bug

 *  Resolved [bavoko.tools](https://wordpress.org/support/users/bavokoservices/)
 * (@bavokoservices)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/ffmpeg-bug/)
 * Hi there, I just now downloaded your plugin to use the “gif to mp4” convert functionality.
   After not finding the option, I took a look into the settings and noticed that
   the plugin can’t find ffmpeg or avconv. A quick look into the location of the
   file and it turns out the default folder of “/usr/local/bin” was wrong and I 
   changed it to “/usr/bin”. However it still didn’t work, even though it worked
   flawlessly in SSH/CLI. So I took a look at your code, debugged some outputs and
   noticed that you have an escaping error. You are missing the last quote for the
   output file url. Right now it’s this:
 * `$cmd = escapeshellcmd($test_path.'/'.$options['video_app'].' -i "'.plugin_dir_path(
   __FILE__).'images/sample-video-h264.mp4" -vframes 1 -f mjpeg "'.$uploads['path'].'/
   ffmpeg_exists_test.jpg').'" 2>&1';`
 * However as you can see only the first quote of the output file url is actually
   submitted to the escaping function. The last quote is appended after that with
   the output redirect. This results in the first quote being escaped with a slash,
   while the last quote remains normal, and thus the file URL turning invalid. The
   plugin will then say that FFMPEG is not installed. So it should be like this:
 * `$cmd = escapeshellcmd($test_path.'/'.$options['video_app'].' -i "'.plugin_dir_path(
   __FILE__).'images/sample-video-h264.mp4" -vframes 1 -f mjpeg "'.$uploads['path'].'/
   ffmpeg_exists_test.jpg"').' 2>&1';`
 * If anyone else has that problem: Try changing above line in “/video-embed-thumbnail-
   generator.php”, line 1140.
 * While I’m on it I also noticed that the fallback for that function (where the
   path is ommited), has a similar problem. Same file, line 1153. This time the 
   command is missing the output file quotes all together and has no space between
   the output format (“-f mjpeg”) and the output file URL after that. It will thus
   never work correctly, as the file is appended to the format instead of being 
   supplied as the output file path.
 * `$cmd = escapeshellcmd($test_path.'/'.$options['video_app'].' -i "'.plugin_dir_path(
   __FILE__).'images/sample-video-h264.mp4" -vframes 1 -f mjpeg'.$uploads['path'].'/
   ffmpeg_exists_test.jpg');`
 * Please fix 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Kyle Gilman](https://wordpress.org/support/users/kylegilman/)
 * (@kylegilman)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/ffmpeg-bug/#post-13872857)
 * Thanks for your careful debugging. That’s a new change from last week’s first
   update in 18 months and it looks like I didn’t test it enough.
 *  Plugin Author [Kyle Gilman](https://wordpress.org/support/users/kylegilman/)
 * (@kylegilman)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/ffmpeg-bug/#post-13872943)
 * I don’t see that missing space in [line 1153](https://plugins.trac.wordpress.org/browser/video-embed-thumbnail-generator/tags/4.6.26/video-embed-thumbnail-generator.php#L1153)
   though. Did you get the plugin directly from the WordPress plugin directory?
 *  Plugin Author [Kyle Gilman](https://wordpress.org/support/users/kylegilman/)
 * (@kylegilman)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/ffmpeg-bug/#post-13873832)
 * I just released version 4.6.27 which incorporates the fix that you posted here.
   Thanks again for your help.
 *  Thread Starter [bavoko.tools](https://wordpress.org/support/users/bavokoservices/)
 * (@bavokoservices)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/ffmpeg-bug/#post-13874242)
 * I downloaded it normally from the backend repo, but it’s gone now so all good
   🙂
 * Awesome plugin though! And great support! I’ll leave a review 😉

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘FFMPEG Bug’ is closed to new replies.

 * ![](https://ps.w.org/video-embed-thumbnail-generator/assets/icon.svg?rev=2965979)
 * [Videopack](https://wordpress.org/plugins/video-embed-thumbnail-generator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/video-embed-thumbnail-generator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/video-embed-thumbnail-generator/)
 * [Active Topics](https://wordpress.org/support/plugin/video-embed-thumbnail-generator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/video-embed-thumbnail-generator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/video-embed-thumbnail-generator/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [bavoko.tools](https://wordpress.org/support/users/bavokoservices/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/ffmpeg-bug/#post-13874242)
 * Status: resolved