I am trying to generate video thumbnail in my node project for that I tried
thumbsupply and video-thumbnail npm both returns the same error called not found: ffprobe
const thumbsupply = require('thumbsupply');
const ffprobe = require('#ffprobe-installer/ffprobe');
let aa = thumbsupply.generateThumbnail('videoplayback.mp4', {
size: thumbsupply.ThumbSize.MEDIUM, // or ThumbSize.LARGE
timestamp: "10%", // or `30` for 30 seconds
forceCreate: true,
cacheDir: "~/myapp/cache",
mimetype: "video/mp4"
})
console.log(aa);
Thumbsupply uses fluent-ffmpeg (from a quick look at the source):
https://github.com/fluent-ffmpeg/node-fluent-ffmpeg
fluent-ffmpeg has information on the requirements around ffmpeg installation and the required path at the link above.
Prerequisites
ffmpeg and ffprobe
fluent-ffmpeg requires ffmpeg >= 0.9 to work. It may work with previous versions but several features won't be available (and the library is not tested with lower versions anylonger).
If the FFMPEG_PATH environment variable is set, fluent-ffmpeg will use it as the full path to the ffmpeg executable. Otherwise, it will attempt to call ffmpeg directly (so it should be in your PATH). You must also have ffprobe installed (it comes with ffmpeg in most distributions). Similarly, fluent-ffmpeg will use the FFPROBE_PATH environment variable if it is set, otherwise it will attempt to call it in the PATH.
ffmpeg details including installation is here: https://www.ffmpeg.org/download.html
I was also getting this issue Error: Cannot find ffprobe
I have done following steps to make it work in ubuntu
sudo apt update
sudo apt install ffmpeg
restarted my pm2 api instance.
This was my case with the deployment server,
Since, I was working in local on mac os, I used
brew install ffmpeg
Related
The objective is to convert .m3u8 file(hls stream) to .mp4 video inside my NodeJS application. I've tried doing the same using ffmpeg on console and that works fine but unable to find a recently maintained package that helps me do this in node.
Also, my input file is not the usual file located in my local directory but a remote AWS S3 object URL which is otherwise accessible to all(public bucket), in simpler words,
How do I do ffmpeg -i https://mycloudfrontURL/myHLSfile.m3u8 output.mp4 in JS?
The best solution is to use ffmpeg directly in your node.js application.
Install ffmpeg on your pc. Then create a node.js file that runs ffmpeg like so:
const { execSync } = require('child_process')
const input = 'https://mycloudfrontURL/myHLSfile.m3u8'
const output = 'output.mp4'
execSync(`ffmpeg -y -i "${input}" "${output}"`)
You'll be able to execute ffmpeg and get the same result as if running it from the terminal. Make sure to have ffmpeg installed or indicate the full path if it doesn't work.
If this worked for you, upvote the solution.
I am trying to convert a .mp4 file to .gif using NPM packages, but nothing seems to be working.
I tried using gifski binary package (NPM) for this, but no luck. It says its a binary package and you can use it by child_process.spawn() or similar. I installed it with -g (global) flag and seems like its not recognized even with global flag. Not sure If you can set PATH or anything. Let me know if its possible.
As for the other tries, I used gify and its just not doing anything (no file or error).
I am getting the .mp4 file from puppeteer-lottie NPM package. Here's my code, if needed for testing:
const renderLottie = require('puppeteer-lottie');
await renderLottie({ animationData: data, output: 'example.mp4', width: 640 });
animationData: Sticker JSON
I am pretty sure that there are much easier ways to do this, but I am just using complex ones. I just want .mp4 to .gif at the end.
Thanks for your time.
For those of you who are still trying to find solution, I finally found it.
We just use ffmpeg with child_process.exec(). No need to install anything.
const { exec } = require("child_process");
exec("ffmpeg -i input.mp4 -qscale 0 output.gif");
input is your mp4 file that you want to convert, and output is your result gif file.
Source: Conrad Lotz's answer
I am attempting to use an npm package for splitting audio (https://github.com/calufornia/audio-split), however I am not able to run a single test since I get the following error on my callback:
Error: Cannot find ffprobe, I have read a bit and it seems that this is directly related to the npm package fluent_ffmpeg, which is actually a dependency of the first package I mentioned.
The problem on some other questions/forums is that people do not have properly installed ffmpeg on their environment. In my case however, I have made sure that my PATH is updated with the ffmpeg directory (C:\FFmpeg\bin for me), and I am able to open a command prompt and run both
ffmpeg -version
and
ffprobe -version
I would much appreciate if anyone else has struggled with this previously and could provide me with some more guidance. Thanks
I am new to ubuntu and I am struggling in setting up ffmpeg installation on the ubuntu server. I have install the ffmpeg on ubuntu and also I can see it by issuing a command ffmpeg -v. I have done the development in node.js in windows and specify the path of ffmpeg. Below is the path of window in node.js:
proc.setFfmpegPath("D:\\abc\\ffmpeg-20121120-git-8b6aeb1-win64-static\\bin\\ffmpeg.exe");
but now I have to specify the path for ffmpeg for ubuntu in my node.js code.
proc.setFfmpegPath("/usr/bin/ffmpeg/ffmpeg");
it says Uncaught Error: spawn ENOTDIR
Even though I have tried with this path:
proc.setFfmpegPath("/usr/bin/ffmpeg");
then it says An error happened: ffmpeg exited with code 1
Also I have run this command "whereis ffmpeg" and it says "/usr/bin/ffmpeg"
Any help is very much appreciated
This one is correct:
proc.setFfmpegPath("/usr/bin/ffmpeg");
It is returning error code 1, which means that it is executing the ffmpeg but ffmpeg is not successfully running to completion. Try running it on the command line to see if there are any obvious problems. If that doesn't work, you'll have to dig in with some more logging and/or debugging.
I'm doing a nodewebkit app and trying to bundle ffmpeg inside so the user doesn't have to have ffmpeg installed on their system.
EACCESS has to do with rights running the code. I tried a chmod -R ug+rw ffmpegFolder to no avail.
I downloaded the osx binaries from here: https://evermeet.cx/ffmpeg/ I'm assuming these are compiled but I could be wrong?
I am bundling the extracted ffmpeg folder into the root of my .nw, which, extracted looks like this:
This part has to do with fluent-ffmpeg.
It has this method called setFfmpegPath(path) which tells fluent-ffmpeg to use a FFMPEG you provide.
I get the fs.realpath to ffmpeg-2.5.4 and use that.Using ./ffmpeg-2.5.4 or /ffmpeg-2.5.4 or ffmpeg-2.5.4 just gives a spawn ENOENT error which I've read, means not found.
If I remove setFfmepgPath from my fluent-ffmpeg command it works fine using my system ffmpeg.
I feel I'm on the right track with the spawn EACCESS error. How to make it play nice though?