Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4633

Error with recording headless browser in ruby

$
0
0

We want to create a headless browser and record and stream a page in it. To do this, we use Ferrum and ffmpeg. But there is only one image in the output video, although the video duration is correct.

Code:

require 'ferrum'x = Ferrum::Browser::Xvfb.new(OpenStruct.new({ window_size: [1920, 1080] }))x.startb = Ferrum::Browser.new(xvfb: true, browser_options: { 'display': ":#{x.display_id}" })b.goto 'https://google.com'ffmpeg_command = "ffmpeg -y -video_size 1920x1080 -framerate 25 -f x11grab -i :#{x.display_id} ./output.mp4"pid = spawn(ffmpeg_command)Process.detach(pid)sleep 3Process.kill('SIGINT', pid)Process.kill('SIGINT', x.pid)b.quit

Is it possible to fix this? Or is it necessary to use something else to solve such a problem?


Viewing all articles
Browse latest Browse all 4633

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>