damianociarla / node-ffmpeg

ffmpeg module for nodejs
MIT License
597 stars 140 forks source link

Can I use ffmpeg-static? #45

Open haojia321 opened 6 years ago

haojia321 commented 6 years ago

Hi, If I use this package on my cloud server(which may not have ffmpeg installed on the linux server), so can I use ffmpeg-static instead? Something like this: https://www.npmjs.com/package/ffmpeg-static

Aspvik commented 6 years ago

Did you figure it out?

gavinwilliams commented 6 years ago

This works fine with ffmpeg-static. You just need to set ffmpeg.bin to ffmpeg-static.path like the below in ES6.

import ffmpeg_static from 'ffmpeg-static'
import ffmpeg from 'ffmpeg'
ffmpeg.bin = ffmpeg_static.path

From here, you're free to use ffmpeg however you like.

link-duan commented 5 years ago

This works fine with ffmpeg-static. You just need to set ffmpeg.bin to ffmpeg-static.path like the below in ES6.

import ffmpeg_static from 'ffmpeg-static'
import ffmpeg from 'ffmpeg'
ffmpeg.bin = ffmpeg_static.path

From here, you're free to use ffmpeg however you like.

dont work: image

jens1o commented 5 years ago

@yaphper You need to install ffmpeg(the binary itself) before using a wrapper that eases making commands to ffmpeg.

haojia321 commented 5 years ago

@jens1o I cannot manage the cloud server so I cannot manually install anything on the server. when you say "ffmpeg binary", you mean i need to manually install it on the server, right?

haojia321 commented 5 years ago

Im using Mac and I got this error:

I20190221-00:41:12.175(-5)? /bin/sh: ffmpeg: command not found I20190221-00:41:12.176(-5)? I20190221-00:41:12.176(-5)? at ChildProcess.exithandler (child_process.js:275:12) I20190221-00:41:12.176(-5)? at emitTwo (events.js:126:13) I20190221-00:41:12.176(-5)? at ChildProcess.emit (events.js:214:7) I20190221-00:41:12.176(-5)? at maybeClose (internal/child_process.js:925:16) I20190221-00:41:12.176(-5)? at Socket.stream.socket.on (internal/child_process.js:346:11) I20190221-00:41:12.176(-5)? at emitOne (events.js:116:13) I20190221-00:41:12.176(-5)? at Socket.emit (events.js:211:7) I20190221-00:41:12.176(-5)? at Pipe._handle.close [as _onclose] (net.js:554:12) I20190221-00:41:12.177(-5)? killed: false, I20190221-00:41:12.177(-5)? code: 127, I20190221-00:41:12.177(-5)? signal: null, I20190221-00:41:12.177(-5)? cmd: 'ffmpeg -i assets/app/uploads/uploadedFiles/8tRvc3eGQwf5q6bDg.mp4 -vf "scale=\'min(854,iw)\':\'min(480,ih)\':force_original_aspect_ratio=decrease,pad=854:480:(ow-iw)/2:(oh-ih)/2" -r 24 -c:v libx264 -b:v 1M -maxrate 1.5M -bufsize 1M assets/app/uploads/uploadedFiles/8tRvc3eGQwf5q6bDg-480P.mp4' } null

W20190221-00:21:07.641(-5)? (STDERR) fs.js:948 W20190221-00:21:07.642(-5)? (STDERR) binding.stat(pathModule._makeLong(path)); W20190221-00:21:07.642(-5)? (STDERR) ^ W20190221-00:21:07.642(-5)? (STDERR) W20190221-00:21:07.642(-5)? (STDERR) TypeError: path must be a string or Buffer W20190221-00:21:07.642(-5)? (STDERR) at Object.fs.statSync (fs.js:948:11) W20190221-00:21:07.643(-5)? (STDERR) at Object.statSync (/Users/i839603/eduees/code/prototypes/videoprocessor/node_modules/graceful-fs/polyfills.js:297:22) W20190221-00:21:07.643(-5)? (STDERR) at server/main.js:61:60 W20190221-00:21:07.643(-5)? (STDERR) at /Users/i839603/eduees/code/prototypes/videoprocessor/node_modules/ffmpeg/lib/video.js:583:5 W20190221-00:21:07.643(-5)? (STDERR) at /Users/i839603/eduees/code/prototypes/videoprocessor/node_modules/ffmpeg/lib/utils.js:20:3 W20190221-00:21:07.643(-5)? (STDERR) at ChildProcess.exithandler (child_process.js:282:5) W20190221-00:21:07.643(-5)? (STDERR) at emitTwo (events.js:126:13) W20190221-00:21:07.644(-5)? (STDERR) at ChildProcess.emit (events.js:214:7) W20190221-00:21:07.644(-5)? (STDERR) at maybeClose (internal/child_process.js:925:16) W20190221-00:21:07.644(-5)? (STDERR) at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

jens1o commented 5 years ago

you mean i need to manually install it on the server, right?

yeah. This is just a wrapper to make you more comfortable writing ffmpeg commands.

haojia321 commented 5 years ago

@jens1o do you know if there is any package that doesnt need manually install ffmpeg on the server? The cloud im using doesnt allow install software.

jens1o commented 5 years ago

Nope. Hosting the stuff yourself isn't an option, which would also benefit user privacy?

Zaphiruz commented 4 years ago

Had the same issue. video.js still has a hardcoded 'ffmpeg'

kodie commented 2 years ago

Just in case anyone else runs into this, I have made a fork that makes the ffmpeg executable configurable: #88

morgan-wild commented 4 months ago

UP! ^^