SamuelScheit / puppeteer-stream

A Library for puppeteer to retrieve audio and/or video streams
MIT License
358 stars 114 forks source link

Have output video appear as normal video file #19

Closed StianWiu closed 2 years ago

StianWiu commented 2 years ago

I understand this might be on purpose to allow easier streaming on websites but I'm not using it for a website and there aren't really any other good alternatives. Is there any way to either convert the file or toggle on/off so it won't be endless?

Anyways I love the project it works great for what it is supposed to do.

SamuelScheit commented 2 years ago

This is because the MediaRecorder of chrome only is able to record webm video. You need to convert it with ffmpeg. See #14 and #9

StianWiu commented 2 years ago

Hi, just another question. I got it to work with your ffmpeg example. But is there anyway to encode it with ffmpeg after it is done recording?

SamuelScheit commented 2 years ago

have a look at the documentation of ffmpeg, you can do all sort of re-encoding and video/audio editing: https://www.ffmpeg.org/

StianWiu commented 2 years ago

One last thing. ffmpeg is absolutely tanking my cpu. I tried adding '-threads 1' but it hasn't made a dent. Know of any ways to minimize cpu usage?

const ffmpeg = exec(`ffmpeg -y -threads 1 -i - ./videos/${filename}-export.mp4`);

Update: I fixed the issue by limiting fps using -r