playwright-video icon indicating copy to clipboard operation
playwright-video copied to clipboard

feature request: include the browser audio stream in the recorded video

Open Akarshit opened this issue 5 years ago • 4 comments

The video recording works great, but I was also looking to get the audio on the browser and couldn't find any way to do it. I guess because this uses screenCast, it might not be possible, but again I don't know enough.

Akarshit avatar Jun 26 '20 14:06 Akarshit

Thanks @Akarshit, this uses the screencast from chromium devtools protocol, which only has the video frames of the browser and audio is not included.

Using ffmpeg with a screen capture would allow us to get the audio, but that will require that you run the browser on a virtual display which is different across platforms, and would not allow headless mode.

Perhaps it is possible to merge an audio stream from somewhere else, but I am not sure how. I will leave the issue open.

jperl avatar Jun 26 '20 14:06 jperl

In puppeteer, I have successfully been able to make a headful instance of the browser, so accessing audio via the screenCapture api.

I don’t know if it helps, but the implementation to get audio I use is called html2screen. https://github.com/Ventricule/html2screen

For Linux, when you have a docker instance, installing xvfb gives your server a virtual display. With that, you can run a headful instance in Linux as well. This is helpful starting point if you want to package this as a server container.

rememberlenny avatar Sep 20 '20 12:09 rememberlenny

@rememberlenny Hey! I have looked at that package before but was unable to record HD videos using it. Are you able to get HD videos out of it?

If you are only use it for audio, how are you getting rid of sync issues, while merging audio from html2screen and video from playwright?

Akarshit avatar Oct 13 '20 01:10 Akarshit

@Akarshit I didnt end up trying. I've been using html2screen successfully.

rememberlenny avatar Oct 13 '20 01:10 rememberlenny