video recording multiple instances of chrome driver - selenium

I use xvfb to open up a display and run selenium tests in parallel using chromedriver. so you can have multiple chromedrivers running at a time. how can I add video recording so that i can record each session separately? Is there a plugin I can use to add video recording for each selenium session?

You can use ffmpeg or avconv (a fork of ffmpeg) for it.
avconv \
-f x11grab \ # input for grabbing from X11
-r 15 \ # Frame rate
-s 400x300 \ # Size and width of area to capture
-i :0.0 \ # The display number you created with xvfb
-vcodec libx264 \ # the video codec
/tmp/output-file.mp4

Related

virt-install is looking for iso image, when I want to use a qcow2 image

I'm absolutely new to stackoverflow, so I'm extremely sorry if my question has formatting issues.
I created a VM using virt-install:
virt-install \
--name guest \
--memory 2048 \
--vcpus 2 \
--disk size=8 \
--location /var/lib/libvirt/images/centos.iso \
--os-variant centos7.0 \
--check disk_size=off \
--graphics none \
--extra-args console=ttyS0
The above command works fine, but when I want to use a specific image which is a qcow2 image, Virt-install throws the error:
ERROR Command '['isoinfo', '-J', '-i', '/var/lib/libvirt/images/centos.qcow2', '-f']' returned non-zero exit status 1
Looks like virt-install is looking for an isofile since its running the isoinfo command to verify an iso image, eventhough I have a qcow2 image.
I might be able to pass a qcow2 using the --disk parameter instead of --location, but --extra-args only works with --location.
Kindly help me out, thank you in advance!
You seem to be mixing up two different concepts here. The --location flag is intended to provide the installation media, which will be an ISO image or a URL to a installable tree. The --disk flag would be to provide the storage to back the virtual disk of the VM being provisioned, which will typically be a qcow2 file or a raw file, or a block device.
I'm assuming the centos.iso image would be your installation media, and the centos.qcow2 image would be an empty volume for the virtual disk into which you'll install the CentOS guest.

Mediasoup inject stream freezes

I am using the following ffmpeg command to inject an rtmp stream to mediasoup.
ffmpeg \
-re \
-v info \
-stream_loop -1 \
-i rtmp://3.126.121.45:1935/live/stream \
-map 0:a:0 \
-acodec libopus -ab 128k -ac 2 -ar 48000 \
-map 0:v:0 \
-c:v libvpx -minrate 2500k -maxrate 2500k -b:v 2500k -r 30 -g 60 -max_delay 0 -bf 0 -deadline realtime -cpu-used 1 \
-f tee \
"[select=a:f=rtp:ssrc=11111111:payload_type=101]rtp://52.29.30.225:41299?rtcpport=40612&pkt_size=1300|[select=v:f=rtp:ssrc=22222222:payload_type=102]rtp://52.29.30.225:44083?rtcpport=48791&pkt_size=1300"
But the video seems to freeze randomly and plays again. Any idea how I can fix this? Tried the solution given here and here with no luck.
Update: Seems like it is the problem of RTP retransmission when some packets are lost. Unfortunately, ffmpeg doesn't fare well with RTP streaming as mentioned here. Meaning ffmpeg doesn't support retransmission mechanism like nack, pli etc. So considering gstreamer instead as suggested in the mediasoup discourse discussion.

Pipe PhantomJS output to FFmpeg

I am running PhantomJS using Selenium WebDriver (C#).
I'm trying to video record my browser using FFmpeg as shown in the 2 tutorials:
https://mindthecode.com/recording-a-website-with-phantomjs-and-ffmpeg/
https://gist.github.com/phanan/e03f75082e6eb114a35c
As explained in the tutorials, I'll need to pipe output the phantomJS process to ffmpeg.
I know how to add arguments to phantomjs, like the following:
var svz = PhantomJSDriverService.CreateDefaultService();
svz.AddArgument("ffmpeg -y -c:v png -f image2pipe -r 24 -t 10 -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart output.mp4");
var driver = new PhantomJSDriver(svz);
However, I don't know how to add the argument as pipe. I have tried adding the pipe symbol before the actual argument but that doesn't seem to work.
So, my question is, how do I pipe the output of PhantomJS using selenium webdriver?

How to capture screen and audio input and push to rtmp server?

I use avconv on ubuntu,I found this command
avconv -f alsa -i pulse -f x11grab -r 25 -s 1280x720 -i :0.0+0,0 -acodec libfaac -vcodec libx264 -pre:0 lossless_ultrafast -threads 0 video.mkv
to save as a file, and this command
avconv -i ./test.m4v -re -c copy -f flv "rtmp://localhost/livestream"
to push live stream.
How can I combine them together?
Firstly, you should ask such questions on video.stackexchange.com and not here.
Secondly, let's take apart the two commands that you have found:
-f alsa - format for the input is alsa
-i pulse - you are reading pulse (the pulseaudio driver)
-f x11grab - planning to read from the screen on x11
-r 25 -s 1280x720 - rate and size of the incoming video stream
-i :0.0+0,0 - this selects where the incoming video comes from
-acodec libfaac - here the output options start, you're setting audio code to libfaac, or at least trying to... since this option has been deprecated long time ago, currently -c:a would be used
-vcodec libx264 - setting video code, except that you should be using -c:v
-pre:0 lossless_ultrafast -threads 0 - some sort of parameters about how encoding should be done
video.mkv - this is the output file
And the second one
-i ./test.m4v - the file you're reading
-re - "Read input at native frame rate"
-c copy - do not reencode, but simply pipe as is
-f flv - the container format
"rtmp://localhost/livestream" - where you're planning to write all that.
When you understand that, it should be clear that what you are planning to do is to use the input and encoding part from the first command, and the format and output from the second one.
Here i didn't have time to check that everything that you found is working, you should do that yourself.

BASH Script to autologin into browser

I am having some issues with my script. I'm trying to load NagiOS dashboard on the TV using RaspberryPI. This is my current script which opens the browser and directs the user to the page in kiosk mode. I need to be able to feed the login details so this is all done automatically when TV is turned on.
#!/bin/sh
DISPLAY=:0.0 ; export DISPLAY
unclutter &
sleep 30
chromium-browser \
--kiosk \
--ignore-certificate-errors \
--disable-restore-session-state \
http://domain.com &
x11vnc -forever