Hi,
the deployment of my site is not successful due to this error:
2:23:07 PM: Error writing templates: (more in DEBUG output)
2:23:07 PM: > Having trouble writing template: _site/blog/coordinate-di-latitudine-e-longitudine-nuovo-google-maps/index.html
2:23:07 PM: `TemplateWriterWriteError` was thrown
2:23:07 PM: > Command failed: ffmpeg -i src/site/images/google-maps-trovare-latitudine-con-un-clic.gif -movflags faststart -filter:v "scale=trunc(iw/2)*2:trunc(ih/2)*2" -pix_fmt yuv420p -y -loglevel error _site/images/google-maps-trovare-latitudine-con-un-clic.xform.mp4
2:23:07 PM: /bin/sh: 1: ffmpeg: not found
2:23:07 PM: `Error` was thrown:
2:23:07 PM: Error: Command failed: ffmpeg -i src/site/images/google-maps-trovare-latitudine-con-un-clic.gif -movflags faststart -filter:v "scale=trunc(iw/2)*2:trunc(ih/2)*2" -pix_fmt yuv420p -y -loglevel error _site/images/google-maps-trovare-latitudine-con-un-clic.xform.mp4
2:23:07 PM: /bin/sh: 1: ffmpeg: not found
2:23:07 PM: at ChildProcess.exithandler (child_process.js:303:12)
2:23:07 PM: at ChildProcess.emit (events.js:315:20)
2:23:07 PM: at maybeClose (internal/child_process.js:1021:16)
2:23:07 PM: at Socket.<anonymous> (internal/child_process.js:443:11)
2:23:07 PM: at Socket.emit (events.js:315:20)
2:23:07 PM: at Pipe.<anonymous> (net.js:674:12)
The problem apparently is that I have to install FFMPEG on the Netlify server. I read that I need to add the pre-compiled files to the repository and then launch the build. But I have no idea how.
Would anyone be kind enough to show me a step-by-step guide on how to do it?
Hi @Scott,
thanks for the welcome. Unfortunately that thread only partially answers my problem. I tried to install the suggested package but the error remains. The answer marked as solution says what to do but not how. I would need instructions on how to do these steps.
Can you help me?
I believe I was the person who raised that issue.
You have to find an ffmpeg install for the Ubuntu Linux v 16.04 LTS using x86_64 architecture and place the binary wherever you want in your app. If you did a global install on a linux machine, you will find it in usr/bin/ffmpeg. You can use the ffmpeg by using the relative path to the ffmpeg binary and it will work. Some time has passed since I last tried this, so forgive me if Iām a little fuzzy on the details. Let me know if youāre still having issues!
Hi @hideodaikoku,
I found the binary file and copied it to the repository root. I canāt use a relative path or modify the call to ffmpeg because it is made by a plugin. Do I need to add the local binary to the global PATH? Is there any way to install it without root permissions? Thank you for your support
I was unable to find a way to permanently set the path on Netlify. In the end I gave up and opted to change the plugin code. Thanks to the links published by @Scott and @hideodaikoku I managed to solve the problem.
These are the steps:
copy a static builf of ffmpeg in the repository (/bin/ffmpeg-git-20200617-amd64-static) (see John Van Sickle - FAQ)
create a local copy of the package that uses ffmpeg (eleventy-plugin-local-respimg) in ./scr/eleventy-plugin-local-respimg
modify eleventy.js to use the local copy const pluginLocalRespimg = require('./src/eleventy-plugin-local-respimg')
The path is different if you execute the build on a local machine or on Eleventy. In the package.json set an enviroment variable in the build command for Netlify "netlify": "NODE_ENV=production npm run build",
In the local copy of the plugin check for the NODE_ENV and build the path of ffmpeg. You should give the permission as executable with chmode.