
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
ffmpeg-screenrecorder
Advanced tools
Ruby gem to record your computer screen - desktop or specific application/window - using FFmpeg. Primarily geared towards recording automated UI test executions for easy debugging and documentation.
Supports Windows and Linux as of version 1.0.0-beta5
. macOS support will be added before the final release of v1.0.0
.
OS | Download |
---|---|
Microsoft Windows | ffmpeg.org#build-windows or libx264 enabled build |
Linux | ffmpeg.org#build-linux |
macOS | ffmpeg.org#build-mac |
Add location of the ffmpeg/bin
folder to PATH
environment variable if using Microsoft Windows (instructions).
Alternatively, you can define the location using FFMPEG.ffmpeg_binary='/path/to/binary'
in your project.
Next, add this line to your application's Gemfile:
gem 'ffmpeg-screenrecorder'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ffmpeg-screenrecorder --pre
Require this gem in your project and start using the gem:
require 'ffmpeg-screenrecorder'
opts = { input: 'desktop',
output: 'recording.mp4' }
@recorder = FFMPEG::ScreenRecorder.new(opts)
@recorder.start
# ... Run tests or whatever you want to record
@recorder.stop
# Recorded file metadata
@recorder.video
#=> #<FFMPEG::Movie:0x00000000067e0a08
@path="recording.mp4",
@container="mov,mp4,m4a,3gp,3g2,mj2",
@duration=5.0,
@time=0.0,
@creation_time=nil,
@bitrate=1051,
@rotation=nil,
@video_stream="h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 2560x1440, 1048 kb/s, 15 fps, 15 tbr, 15360 tbn, 30 tbc (default)",
@audio_stream=nil,
@video_codec="h264 (High 4:4:4 Predictive) (avc1 / 0x31637661)", @colorspace="yuv444p",
@video_bitrate=1048,
@resolution="2560x1440">
require 'watir'
browser = Watir::Browser.new :firefox
FFMPEG::WindowTitles.fetch('firefox') # Name of exe
#=> ["Mozilla Firefox"]
opts = { input: FFMPEG::WindowTitles.fetch('firefox').first,
output: 'recording.mp4' }
@recorder = FFMPEG::ScreenRecorder.new(opts)
@recorder.start
# Run tests or whatever you want to record
@recorder.stop
browser.quit
Limitations
#fetch
only returns titles from currently active (visible) windows.#fetch
may return ArgumentError (invalid byte sequence in UTF-8)
for a window title with non UTF-8
characters.
See #38
for workaround.desktop
is a better option.:input
- 'desktop'
or application window name:output
- Output file location/name:framerate
- Capture FPS:log
- Defaults to ffmpeg.log
:log_level
for this gem. Default: ERRORAll other FFmpeg options can be passed through the advanced
key. This feature is yet to be fully tested, so please feel free to report any bugs or request a feature.
opts = { input: 'desktop',
output: 'recorder-test.mp4',
framerate: 30.0,
log: 'recorder.log',
log_level: Logger::DEBUG, # For gem
advanced: { loglevel: 'level+debug', # For FFmpeg
video_size: '640x480',
show_region: '1' }
}
#
# Command to FFmpeg:
#
# ffmpeg -y -f gdigrab -r 15 -loglevel level+debug -video_size 640x480
# -show_region 1 -i desktop recorder-test.mp4 2> recorder.log
You can find example video recordings here. Cucumber + Watir based example is here.
After checking out the repo, run bin/setup
to install dependencies. Then, run bundle exec rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
.
Bug reports and pull requests are welcome.
bundle exec rake spec
.The gem is available as open source under the terms of the MIT License.
This gem is based on the streamio-ffmpeg gem.
Thanks to SauceLabs for providing me with a free account. If you manage an open source project, you can apply for a free account here.
FAQs
Unknown package
We found that ffmpeg-screenrecorder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.