胡斌

support record audio using input device virtual-audio-capturer

webpage_recorder:利用elecron离屏渲染网页,把抓取的页面图像通过pipe传递给ffmpeg,利用ffmpeg编码成视频
环境要求:npm, electron,ffmpeg
环境要求:npm, electron,ffmpeg,virtual-video-capturer(可以从https://sourceforge.net/projects/virtualaudiodev/files/下载)
安装:
npm install
运行命令示例:
;record duration 30s framerate 20fps width 640 height 320 videobitrate 800k
electron . -u http://182.92.9.182:9090/media/hlsPlayer/hlsPlayer.html -d 30 -f 20 -w 640 -h 320 -b 800k test.mp4
electron . -u http://182.92.9.182:9090/media/hlsPlayer/hlsPlayer.html -d 30 -f 20 -w 640 -h 320 -b 800k test.flv
ffmpeg -i test.flv -acodec copy -vcodec copy test.mp4
局限:
1. electron需要在桌面环境下运行
2. 捕获视频间隔不够均匀
3. 还不能捕获声音
... ...
... ... @@ -109,6 +109,12 @@ function startFFmpeg(videosize) {
args.push('-r');
args.push(argv.f);
args.push.apply( args, ['-i', 'pipe:0'] );
// /*
args.push('-f');
args.push('dshow');
args.push('-i');
args.push('audio=virtual-audio-capturer');
//*/
args.push('-vf')
args.push('fps=fps='+argv.f)
args.push('-c:v');
... ... @@ -117,7 +123,9 @@ function startFFmpeg(videosize) {
args.push(argv.b);
args.push('-r:v');
args.push(argv.f);
args.push('-an');
args.push('-acodec');
args.push('aac');
args.push(argv._[0]);
console.log(args.join` `);
... ...
;record duration 30s framerate 20fps width 640 height 320 videobitrate 800k
electron . -u http://182.92.9.182:9090/media/hlsPlayer/hlsPlayer.html -d 30 -f 20 -w 640 -h 320 -b 800k test.mp4
electron . -u http://182.92.9.182:9090/media/hlsPlayer/hlsPlayer.html -d 30 -f 20 -w 640 -h 320 -b 800k test.flv
ffmpeg -i test.flv -vcodec copy -acodec copy test.mp4
... ...