Streampunk / beamcoder

Node.js native bindings to FFmpeg.
GNU General Public License v3.0
392 stars 76 forks source link

Cannot run in CentOS ,failed when run install_ffmpeg.js #83

Open iwanglian opened 2 years ago

iwanglian commented 2 years ago

I have run in Mac and Ubuntu, but failed in CentOS.

I have installed ffmpeg from source, but when npm install beamcoder, it failed.


ffmpeg version n4.3.3 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-39)
configuration: 
libavutil      56. 51.100 / 56. 51.100
libavcodec     58. 91.100 / 58. 91.100
libavformat    58. 45.100 / 58. 45.100
libavdevice    58. 10.100 / 58. 10.100
libavfilter     7. 85.100 /  7. 85.100
libswscale      5.  7.100 /  5.  7.100
libswresample   3.  7.100 /  3.  7.100```
BrainBust commented 2 years ago

You can still use this library on linux by cloning the repo + ffmpeg and build the module using node-gyp

#!/bin/bash

# remove previous builds
rm -rf beamcoder
rm -rf ffmpeg
rm beamcoder.node

# get repos
git clone https://github.com/Streampunk/beamcoder.git beamcoder
git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg

# build ffmpeg
cd ffmpeg
git checkout release/5.0
./configure
make -j4

# change binding.gyp to point include_dirs for os!=win to local ../ffmpeg repo
cd ..
node ./patch-beamcoder-gyp.js

# build the module
cd beamcoder
node-gyp rebuild

# copy the module
cd ..
cp beamcoder/build/Release/beamcoder.node beamcoder.node

and then use it

const beamcoder = require('./beamcoder.node')

async function test () {

  beamcoder.logging('fatal')
  console.log('Creating demuxer for test.mp4')

  let demuxer = await beamcoder.demuxer('file:./test.mp4')
}

test()

patching binding.gyp can be done manually

"include_dirs": ["../ffmpeg"]