Object
# File lib/headless/video/video_recorder.rb, line 7 def initialize(display, dimensions, options = {}) CliUtil.ensure_application_exists!('ffmpeg', 'Ffmpeg not found on your system. Install it with sudo apt-get install ffmpeg') @display = display @dimensions = dimensions @pid_file_path = options.fetch(:pid_file_path, "/tmp/.headless_ffmpeg_#{@display}.pid") @tmp_file_path = options.fetch(:tmp_file_path, "/tmp/.headless_ffmpeg_#{@display}.mov") @log_file_path = options.fetch(:log_file_path, "/dev/null") @codec = options.fetch(:codec, "qtrle") @frame_rate = options.fetch(:frame_rate, 30) end
# File lib/headless/video/video_recorder.rb, line 20 def capture_running? CliUtil.read_pid @pid_file_path end
# File lib/headless/video/video_recorder.rb, line 24 def start_capture CliUtil.fork_process("#{CliUtil.path_to('ffmpeg')} -y -r #{@frame_rate} -g 600 -s #{@dimensions} -f x11grab -i :#{@display} -vcodec #{@codec} #{@tmp_file_path}", @pid_file_path, @log_file_path) at_exit do exit_status = $!.status if $!.is_a?(SystemExit) stop_and_discard exit exit_status if exit_status end end
Generated with the Darkfish Rdoc Generator 2.