Records audio/video separately as wav/webm. Emits both files using socket.io. Socket.io server end receives emitted data; and writes wav/web files to disk. Node.js code invokes ffmpeg to merge wav/webm in single webm file. Socket.io server emits merged ev
npm install recordrtc-socketio// to run it!node ./node_modules/recordrtc-socketio/server.js
There are some other NPM packages regarding RecordRTC:
mergedevent; and passes-back the URL of the merged file
Client side stuff:
var socketio = ;var files =audio:name: fileName + '.wav'type: 'audio/wav'dataURL: dataURLaudiovideo:name: fileName + '.webm'type: 'video/webm'dataURL: dataURLvideo;socketio;
Server side code that captures above data:
After merging; server side code that passes back the URL of the merged file:
Client-side code that receives merged-file URL:
merger.bat file is executed to invoke ffmpeg functionalities on windows:
@echo off"C:\ffmpeg\bin\ffmpeg.exe" -i %1 -i %2 %3
It is assumed that you already have installed ffmpeg on your system. Though, EXE file is hard-coded to "C:\ffmpeg\bin\ffmpeg.exe" however you can easily edit it according to your own installations.
merger.sh file is executed to invoke ffmpeg functionalities on Mac/Linux/etc.
ffmpeg -i video-file.webm -i audio-file.wav -map 0:0 -map 1:0 output-file-name.webm
Using Linux; ffmpeg installation is super-easy! You can install DEVEL packages as well.
Make sure you have homebrew installed. Then run following command:
brew install ffmpeg --with-libvpx --with-theora --whit-libogg --with-libvorbis
In the node.js command prompt window; type
node server. It will run socket.io server at port 8888. Then you can open index.html file on any webserver.