SeleniumHQ / docker-selenium

Provides a simple way to run Selenium Grid with Chrome, Firefox, and Edge using Docker, making it easier to perform browser automation
http://www.selenium.dev/docker-selenium/
Other
8.02k stars 2.51k forks source link

[🚀 Feature]: Add audio in video recording #1509

Open frossigneux opened 2 years ago

frossigneux commented 2 years ago

Feature and motivation

Video recording is supported. However resulting videos have no sound.

I see that this topic has been discussed here: https://github.com/elgalu/docker-selenium/issues/147

Usage example

Run a browser playing a Youtube video. Run a video container to capture it in /tmp/videos/video.mp4. The resulting file should contain audio.

diemol commented 2 years ago

Do you know what are the use cases related to automated testing?

Would you be interested in sending a pull request for this? It should have automated tests to verify that videos actually have audio.

frossigneux commented 2 years ago

My use case is to be able to automatically record websites (with sound and animations). I got the sound in the videos by using a PulseAudio server on the host server, with a unix socket mapped in the docker container. And then I used a gstreamer server to be able to connect with noVNC on one channel and audio on a separate channel.

diemol commented 2 years ago

Would this increase the size of the docker images considerably? We are open to receive a PR for this.

EzrealerQAQ commented 2 years ago

what's progress about record video with audio,thanks~

diemol commented 2 years ago

None at all, this is waiting for contributions.

EzrealerQAQ commented 2 years ago

None at all, this is waiting for contributions.

Record video with audio is realized in elgalu/docker-selenium,use pulseaudio to create virtual sound card,i think the author of selenium/video image could refer it to add this func~

diemol commented 2 years ago

None at all, this is waiting for contributions.

Record video with audio is realized in elgalu/docker-selenium,use pulseaudio to create virtual sound card,i think the author of selenium/video image could refer it to add this func~

Would you like to send a PR with tests to add this?

EzrealerQAQ commented 2 years ago

add

srue,but no time now ,maybe a mouth later~

diemol commented 2 years ago

add

srue,but no time now ,maybe a mouth later~

Looking forward to more contributions that help us move the status of this forward.

diemol commented 2 years ago

@frossigneux @EzrealerQAQ any interest in contributing?

frossigneux commented 2 years ago

Hello, I don't have time to contribute right now, but I gave above the solution that worked for me and you can find attached the corresponding files. I modified the video container and added a nginx server to serve the video and audio over https! deploy.zip

vitalik commented 2 years ago

Hi @frossigneux

just tried your solution, but stuck at making a socket:

pactl load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket
Connection failure: Connection refused
pa_context_connect() failed: Connection refused

any idea ?

frossigneux commented 2 years ago

I guess Pulseaudio is not started. I don't remind exactly how I started it on my server, maybe using systemctl --user start pulseaudio.service.