Coder Social home page Coder Social logo

savagecore / node-ffprobe-installer Goto Github PK

View Code? Open in Web Editor NEW
69.0 4.0 30.0 590.36 MB

Platform independent binary installer of FFprobe for node projects

Home Page: https://www.npmjs.com/package/@ffprobe-installer/ffprobe

JavaScript 100.00%

node-ffprobe-installer's Introduction

node-ffprobe-installer

All Contributors

npm npm xo

Build Status Codecov

Platform independent binary installer of FFprobe for node projects. Useful for tools that should "just work" in multiple environments.

Installs a standalone static binary of ffprobe for the current platform and provides a path and version. Supports Linux, Windows 7+, and MacOS 10.9+.

A combination of package.json fields optionalDependencies, cpu, and os lets the installer only download the binary for the current platform. See also Warnings during install.

Supports Node >= 14.21.2

Install

npm install --save @ffprobe-installer/ffprobe

Usage examples

const ffprobe = require('@ffprobe-installer/ffprobe');
console.log(ffprobe.path, ffprobe.version);
const ffprobePath = require('@ffprobe-installer/ffprobe').path;
const spawn = require('child_process').spawn;
const ffprobe = spawn(ffprobePath, args);
ffprobe.on('exit', onExit);
const ffprobePath = require('@ffprobe-installer/ffprobe').path;
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfprobePath(ffprobePath);

Warnings during install

To automatically choose the binary to install, optionalDependencies are used. This currently outputs warnings in the console, an issue for that is tracked by the npm team here.

Known Issues

AWS and/or Elastic Beanstalk

If you get permissions issues, try adding a .npmrc file with the following:

unsafe-perm=true

See node-ffmpeg-installer/issues/21

Wrong path under Electron with Asar enabled

It's a known issue that Asar breaks native paths. As a workaround, if you use Asar, you can do something like this:

const ffprobePath = require('@ffprobe-installer/ffprobe').path.replace(
	'app.asar',
	'app.asar.unpacked'
);

The binaries

Downloaded from the sources listed at ffmpeg.org:

For version updates, submit issue or pull request.

Upload new versions

In every updated platforms/* directory:

npm run upload

See also

Contributors โœจ

Thanks goes to these wonderful people (emoji key):

Jonas Dautel
Jonas Dautel

๐Ÿ’ป
Kiko Beats
Kiko Beats

๐Ÿ’ป
Kaan Ozdokmeci
Kaan Ozdokmeci

๐Ÿ“–
Sergio Maria Matone
Sergio Maria Matone

๐Ÿ’ป
Sebastian
Sebastian

๐Ÿ’ป
Wong Yiu Hang
Wong Yiu Hang

๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind are welcome!

node-ffprobe-installer's People

Contributors

allcontributors[bot] avatar carsonf avatar cgdibble avatar cseitz avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar kaandok avatar kikobeats avatar kribblo avatar marcelblum avatar savagecore avatar snrse avatar sw360cab avatar wongyiuhang avatar xemle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-ffprobe-installer's Issues

throws Error: EACCES: permission denied

Hi

I know this has been raised already but I'm trying to use the package from NPM on AWS Lambda in exactly the same way as the node-ffmpeg-installer. When running fluent ffmpeg with ffprobe I'm getting this error. I have tried to copy the executable to a temp file and change the permissions as in (#12) but I cannot get it to work.

Any help much appreciated.

Executing Permissions for all for binaries

Differently from its sibling node-ffmpeg-installer, the executables for ffprobe comes without "execution permissions for all" (a+x) [at least in the linux_x64 version].
Although this is not a problem for the correctness of the module itself, it represents a limitation in environments such as AWS Lambda which requires "execution permissions for all" to execute binaries.

Cannot find module '@ffprobe-installer/linux-x64/ffprobe'

While deploying code on Vercel this package gives this error, using node 18 which is the latest version of @ffprobe-installer/ffprobe, However, it works fine on my local machine.

My Code:

import { path as ffprobePath } from '@ffprobe-installer/ffprobe';

router.get("/get-ffprobe", async (req, res) => {
    res.status(200).json({ ffprobePath })
})

Error:

Cannot find module '@ffprobe-installer/linux-x64/ffprobe'
Require stack:
- /var/task/node_modules/@ffprobe-installer/ffprobe/index.js
Did you forget to add it to "dependencies" in `package.json`?

permissions issues with darwin-arm64 version

First many thanks for providing what appears to be the only static prebuild of ffprobe for darwin-arm64 on the web.

I noticed the ffprobe binary as npm-installed comes with unusual permissions. It's -rwxr--r-- which leads to some weirdness at least on a new Mac with default settings. On my M1 Mac just out of the box, ffprobe can only run from the terminal successfully using sudo. In Finder, macOS won't even give it the 'unix executable' icon and it can't be double clicked to open in Terminal. And it fails to run from within any Node process with an access denied. I was able to fix it locally by doing a quick chmod 777 ffprobe and then all was fine.

Happy to submit the modded binary as a pr if that helps, though honestly I don't know enough about how npm install handles unix permissions on downloaded files to know whether the permissions metadata even carries over when npm fetches the file (or for that matter when I push a git commit with it). Or whether this is an issue better handled by the install script instead.

Related: #12

pnpm install at macOS will cause error because of permission

Enviroment

OS: Mac M1 Max Ventura 13.2.1
node: 18.14.2
package manager: pnpm 8.5.1
package version: 2.1.0

Reproduce

  1. pnpm store should have node-ffprobe-installer
  2. delete node_module and reinstall package by pnpm
  3. Permission error happened

Context

When using pnpm to install package.
Shell "ffprobe" will be download at ~/{projectPath}/node_modules/.pnpm/@[email protected]/node_modules/@ffprobe-installer/darwin-arm64

image

As you can with the picture below, shell ffprobe permission did not change with the script postinstall

I believe that it comes from pnpm v7 change: default open ใ€Œside-effects-cacheใ€
And here is pnpm issue reference.

Solution

Add side-effects-cache=false in the .npmrc should work.

But it will let us losing some benefit of using pnpm.

Customize target architecture via npm

Hey!
We are currently using node-ffprobe-installer in our electron project.
Since we are building our Apps on the same respective platform but for different target architectures it would nice to customize the target architecture via npm environment variables.

Example:
ffmpeg-static/install.js

const arch = process.env.npm_config_arch || os.arch()
const platform = process.env.npm_config_platform || os.platform()

We would be very happy if that option would be included in the ffprobe installer too.

Critical dependency: the request of a dependency is an expression

https://github.com/caffco/get-video-duration depends on ffprobe-installer. Getting this warning after adding get-video-duration package to my project.

webpacker_1      | WARNING in ./node_modules/@ffprobe-installer/ffprobe/index.js 33:16-36
webpacker_1      | Critical dependency: the request of a dependency is an expression
webpacker_1      |     at CommonJsRequireContextDependency.getWarnings (/usr/src/app/node_modules/webpack/lib/dependencies/ContextDependency.js:40:18)
webpacker_1      |     at Compilation.reportDependencyErrorsAndWarnings (/usr/src/app/node_modules/webpack/lib/Compilation.js:1454:24)
webpacker_1      |     at /usr/src/app/node_modules/webpack/lib/Compilation.js:1258:10
webpacker_1      |     at AsyncSeriesHook.eval [as callAsync] (eval at create (/usr/src/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:20:1)
webpacker_1      |     at AsyncSeriesHook.lazyCompileHook (/usr/src/app/node_modules/tapable/lib/Hook.js:154:20)
webpacker_1      |     at Compilation.finish (/usr/src/app/node_modules/webpack/lib/Compilation.js:1253:28)
webpacker_1      |     at /usr/src/app/node_modules/webpack/lib/Compiler.js:672:17
webpacker_1      |     at _done (eval at create (/usr/src/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
webpacker_1      |     at eval (eval at create (/usr/src/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:30:22)
webpacker_1      |     at /usr/src/app/node_modules/webpack/lib/Compilation.js:1185:12
webpacker_1      |     at /usr/src/app/node_modules/webpack/lib/Compilation.js:1097:9
webpacker_1      |     at processTicksAndRejections (internal/process/task_queues.js:79:11)

Looks like the reason of this error is in ffprobe-installer

Also I have this error in browser console

Uncaught Error: Unsupported platform/architecture: browser-javascript
    at Object.<anonymous> (index.js:15:1)
    at ./node_modules/@ffprobe-installer/ffprobe/index.js (index.js:44:1)
    at __webpack_require__ (bootstrap:63:1)
    at ./node_modules/get-video-duration/dist/es6/index.js (index.js:44:1)
    at __webpack_require__ (bootstrap:63:1)
    at ./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./app/javascript/components/common/VideoUploader/VideoUploader.vue?vue&type=script&lang=js& (VideoUploader.vue:31:1)
    at __webpack_require__ (bootstrap:63:1)
    at ./app/javascript/components/common/VideoUploader/VideoUploader.vue?vue&type=script&lang=js& (VideoUploader.vue?fd85:1:1)
    at __webpack_require__ (bootstrap:63:1)
    at ./app/javascript/components/common/VideoUploader/VideoUploader.vue (VideoUploader.vue:1:1)

Environment:

  • NODE_VERSION 12.22.12
  • VueJS 2.7.10
  • OS: Ubuntu 20.04

I'm looking for a reason, but I would be great to have a little assist.

On some systems, resolving Google Drive fails

We have encountered an issue with GoogleDrive on some of our developer systems.

We are using ffprobe @ 1.1.0, which depends on
"@ffprobe-installer/linux-x64": "4.1.0",
which installs this version:

ffprobe version N-48944-g9b069eb14e-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2019 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516

And when I run this binary:

./node_modules/@ffprobe-installer/linux-x64/ffprobe  "https://drive.google.com/uc?export=download&id=1xSCWuqKG-YRhqE0LnuazY5bYTSqo3nC4"
ffprobe version N-48944-g9b069eb14e-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 28.100 / 56. 28.100
  libavcodec     58. 52.102 / 58. 52.102
  libavformat    58. 27.103 / 58. 27.103
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 54.101 /  7. 54.101
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[tcp @ 0x7011dc0] Failed to resolve hostname doc-0k-30-docs.googleusercontent.com: System error
https://drive.google.com/uc?export=download&id=1xSCWuqKG-YRhqE0LnuazY5bYTSqo3nC4: Input/output error                   

The key is in the penultimate line:
[tcp @ 0x7011dc0] Failed to resolve hostname doc-0k-30-docs.googleusercontent.com: System error

Note that simply running the ffprobe that I have on my own system, the same command runs without any errors.
So I guess it must be the ffprobe version in question, or one of the statically linked libraries.

The trick is that at another developer box, the same issue doesn't manifest... so it might be tricky to test this.
(I am willing to help.)

I guess we should move away from the ffprobe build from 2017?

Thanks.

custom target faild

My computer is mac intel and I want to build mac arm platform. I have tested the following two npm commands, both are installed on the mac x64 version of ffprobe. I see that the source code has the operation of reading environment variables inside, I don't know why this problem occurs?

cmd:

"scripts": {
"test": "cross-env npm_config_platform=darwin npm_config_arch=arm64 npm i @ffprobe-installer/ffprobe",
"build": "rm -rf ./release/app/node_modules && electron-builder build --darwin --arm64"
},

Sent from PPHub

Support for darwin-arm64

I got an error Unsupported platform/architecture: darwin-arm64 on my Macbook pro M1;
Support for M1 maybe awesome for node-ffprobe-installer

segfault when probing any web video

Running ffprobe on a video URL always crashes. Running it on a local video file works fine, however.

Example output of /path/to/node_modules/@ffprobe-installer/linux-x64/ffprobe -i <any_video_url>:

ffprobe version N-48944-g9b069eb14e-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 28.100 / 56. 28.100
  libavcodec     58. 52.102 / 58. 52.102
  libavformat    58. 27.103 / 58. 27.103
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 54.101 /  7. 54.101
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Segmentation fault

The file format of the video seems to make no difference.

Meanwhile, running the system-installed ffprobe (I'm using Fedora 32) works just fine. It has the following version information:

ffprobe version 4.2.4 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 10 (GCC)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld ' --extra-cflags=' ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-libjack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librsvg --enable-libsrt --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-version3 --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-libzvbi --enable-avfilter --enable-avresample --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100

This issue affects https://github.com/dyc3/opentogethertube (see dyc3/opentogethertube#297).

NPM Version 1.4.0 was supposed to update darwin-arm64 FFprobe, it didn't

https://www.npmjs.com/package/@ffprobe-installer/ffprobe - updated from version 1.3.0 to 1.4.0

https://www.npmjs.com/package/@ffprobe-installer/darwin-arm64 - didn't get a version update, currently at 5.0.0 making npm download the old version of ffprobe 1dd6aab8b1880c44cc98db96f950634ad701848a supposed to be 384491447b76b483cfd32c99e9f6327f201e19a3

platforms/darwin-arm64 needs to be uploaded for NPM to recognize new ffprobe binary 384491447b76b483cfd32c99e9f6327f201e19a3

As stated README.md

Upload new versions

In every updated platforms/* directory:

npm run upload

Support for linux-arm

While testing the project, I encouter : Unsupported platform/architecture: linux-arm
Would be nice to have a support for node-ffprobe-installer on linux-arm

Error on Alpine Linux 3.8

I use this on multiple Linux distros and it works (like a charm) on all except Alpine Linux 3.8 (launched in a docker container).

I get the error:
Failed to resolve hostname s3.amazonaws.com: Name or service not known

I installed ffmpeg in the container directly using the alpine linux package manager (apk) (apk add ffmpeg) and I see that the version installed is different from this (which is understandable) but it doesn't return the same error when an ffprobe is attempted.
See the different versions:

  • ffprobe from this library
./ffprobe https://s3.amazonaws.com/XXXXXXXXXXXXX.mp4
ffprobe version N-48944-g9b069eb14e-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 28.100 / 56. 28.100
  libavcodec     58. 52.102 / 58. 52.102
  libavformat    58. 27.103 / 58. 27.103
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 54.101 /  7. 54.101
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[tcp @ 0x555556a58440] Failed to resolve hostname s3.amazonaws.com: Name or service not known
https://s3.amazonaws.com/XXXXXXXXXXXXX.mp4: Input/output error
  • ffprobe installed by apk
ffprobe https://s3.amazonaws.com/XXXXXXXXXXXX.mp4
ffprobe version 3.4.6 Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 6.4.0 (Alpine 6.4.0)
  configuration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --disable-debug
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://s3.amazonaws.com/XXXXXXXXXXXXX.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:35:00.02, start: 0.000000, bitrate: 221 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 138 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 76 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

Any ideas why this is happening?

ffprobe EACCES after deploying lamda function

Hi, I get this error after deploying my function to aws lamda. it works well locally
{
"errorType": "Error",
"errorMessage": "spawn /var/task/node_modules/@ffprobe-installer/linux-arm64/ffprobe EACCES",
"trace": [
"Error: spawn /var/task/node_modules/@ffprobe-installer/linux-arm64/ffprobe EACCES",
" at ChildProcess._handle.onexit (node:internal/child_process:283:19)",
" at onErrorNT (node:internal/child_process:476:16)",
" at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"
]
}

this is my code

`const ffprobePath = require('@ffprobe-installer/ffprobe').path;

ffmpeg.setFfprobePath(ffprobePath);`

Thanks

Command was killed with SIGSEGV

Hello, i was trying execa with ffprobe for get video meta data.
And i get response error Command was killed with SIGSEGV. Like in image.

Any solving from this error?

image


Spec VM:

  • Ubuntu 22.04 LTS
  • RAM 4GB
  • Disk 20GB
  • Node 14.18.2

My Code:

import * as execa from 'execa';
import * as ffprobe from '@ffprobe-installer/ffprobe';

private async isValidDuration(videoUrl: string) {
  try {
    if (!videoUrl) return true;

    const params = ['-v', 'error', '-show_format', '-show_streams'];
    const { stdout } = await execa(ffprobe.path, [...params, videoUrl]);

    const duration = stdout.match(/duration="?(\d*\.\d*)"?/)[1];

    if (Number(duration) > 60) {
      return false;
    }

    return true;
  } catch (_) {
    return true;
  }
}

Yarn PnP support

Hello,

currently this package makes fixed assumptions about the node_modules folder, which is not a given when using Yarn 2 in Plug-and-Play mode.

It would be better to use require.resolve(), e.g.

// this here
const npm3Path = path.resolve(__dirname, '..', target);

// becomes this
const npm3Path = require.resolve('@ffprobe-installer/' + target + '/' + binary)

// example
require.resolve('@ffprobe-installer/win32-x64/ffprobe.exe')

// returns
const result = 'C:\\Users\\user\\dev\\project\\.yarn\\unplugged\\@ffprobe-installer-win32-x64-npm-5.0.0-6664c83f60\\node_modules\\@ffprobe-installer\\win32-x64\\ffprobe.exe';

Requiring package via variable breaks package

My operating environment is as follows:
macOS 11.23
electron 13.0.1

Run the following code in the main process of electron:

const FfmpegCommand = require('fluent-ffmpeg');
import {path as ffmpegPath} from'@ffmpeg-installer/ffmpeg';
command = new FfmpegCommand({
     source: item.m3u8
   });
command.setFfmpegPath(ffmpegPath)

node reported an error: not find XXXXX
XXXX is the value of npm3Package

After testing, it is caused by the use of variables in require,
In line 35 of the file @ffmpeg-installer/ffmpeg/index.js:
packageJson = require(npm3Package);
I modified it to:
packageJson = require(''+npm3Package);
The program can run normally, so...

Release 1.4.2 introduced breaking changes for older NodeJS 14.x

Hey, just to let you aware that this last release breaks for some older NodeJS versions before 14.21.2. In my case, due this commit.

I understand that I should keep my NodeJS versions updated to LTS, what is not always simple and can trick us in some CI runs and production.

But anyway, it is just to help people who maybe is having the same issue since the last release.

darwin-arm64 - missing /opt/homebrew/Cellar/ffmpeg/4.4.1_3/lib/libavdevice.58.dylib

ffprobe doesn't work unless brew install ffmpeg gets executed before hand

Error: ffprobe was killed with signal SIGABRT
dyld[47947]: Library not loaded: /opt/homebrew/Cellar/ffmpeg/4.4.1_3/lib/libavdevice.58.dylib

  • Referenced from: /Users/mohamedbakoush/Documents/GitHub/WatchVideoByLink/node_modules/@ffprobe-installer/darwin-arm64/ffprobe
  • Reason: tried: '/opt/homebrew/Cellar/ffmpeg/4.4.1_3/lib/libavdevice.58.dylib' (no such file), '/usr/local/lib/libavdevice.58.dylib' (no such file), '/usr/lib/libavdevice.58.dylib' (no such file)

Setup: ffluent-ffmpeg

const ffmpeg = require("fluent-ffmpeg");
const ffprobePath = require("@ffprobe-installer/ffprobe");
ffmpeg.setFfprobePath(ffprobePath.path);

but when brew install ffmpeg gets executed ffprobe works as expected

@ffprobe-installer/ffprobe: Version 1.3.0
System: macOS Monterey, Version 12.0, Apple M1 Pro

.git is pusblished at npm

The latest build under gitlab CI throw me the following error:

$ NODE_ENV=development npm install
npm ERR! path /node_modules/@ffprobe-installer/ffprobe
npm ERR! code EISGIT
npm ERR! git /node_modules/@ffprobe-installer/ffprobe: Appears to be a git repo or submodule.
npm ERR! git     /node_modules/@ffprobe-installer/ffprobe
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-05-30T17_02_51_899Z-debug.log

The error is saying npm doesn't like an npm package with .git folder inside.

I did a fresh install to check if the .git folder has been part of the npm package, and there it is:

~/Downloads/test/node_modules/@ffprobe-installer/ffprobe
โฏ l
drwxr-xr-x    - josefranciscoverdugambin staff 30 May 19:28 ./
.rw-r--r-- 6.1k josefranciscoverdugambin staff 26 Oct  1985 โ”œโ”€โ”€ .DS_Store
.rw-r--r--  205 josefranciscoverdugambin staff 26 Oct  1985 โ”œโ”€โ”€ .editorconfig
drwxr-xr-x    - josefranciscoverdugambin staff 30 May 19:28 โ”œโ”€โ”€ .git/
.rw-r--r--  116 josefranciscoverdugambin staff 26 Oct  1985 โ”œโ”€โ”€ .gitattributes
drwxr-xr-x    - josefranciscoverdugambin staff 30 May 19:28 โ”œโ”€โ”€ .nyc_output/
.rw-r--r--   78 josefranciscoverdugambin staff 26 Oct  1985 โ”œโ”€โ”€ .tidelift.yml
.rw-r--r--  168 josefranciscoverdugambin staff 26 Oct  1985 โ”œโ”€โ”€ .travis.yml
.rw-r--r--  429 josefranciscoverdugambin staff 26 Oct  1985 โ”œโ”€โ”€ appveyor.yml
.rw-r--r--  660 josefranciscoverdugambin staff 26 Oct  1985 โ”œโ”€โ”€ coverage.lcov
.rw-r--r-- 1.3k josefranciscoverdugambin staff 26 Oct  1985 โ”œโ”€โ”€ index.js
drwxr-xr-x    - josefranciscoverdugambin staff 30 May 19:28 โ”œโ”€โ”€ lib/
.rw-r--r-- 2.4k josefranciscoverdugambin staff 30 May 19:28 โ”œโ”€โ”€ package.json
.rw-r--r-- 4.1k josefranciscoverdugambin staff 26 Oct  1985 โ”œโ”€โ”€ README.md
.rw-r--r--  465 josefranciscoverdugambin staff 26 Oct  1985 โ””โ”€โ”€ test.js

Ideally, we can declare files field at package.json to just be sure a subset of files are shipped at npm:

{
  "files": [
    "index.js",
    "lib",
    "platform"
  ]
}

Bump linux binaries

Linux binaries look to be 1.5 years old.
Website linked has builds for 20230721.
I would PR but I wouldn't expect binaries to be accepted from outside contributors.

Could not find ffprobe executable with nest.js

Error: Could not find ffprobe executable, tried "/Users/fenfil/Projects/back/dist/apps/api/node_modules/ffprobe-darwin-arm64/ffprobe" and "/Users/fenfil/Projects/back/dist/apps/api/src/node_modules/ffprobe-darwin-arm64/ffprobe"

Actual executable is in "/Users/fenfil/Projects/back/node_modules/ffprobe-darwin-arm64/ffprobe""

Not working with pkg binaries

It seems that using __dirname instead of './' in npm3Path and npm2Path connstant cause this issue, after changing it, it started working inside the binaries

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.