Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Few ideas #88

Open
mits87 opened this issue Feb 12, 2017 · 1 comment
Open

Few ideas #88

mits87 opened this issue Feb 12, 2017 · 1 comment

Comments

@mits87
Copy link
Contributor

mits87 commented Feb 12, 2017

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

@orangethunder
Copy link

  1. The mouse cursor can be hidden with:

video: { provider: :ffmpeg, devices: ["-draw_mouse 0"] }

I looked around the source code and found it in the specs. The devices key is not mentioned in the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants