目前仍然在初期开发阶段。
- Use packege manager(apt/yum...) to install ffmpeg library or compile from source with libx264 ,libpulse(linux)/openal(windows) support.
npm install
cd src
make libff.so && make install
(linux) ormake libff.dll && make win_install
(windows)
var ff = require('ff-live');
//register parameter and callback for output
//( video_size , framerate , video_bitrate, audio_bitrate, sendPacketCallback)
ff.ff_init( 'hd1080', 30 , 1000000 , 128000, (chunk) =>{
//deal with the fragment mp4 segment.
...
});
//start capture and call callback when encoded one packet , this function is unblock
ff.start_loop();
//stop capture, block until finish
ff.stop_loop();
//free memory
ff.quit();
cd demo
npm install
node index.js &
npm run web
- open http://localhost:8080/ in browser
- click connect or disconnect