Skip to content

Few ideas #88

@mits87

Description

@mits87

Hello,

I have a few things about the headless gem and video recording.

  1. How can I hide the mouse cursor?
  2. In method stop_and_save in VideoRecorder class good option is add mkdir_p before mv
def stop_and_save(path)
  Recorder::CliUtil.kill_process(@pid_file_path, :wait => true)
  if File.exists? @tmp_file_path
    begin
      **FileUtils.mkdir_p(File.dirname(path))**
      FileUtils.mv(@tmp_file_path, path)
    rescue Errno::EINVAL
      nil
    end
  end
end

what do you think?

  1. In method command_line_for_capture in VideoRecorder class is a small bug:

Before (look on @Devices position in array):

[
 CliUtil.path_to(provider_binary_path),
 "-y",
 "-r #{@frame_rate}",
 "-s #{dimensions}",
 "-f x11grab",
@devices,
 "-i :#{@display}",
 group_of_pic_size_option,
 "-vcodec #{@codec}",
 @extra,
 @tmp_file_path
].flatten.compact.join(' ')

After:

[
 CliUtil.path_to(provider_binary_path),
 "-y",
 "-r #{@frame_rate}",
 "-s #{dimensions}",
 "-f x11grab",
 "-i :#{@display}",
 @devices,
 group_of_pic_size_option,
 "-vcodec #{@codec}",
 @extra,
 @tmp_file_path
].flatten.compact.join(' ')

Could you fix it?

  1. Good idea is add something like post_processing_video method or yield that will be triggered in method stop_and_save before FileUtils.mv(@tmp_file_path, path) command. For instance:
def stop_and_save(path, &block)
  Recorder::CliUtil.kill_process(@pid_file_path, :wait => true)
  if File.exists? @tmp_file_path
    begin
      FileUtils.mkdir_p(File.dirname(path))
      yield(@tmp_file_path) if block_given?
      FileUtils.mv(@tmp_file_path, path)
    rescue Errno::EINVAL
      nil
    end
  end
end

This solution will be very helpful for add watermark or other operation after recording.
What do you think?

  1. Last one question: how can I stop recording from bash or external script if I know screen number?

Best Regards
Peter

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions