qawolf / playwright-video

🎬 Save a video of a Playwright page
BSD 3-Clause "New" or "Revised" License
194 stars 17 forks source link

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

Open Akarshit opened 4 years ago

Akarshit commented 4 years ago

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.

jperl commented 4 years ago

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.

rememberlenny commented 4 years ago

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.

Akarshit commented 3 years ago

@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?

rememberlenny commented 3 years ago

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