prasanaworld / puppeteer-screen-recorder

A powerful plugin for recording with Puppeteer.
https://prasanaworld.github.io/puppeteer-screen-recorder/classes/puppeteerscreenrecorder.html
MIT License
389 stars 63 forks source link

[Enhancement] :: Support to capture audio #7

Open attac-t opened 3 years ago

attac-t commented 3 years ago
prasanaworld commented 3 years ago

Hi Attac-t,

Thanks for reaching out. As of now, there are no immediate plans to support audio for screen capturing.

But Having said that, if there are more requests/upvotes to enables the audio feature, I can prioritize it.

carlohcs commented 3 years ago

Please, priority it!

ScalaWilliam commented 3 years ago

+1

ScalaWilliam commented 3 years ago

@prasanaworld at a high level what are the steps needed to achieve this?

prasanaworld commented 3 years ago

Hey @ScalaWilliam,

Need a setup listener to listen for audio stream using chrome-dev getRealTimeData method and combine the audio stream with video stream using FFmpeg library.

The problem here is the Audio API of the chrome-dev tool is still under the experimental stage, So it is subject to change and may also break the implementation with browser compatibility issue. so, I'm not inclined toward implementation this feature any sooner as of now.

MiselKING commented 3 years ago

Hi, since audio stream is no go, what do you think about using an external audio source when recording the video? I forked this repo and tried using addInput(pathToAudioFile) (and input(pathToAudioFile)) but I couldn't make it work (I am not that fluent in fluent-ffmpeg ).

Further details on the simplified use-case. Since I need to record screen that has video on it, and I have access to the video, I am considering this approach:

  1. Extract audio from video (I think this is possible using ffmpeg but if there is an easier way, even better)
  2. Record screen (video playing without audio since it cannot be recorded) Is there a way to add audio track in this step so I don't have to do the step 3?
  3. Add audio input to video result (the recorded video) - possible using ffmpeg by using multiple inputs.

Thank you for making this library, right now I believe it is the best solution to screen recording problem.

attac-t commented 3 years ago

Hi @MiselKING, you can achieve this by using pulseaudio on linux. Create a new sink where the headless browser will output its audio and then pass that sink to ffmpeg. You can get the chrome process id from puppeteer.

ScalaWilliam commented 3 years ago

It would be tidier to try to use the Chrome API, it's unlikely they would change it that significantly, and of course, it would work across multiple platforms quite easily, whereas external capture is platform-specific.

kpachbiu88 commented 3 years ago

+1

taejae-han commented 2 years ago

+1

bernardonascimento commented 2 years ago

+1

zhugexiaobo commented 2 years ago

Hey @ScalaWilliam,

Need a setup listener to listen for audio stream using chrome-dev getRealTimeData method and combine the audio stream with video stream using FFmpeg library.

The problem here is the Audio API of the chrome-dev tool is still under the experimental stage, So it is subject to change and may also break the implementation with browser compatibility issue. so, I'm not inclined toward implementation this feature any sooner as of now.

Hi @prasanaworld , So how to deal with the WebAudio.ContextRealtimeData that getRealTimeData method returns? Seems not relate to audio stream.

Yuriy1988 commented 2 years ago

+1

fraguada commented 1 year ago

This is working great for video. Would love to also be able to capture audio!

nicolas-grzybowski commented 1 year ago

+1

nicolas-grzybowski commented 1 year ago

Have you any solution for audio recording ?

lucasscariot commented 1 year ago

Same here, super interested in having audio recording :)

lun3 commented 1 year ago

Please add audio support 🙏🏻

fisherspy commented 1 year ago

+1

Vaib215 commented 1 year ago

add audio support please

JorgenSolli commented 10 months ago

+1! Would love to see this supported

erlapso commented 10 months ago

+1 please support it!

JohnRSim commented 9 months ago

+1 please support it!

Botelho31 commented 2 months ago

In my research about this topic, i don`t think there is any meaningful way to capture Audio using the CDPs WebAudio domain.

I thought about maybe using the Presentation API and the Cast.startTabMirroring method to record it throught the ChromeCast protocol. But it deviates too much from the current library design and could suffer from some delay.

If there is any other method this could be done i would be glad to help, but im failing to see it right now.