screen-recorder 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +97 -0
- data/.rspec +3 -3
- data/.rubocop.yml +35 -1
- data/CHANGELOG.md +5 -2
- data/LICENSE.txt +21 -21
- data/README.md +13 -14
- data/bin/console +0 -0
- data/bin/setup +8 -8
- data/lib/screen-recorder.rb +25 -3
- data/lib/screen-recorder/common.rb +10 -7
- data/lib/screen-recorder/desktop.rb +3 -3
- data/lib/screen-recorder/errors.rb +1 -1
- data/lib/screen-recorder/options.rb +11 -10
- data/lib/screen-recorder/version.rb +1 -1
- data/screen-recorder.gemspec +4 -5
- metadata +11 -17
- data/.travis.yml +0 -42
- data/appveyor.yml +0 -39
- data/support/install_jruby.ps1 +0 -7
- data/support/start_test_reporter.sh +0 -7
- data/support/start_xvfb.sh +0 -5
- data/support/stop_test_reporter.sh +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c04070110a0bb4d14c22683e2e226f68a2245ec8d0ae5ebf098e8a028fc22050
|
4
|
+
data.tar.gz: eac8f6a6036d62a7634fd61b77a0a864ea589aa3b4d2d5e1693f6a813692d4cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cd22bbff801124ed2e3c42d94aa50cf8f568b473dcdff045e150bf25e543d0ff81d7d8a99da78ef2e6d8fffb5e57bc8d00a291dec4b72c7abe8f37453bf5e2e
|
7
|
+
data.tar.gz: ca1af2f484ca9e360dcf94096f7066013e9fe645471c36173d417c589c1cbe12d533bc1269ae44f27fe17a61252a2e1ede833ce9dfc45bcf9daaaeb038866f18
|
@@ -0,0 +1,97 @@
|
|
1
|
+
|
2
|
+
name: Tests
|
3
|
+
|
4
|
+
on: [push, pull_request]
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
lint:
|
8
|
+
runs-on: ubuntu-18.04
|
9
|
+
steps:
|
10
|
+
- name: Cancel any previous run(s) on new commit push
|
11
|
+
uses: styfle/cancel-workflow-action@0.8.0
|
12
|
+
with:
|
13
|
+
access_token: ${{ secrets.GITHUB_TOKEN }}
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- name: Set up Ruby
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: 2.5
|
19
|
+
bundler-cache: true
|
20
|
+
- name: Run rubocop
|
21
|
+
run: bundle exec rake rubocop
|
22
|
+
|
23
|
+
test-ubuntu:
|
24
|
+
runs-on: ubuntu-latest
|
25
|
+
strategy:
|
26
|
+
matrix:
|
27
|
+
ruby-version: [2.7, jruby]
|
28
|
+
env:
|
29
|
+
DISPLAY: ":0"
|
30
|
+
steps:
|
31
|
+
- name: Cancel any previous run(s) on new commit push
|
32
|
+
uses: styfle/cancel-workflow-action@0.8.0
|
33
|
+
with:
|
34
|
+
access_token: ${{ secrets.GITHUB_TOKEN }}
|
35
|
+
- uses: actions/checkout@v2
|
36
|
+
- name: Set up ffmpeg
|
37
|
+
uses: FedericoCarboni/setup-ffmpeg@v1
|
38
|
+
with:
|
39
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
40
|
+
id: setup-ffmpeg
|
41
|
+
- name: Set up Ruby
|
42
|
+
uses: ruby/setup-ruby@v1
|
43
|
+
with:
|
44
|
+
ruby-version: ${{ matrix.ruby-version }}
|
45
|
+
bundler-cache: true
|
46
|
+
- name: Start xvfb
|
47
|
+
run: Xvfb -ac $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 &
|
48
|
+
- name: Run tests
|
49
|
+
run: bundle exec rake spec
|
50
|
+
|
51
|
+
test-windows:
|
52
|
+
runs-on: windows-latest
|
53
|
+
strategy:
|
54
|
+
matrix:
|
55
|
+
ruby-version: [2.5, jruby]
|
56
|
+
steps:
|
57
|
+
- name: Cancel any previous run(s) on new commit push
|
58
|
+
uses: styfle/cancel-workflow-action@0.8.0
|
59
|
+
with:
|
60
|
+
access_token: ${{ secrets.GITHUB_TOKEN }}
|
61
|
+
- uses: actions/checkout@v2
|
62
|
+
- name: Set up ffmpeg
|
63
|
+
uses: FedericoCarboni/setup-ffmpeg@v1
|
64
|
+
with:
|
65
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
66
|
+
id: setup-ffmpeg
|
67
|
+
- name: Set up Ruby
|
68
|
+
uses: ruby/setup-ruby@v1
|
69
|
+
with:
|
70
|
+
ruby-version: ${{ matrix.ruby-version }}
|
71
|
+
bundler-cache: true
|
72
|
+
- name: Run tests
|
73
|
+
run: bundle exec rake spec
|
74
|
+
|
75
|
+
test-macos:
|
76
|
+
runs-on: macos-latest
|
77
|
+
strategy:
|
78
|
+
matrix:
|
79
|
+
ruby-version: [2.5, 2.7]
|
80
|
+
steps:
|
81
|
+
- name: Cancel any previous run(s) on new commit push
|
82
|
+
uses: styfle/cancel-workflow-action@0.8.0
|
83
|
+
with:
|
84
|
+
access_token: ${{ secrets.GITHUB_TOKEN }}
|
85
|
+
- uses: actions/checkout@v2
|
86
|
+
- name: Set up ffmpeg
|
87
|
+
uses: FedericoCarboni/setup-ffmpeg@v1
|
88
|
+
with:
|
89
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
90
|
+
id: setup-ffmpeg
|
91
|
+
- name: Set up Ruby
|
92
|
+
uses: ruby/setup-ruby@v1
|
93
|
+
with:
|
94
|
+
ruby-version: ${{ matrix.ruby-version }}
|
95
|
+
bundler-cache: true
|
96
|
+
- name: Run tests
|
97
|
+
run: bundle exec rake spec
|
data/.rspec
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
--format
|
2
|
-
--color
|
3
|
-
--require spec_helper
|
1
|
+
--format progress
|
2
|
+
--color
|
3
|
+
--require spec_helper
|
data/.rubocop.yml
CHANGED
@@ -6,7 +6,8 @@ AllCops:
|
|
6
6
|
DisplayCopNames: true
|
7
7
|
DisplayStyleGuide: true
|
8
8
|
ExtraDetails: false
|
9
|
-
TargetRubyVersion: 2.
|
9
|
+
TargetRubyVersion: 2.5
|
10
|
+
NewCops: enable
|
10
11
|
|
11
12
|
Gemspec/RequiredRubyVersion:
|
12
13
|
Enabled: false
|
@@ -38,6 +39,24 @@ Layout/TrailingEmptyLines:
|
|
38
39
|
Layout/LineLength:
|
39
40
|
Max: 120
|
40
41
|
|
42
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
43
|
+
Enabled: true
|
44
|
+
|
45
|
+
Layout/SpaceAroundOperators:
|
46
|
+
Enabled: true
|
47
|
+
|
48
|
+
Layout/SpaceAroundMethodCallOperator:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
Lint/DeprecatedOpenSSLConstant:
|
52
|
+
Enabled: true
|
53
|
+
|
54
|
+
Lint/RaiseException:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
Lint/StructNewOverride:
|
58
|
+
Enabled: true
|
59
|
+
|
41
60
|
Metrics/MethodLength:
|
42
61
|
Max: 20
|
43
62
|
|
@@ -72,4 +91,19 @@ Style/CommentedKeyword:
|
|
72
91
|
Enabled: false
|
73
92
|
|
74
93
|
Style/FrozenStringLiteralComment:
|
94
|
+
Enabled: false
|
95
|
+
|
96
|
+
Style/ExponentialNotation:
|
97
|
+
Enabled: false
|
98
|
+
|
99
|
+
Style/HashEachMethods:
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
Style/HashTransformKeys:
|
103
|
+
Enabled: false
|
104
|
+
|
105
|
+
Style/HashTransformValues:
|
106
|
+
Enabled: false
|
107
|
+
|
108
|
+
Style/SlicingWithRange:
|
75
109
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,10 @@
|
|
2
2
|
|
3
3
|
This project adheres to [Semantic Versioning](https://semver.org/).
|
4
4
|
|
5
|
-
### 1.
|
5
|
+
### 1.5.0 (2021-03-23)
|
6
|
+
* Relax "os" gem version to minor level ([#97](https://github.com/kapoorlakshya/screen-recorder/pull/97)). Thanks, [hlascelles](https://github.com/hlascelles)!
|
7
|
+
|
8
|
+
### 1.4.0 (2020-01-27)
|
6
9
|
* Users can now select a ffmpeg [capture device](https://ffmpeg.org/ffmpeg-devices.html) from advanced -> input.
|
7
10
|
* Fix a bug where some advanced parameters were not parsed correctly.
|
8
11
|
* Add support for audio stream capture ([#15](https://github.com/kapoorlakshya/screen-recorder/issues/15))
|
@@ -16,7 +19,7 @@ Hopefully fixes [#79](https://github.com/kapoorlakshya/screen-recorder/issues/79
|
|
16
19
|
|
17
20
|
### 1.3.0 (2019-07-26)
|
18
21
|
* Support JRuby 9.2+ ([#58](https://github.com/kapoorlakshya/screen-recorder/issues/58))
|
19
|
-
* Add `ScreenRecorder
|
22
|
+
* Add `ScreenRecorder::` as an alias for `ScreenRecorder::Window.fetch_title`.
|
20
23
|
The `Titles` class will be removed in version 2.0.
|
21
24
|
|
22
25
|
### 1.2.0 (2019-05-12)
|
data/LICENSE.txt
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2018 Lakshya Kapoor
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Lakshya Kapoor
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
# ScreenRecorder
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/screen-recorder)
|
4
|
-
[](https://www.rubydoc.info/
|
5
|
-
[](https://ci.appveyor.com/project/kapoorlakshya/screen-recorder/branch/master)
|
7
|
-
[](https://codeclimate.com/github/kapoorlakshya/screen-recorder/maintainability)
|
8
|
-
[](https://codeclimate.com/github/kapoorlakshya/screen-recorder/test_coverage)
|
4
|
+
[](https://www.rubydoc.info/gems/screen-recorder/)
|
5
|
+
[](https://github.com/kapoorlakshya/screen-recorder/actions/workflows/tests.yml)
|
9
6
|
|
10
7
|
A Ruby gem to video record or take screenshots of your computer screen - desktop or specific
|
11
8
|
window - using [FFmpeg](https://www.ffmpeg.org/). Primarily
|
@@ -23,11 +20,13 @@ Works on Windows, Linux, and macOS. Requires Ruby 2.0+ or JRuby 9.2+.
|
|
23
20
|
|
24
21
|
##### 1. Setup FFmpeg
|
25
22
|
|
26
|
-
Linux and macOS instructions are [here](https://trac.ffmpeg.org/wiki/CompilationGuide).
|
23
|
+
Linux and macOS instructions are [here](https://trac.ffmpeg.org/wiki/CompilationGuide).
|
27
24
|
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
> macOS: Follow [these steps](https://github.com/kapoorlakshya/screen-recorder/issues/88#issuecomment-629139032) to avoid
|
26
|
+
> issues related to Privacy settings.
|
27
|
+
|
28
|
+
For Microsoft Windows, download the binary from [here](https://www.videohelp.com/software/ffmpeg). Once downloaded,
|
29
|
+
add location of the `ffmpeg/bin` folder to the `PATH` environment variable ([instructions](https://windowsloop.com/install-ffmpeg-windows-10/)).
|
31
30
|
|
32
31
|
Alternatively, you can point to the binary file using
|
33
32
|
`ScreenRecorder.ffmpeg_binary = '/path/to/ffmpeg'` in your project.
|
@@ -80,7 +79,7 @@ require 'screen-recorder'
|
|
80
79
|
```
|
81
80
|
|
82
81
|
Linux and macOS users can optionally provide a display or input device number.
|
83
|
-
Read more about it in the wiki [here](https://github.com/kapoorlakshya/screen-recorder/wiki/Input-
|
82
|
+
Read more about it in the wiki [here](https://github.com/kapoorlakshya/screen-recorder/wiki/Display-or-Input-Device-Selection).
|
84
83
|
|
85
84
|
#### Record Application Window (Microsoft Windows only)
|
86
85
|
|
@@ -105,10 +104,10 @@ A helper method is available to fetch the title of the active window
|
|
105
104
|
for the given process name.
|
106
105
|
|
107
106
|
```ruby
|
108
|
-
ScreenRecorder::
|
107
|
+
ScreenRecorder::('firefox') # Name of exe
|
109
108
|
#=> ["Mozilla Firefox"]
|
110
109
|
|
111
|
-
ScreenRecorder::
|
110
|
+
ScreenRecorder::('chrome')
|
112
111
|
#=> ["New Tab - Google Chrome"]
|
113
112
|
```
|
114
113
|
|
@@ -126,7 +125,7 @@ advanced = { 'f': 'pulse', 'ac': 2, 'i': 'default' } # Records default sound out
|
|
126
125
|
advanced = { input: { i: '1:1' } } # -i video:audio input device ID
|
127
126
|
|
128
127
|
# Windows
|
129
|
-
advanced = { f: 'dshow', i: 'audio="Microphone (High Definition
|
128
|
+
advanced = { f: 'dshow', i: 'audio="Microphone (Realtek High Definition Audio)"' }
|
130
129
|
```
|
131
130
|
|
132
131
|
You can retrieve a list of audio devices by running these commands:
|
@@ -158,7 +157,7 @@ Screenshots can be captured at any point after initializing the recorder:
|
|
158
157
|
# Window (Microsoft Windows only)
|
159
158
|
browser = Watir::Browser.new :chrome, options: { args: ['--disable-gpu'] } # Hardware acceleration must be disabled
|
160
159
|
browser.goto('watir.com')
|
161
|
-
window_title = ScreenRecorder::
|
160
|
+
window_title = ScreenRecorder::('chrome').first
|
162
161
|
@recorder = ScreenRecorder::Window.new(title: window_title, output: 'recording.mkv')
|
163
162
|
@recorder.screenshot('before-recording.png')
|
164
163
|
@recorder.start
|
data/bin/console
CHANGED
File without changes
|
data/bin/setup
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -euo pipefail
|
3
|
-
IFS=$'\n\t'
|
4
|
-
set -vx
|
5
|
-
|
6
|
-
bundle install
|
7
|
-
|
8
|
-
# Do any other automated setup that you need to do here
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
set -vx
|
5
|
+
|
6
|
+
bundle install
|
7
|
+
|
8
|
+
# Do any other automated setup that you need to do here
|
data/lib/screen-recorder.rb
CHANGED
@@ -27,6 +27,28 @@ module ScreenRecorder
|
|
27
27
|
raise Errors::DependencyNotFound
|
28
28
|
end
|
29
29
|
|
30
|
+
#
|
31
|
+
# Uses user given ffprobe binary
|
32
|
+
#
|
33
|
+
# @example
|
34
|
+
# ScreenRecorder.ffprobe_binary= = 'C:\ffprobe.exe'
|
35
|
+
#
|
36
|
+
def self.ffprobe_binary=(bin)
|
37
|
+
ScreenRecorder.logger.debug 'Setting ffprobe path...'
|
38
|
+
FFMPEG.ffprobe_binary = bin
|
39
|
+
ScreenRecorder.logger.debug "ffprobe path set: #{bin}"
|
40
|
+
ScreenRecorder.ffmpeg_binary
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Returns path to ffprobe binary or raises DependencyNotFound
|
45
|
+
#
|
46
|
+
def self.ffprobe_binary
|
47
|
+
FFMPEG.ffprobe_binary
|
48
|
+
rescue Errno::ENOENT # Raised when binary is not set in project or found in ENV
|
49
|
+
raise Errors::DependencyNotFound
|
50
|
+
end
|
51
|
+
|
30
52
|
#
|
31
53
|
# Set external logger if you want.
|
32
54
|
#
|
@@ -40,9 +62,9 @@ module ScreenRecorder
|
|
40
62
|
def self.logger
|
41
63
|
return @logger if @logger
|
42
64
|
|
43
|
-
logger
|
44
|
-
logger.level
|
45
|
-
logger.progname
|
65
|
+
logger = Logger.new($stdout)
|
66
|
+
logger.level = Logger::ERROR
|
67
|
+
logger.progname = 'ScreenRecorder'
|
46
68
|
logger.formatter = proc do |severity, time, progname, msg|
|
47
69
|
"#{time.strftime('%F %T')} #{progname} - #{severity} - #{msg}\n"
|
48
70
|
end
|
@@ -32,10 +32,12 @@ module ScreenRecorder
|
|
32
32
|
#
|
33
33
|
def stop
|
34
34
|
ScreenRecorder.logger.debug 'Stopping ffmpeg...'
|
35
|
-
stop_ffmpeg
|
35
|
+
exit_code = stop_ffmpeg
|
36
|
+
return if exit_code == 1 # recording failed
|
37
|
+
|
36
38
|
ScreenRecorder.logger.debug 'Stopped ffmpeg.'
|
37
39
|
ScreenRecorder.logger.info 'Recording complete.'
|
38
|
-
@video = prepare_video
|
40
|
+
@video = prepare_video unless exit_code == 1
|
39
41
|
end
|
40
42
|
|
41
43
|
#
|
@@ -44,7 +46,7 @@ module ScreenRecorder
|
|
44
46
|
def screenshot(filename)
|
45
47
|
process = execute_command(screenshot_cmd(filename))
|
46
48
|
exit_code = wait_for_process_exit(process) # 0 (success) or 1 (fail)
|
47
|
-
if exit_code
|
49
|
+
if exit_code&.zero?
|
48
50
|
ScreenRecorder.logger.info "Screenshot: #{filename}"
|
49
51
|
return filename
|
50
52
|
end
|
@@ -186,16 +188,17 @@ module ScreenRecorder
|
|
186
188
|
|
187
189
|
#
|
188
190
|
# Waits for given process to exit.
|
189
|
-
# Forcefully kills the process if it does not
|
190
|
-
# exit
|
191
|
+
# Forcefully kills the process if it does not exit within 5 seconds.
|
192
|
+
# Returns exit code.
|
191
193
|
#
|
192
194
|
def wait_for_process_exit(process)
|
193
195
|
process.poll_for_exit(PROCESS_TIMEOUT)
|
194
|
-
process.exit_code
|
196
|
+
process.exit_code # 0
|
195
197
|
rescue ChildProcess::TimeoutError
|
196
198
|
ScreenRecorder.logger.error 'ffmpeg failed to stop. Force killing it...'
|
197
199
|
process.stop # Tries increasingly harsher methods to kill the process.
|
198
|
-
ScreenRecorder.logger.error 'Forcefully killed ffmpeg.'
|
200
|
+
ScreenRecorder.logger.error 'Forcefully killed ffmpeg. Recording failed!'
|
201
|
+
1
|
199
202
|
end
|
200
203
|
end
|
201
204
|
end
|
@@ -2,14 +2,14 @@
|
|
2
2
|
module ScreenRecorder
|
3
3
|
# @since 1.0.0-beta11
|
4
4
|
class Desktop < Common
|
5
|
-
DEFAULT_INPUT_WIN
|
5
|
+
DEFAULT_INPUT_WIN = 'desktop'.freeze
|
6
6
|
DEFAULT_INPUT_LINUX = ':0'.freeze
|
7
|
-
DEFAULT_INPUT_MAC
|
7
|
+
DEFAULT_INPUT_MAC = '1'.freeze
|
8
8
|
|
9
9
|
#
|
10
10
|
# Desktop recording mode.
|
11
11
|
#
|
12
|
-
def initialize(input: input_by_os,
|
12
|
+
def initialize(output:, input: input_by_os, advanced: {})
|
13
13
|
super(input: determine_input(input), output: output, advanced: advanced)
|
14
14
|
end
|
15
15
|
|
@@ -6,17 +6,17 @@ module ScreenRecorder
|
|
6
6
|
class Options
|
7
7
|
attr_reader :all
|
8
8
|
|
9
|
-
DEFAULT_LOG_FILE
|
10
|
-
DEFAULT_FPS
|
9
|
+
DEFAULT_LOG_FILE = 'ffmpeg.log'.freeze
|
10
|
+
DEFAULT_FPS = 15.0
|
11
11
|
DEFAULT_MAC_INPUT_PIX_FMT = 'uyvy422'.freeze # For avfoundation
|
12
|
-
DEFAULT_PIX_FMT
|
13
|
-
YUV420P_SCALING
|
12
|
+
DEFAULT_PIX_FMT = 'yuv420p'.freeze
|
13
|
+
YUV420P_SCALING = '"scale=trunc(iw/2)*2:trunc(ih/2)*2"'.freeze
|
14
14
|
|
15
15
|
def initialize(options)
|
16
16
|
# @todo Consider using OpenStruct
|
17
|
-
@all
|
18
|
-
advanced[:input]
|
19
|
-
advanced[:output]
|
17
|
+
@all = verify_options options
|
18
|
+
advanced[:input] = default_advanced_input.merge(advanced_input)
|
19
|
+
advanced[:output] = default_advanced_output.merge(advanced_output)
|
20
20
|
advanced[:log] ||= DEFAULT_LOG_FILE
|
21
21
|
|
22
22
|
# Fix for using yuv420p pixel format for output
|
@@ -91,7 +91,7 @@ module ScreenRecorder
|
|
91
91
|
TypeChecker.check options, Hash
|
92
92
|
TypeChecker.check options[:advanced], Hash if options[:advanced]
|
93
93
|
missing_options = required_options.select { |req| options[req].nil? }
|
94
|
-
err
|
94
|
+
err = "Required options are missing: #{missing_options}"
|
95
95
|
raise(ArgumentError, err) unless missing_options.empty?
|
96
96
|
|
97
97
|
options
|
@@ -131,12 +131,13 @@ module ScreenRecorder
|
|
131
131
|
def parse_advanced(opts)
|
132
132
|
# @todo Replace arr with opts.each_with_object([])
|
133
133
|
arr = []
|
134
|
+
rejects = %i[input output log]
|
134
135
|
# Do not parse input/output and log as they're placed separately in #parsed
|
135
|
-
opts.reject { |k, _|
|
136
|
+
opts.reject { |k, _| rejects.include? k }
|
136
137
|
.each do |k, v|
|
137
138
|
arr.push "-#{k} #{v}" unless v.nil? # Ignore blank params
|
138
139
|
end
|
139
|
-
arr.join(' ')
|
140
|
+
"#{arr.join(' ')} "
|
140
141
|
end
|
141
142
|
|
142
143
|
#
|
data/screen-recorder.gemspec
CHANGED
@@ -9,10 +9,9 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['Lakshya Kapoor']
|
10
10
|
spec.email = ['kapoorlakshya@gmail.com']
|
11
11
|
spec.homepage = 'http://github.com/kapoorlakshya/screen-recorder'
|
12
|
-
spec.summary = 'Video record your computer screen using FFmpeg.'
|
13
|
-
spec.description = '
|
14
|
-
|
15
|
-
'(Selenium) test executions for debugging and documentation.'
|
12
|
+
spec.summary = 'Video record and take screenshots your computer screen using FFmpeg.'
|
13
|
+
spec.description = 'A Ruby gem to video record and take screenshots of your desktop or ' \
|
14
|
+
' specific application window. Works on Windows, Linux, and macOS.'
|
16
15
|
spec.license = 'MIT'
|
17
16
|
# noinspection RubyStringKeysInHashInspection
|
18
17
|
spec.metadata = {
|
@@ -40,6 +39,6 @@ Gem::Specification.new do |spec|
|
|
40
39
|
spec.add_development_dependency 'webdrivers', '~> 4.0'
|
41
40
|
|
42
41
|
spec.add_runtime_dependency 'childprocess', '>= 1.0', '< 4.0' # Roughly match Selenium
|
43
|
-
spec.add_runtime_dependency 'os', '~> 1.0
|
42
|
+
spec.add_runtime_dependency 'os', '~> 1.0'
|
44
43
|
spec.add_runtime_dependency 'streamio-ffmpeg', '~> 3.0'
|
45
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: screen-recorder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lakshya Kapoor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -162,14 +162,14 @@ dependencies:
|
|
162
162
|
requirements:
|
163
163
|
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: 1.0
|
165
|
+
version: '1.0'
|
166
166
|
type: :runtime
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: 1.0
|
172
|
+
version: '1.0'
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
174
|
name: streamio-ffmpeg
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,9 +184,8 @@ dependencies:
|
|
184
184
|
- - "~>"
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '3.0'
|
187
|
-
description:
|
188
|
-
|
189
|
-
UI (Selenium) test executions for debugging and documentation.
|
187
|
+
description: A Ruby gem to video record and take screenshots of your desktop or specific
|
188
|
+
application window. Works on Windows, Linux, and macOS.
|
190
189
|
email:
|
191
190
|
- kapoorlakshya@gmail.com
|
192
191
|
executables: []
|
@@ -194,16 +193,15 @@ extensions: []
|
|
194
193
|
extra_rdoc_files: []
|
195
194
|
files:
|
196
195
|
- ".github/ISSUE_TEMPLATE.md"
|
196
|
+
- ".github/workflows/tests.yml"
|
197
197
|
- ".gitignore"
|
198
198
|
- ".rspec"
|
199
199
|
- ".rubocop.yml"
|
200
|
-
- ".travis.yml"
|
201
200
|
- CHANGELOG.md
|
202
201
|
- Gemfile
|
203
202
|
- LICENSE.txt
|
204
203
|
- README.md
|
205
204
|
- Rakefile
|
206
|
-
- appveyor.yml
|
207
205
|
- bin/console
|
208
206
|
- bin/setup
|
209
207
|
- lib/screen-recorder.rb
|
@@ -216,17 +214,13 @@ files:
|
|
216
214
|
- lib/screen-recorder/version.rb
|
217
215
|
- lib/screen-recorder/window.rb
|
218
216
|
- screen-recorder.gemspec
|
219
|
-
- support/install_jruby.ps1
|
220
|
-
- support/start_test_reporter.sh
|
221
|
-
- support/start_xvfb.sh
|
222
|
-
- support/stop_test_reporter.sh
|
223
217
|
homepage: http://github.com/kapoorlakshya/screen-recorder
|
224
218
|
licenses:
|
225
219
|
- MIT
|
226
220
|
metadata:
|
227
221
|
changelog_uri: https://github.com/kapoorlakshya/screen-recorder/blob/master/CHANGELOG.md
|
228
|
-
source_code_uri: https://github.com/kapoorlakshya/screen-recorder/tree/v1.
|
229
|
-
documentation_uri: https://www.rubydoc.info/gems/screen-recorder/1.
|
222
|
+
source_code_uri: https://github.com/kapoorlakshya/screen-recorder/tree/v1.5.0
|
223
|
+
documentation_uri: https://www.rubydoc.info/gems/screen-recorder/1.5.0
|
230
224
|
bug_tracker_uri: https://github.com/kapoorlakshya/screen-recorder/issues
|
231
225
|
wiki_uri: https://github.com/kapoorlakshya/screen-recorder/wiki
|
232
226
|
post_install_message:
|
@@ -244,8 +238,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
238
|
- !ruby/object:Gem::Version
|
245
239
|
version: '0'
|
246
240
|
requirements: []
|
247
|
-
rubygems_version: 3.1.
|
241
|
+
rubygems_version: 3.1.4
|
248
242
|
signing_key:
|
249
243
|
specification_version: 4
|
250
|
-
summary: Video record your computer screen using FFmpeg.
|
244
|
+
summary: Video record and take screenshots your computer screen using FFmpeg.
|
251
245
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
branches:
|
4
|
-
only:
|
5
|
-
- /.*/
|
6
|
-
env:
|
7
|
-
global:
|
8
|
-
- DISPLAY=":0"
|
9
|
-
matrix:
|
10
|
-
include:
|
11
|
-
- rvm: 2.4.6
|
12
|
-
dist: xenial
|
13
|
-
env: RAKE_TASK=spec
|
14
|
-
- rvm: 2.4.6
|
15
|
-
dist: xenial
|
16
|
-
env: RAKE_TASK=rubocop
|
17
|
-
- rvm: 2.7.0
|
18
|
-
dist: xenial
|
19
|
-
env: RAKE_TASK=spec REPORT_COVERAGE=true
|
20
|
-
- rvm: jruby-9.2.9.0
|
21
|
-
dist: xenial
|
22
|
-
jdk: openjdk8
|
23
|
-
env: RAKE_TASK=spec JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom"
|
24
|
-
- rvm: 2.6.3
|
25
|
-
os: osx
|
26
|
-
osx_image: xcode11
|
27
|
-
env: RAKE_TASK=spec
|
28
|
-
addons:
|
29
|
-
firefox: latest
|
30
|
-
chrome: stable
|
31
|
-
apt:
|
32
|
-
packages:
|
33
|
-
- ffmpeg
|
34
|
-
homebrew:
|
35
|
-
packages:
|
36
|
-
- ffmpeg
|
37
|
-
before_script:
|
38
|
-
- bash support/start_xvfb.sh
|
39
|
-
- bash support/start_test_reporter.sh
|
40
|
-
script: bundle exec rake $RAKE_TASK
|
41
|
-
after_script:
|
42
|
-
- bash support/stop_test_reporter.sh
|
data/appveyor.yml
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
build: off
|
2
|
-
cache:
|
3
|
-
- vendor/bundle
|
4
|
-
environment:
|
5
|
-
matrix:
|
6
|
-
- RUBY_VERSION: Ruby24
|
7
|
-
RUBY_BIN: ruby
|
8
|
-
RAKE_TASK: spec
|
9
|
-
SCRIPT_CONTEXT: bundle exec
|
10
|
-
- RUBY_VERSION: Ruby24
|
11
|
-
RUBY_BIN: ruby
|
12
|
-
RAKE_TASK: rubocop
|
13
|
-
SCRIPT_CONTEXT: bundle exec
|
14
|
-
- RUBY_VERSION: Ruby26
|
15
|
-
RUBY_BIN: ruby
|
16
|
-
RAKE_TASK: spec
|
17
|
-
SCRIPT_CONTEXT: bundle exec
|
18
|
-
- RUBY_VERSION: jruby-9.2.9.0
|
19
|
-
RUBY_BIN: jruby
|
20
|
-
RAKE_TASK: spec
|
21
|
-
SCRIPT_CONTEXT: jruby -G -S
|
22
|
-
install:
|
23
|
-
- ps: |
|
24
|
-
if ($env:RUBY_BIN -eq 'jruby')
|
25
|
-
{
|
26
|
-
support\install_jruby.ps1
|
27
|
-
}
|
28
|
-
- choco install ffmpeg
|
29
|
-
- set PATH=C:\%RUBY_VERSION%\bin;%PATH%
|
30
|
-
- "%RUBY_BIN% -S gem update --system"
|
31
|
-
- "%RUBY_BIN% -S gem install bundler"
|
32
|
-
- "%RUBY_BIN% -S bundle install"
|
33
|
-
before_test:
|
34
|
-
- ffmpeg -version
|
35
|
-
- "%RUBY_BIN% -v"
|
36
|
-
- "%RUBY_BIN% -S gem -v"
|
37
|
-
- "%RUBY_BIN% -S bundle -v"
|
38
|
-
test_script:
|
39
|
-
- "%SCRIPT_CONTEXT% rake %RAKE_TASK%"
|
data/support/install_jruby.ps1
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
$downloadLink = "https://repo1.maven.org/maven2/org/jruby/jruby-dist/9.2.9.0/jruby-dist-9.2.9.0-bin.zip"
|
2
|
-
$zipPath = "c:\jruby-dist-9.2.9.0-bin.zip"
|
3
|
-
|
4
|
-
Write-Host "Installing $($env:RUBY_VERSION)" -ForegroundColor cyan
|
5
|
-
appveyor DownloadFile "$($downloadLink)" -FileName "$($zipPath)"
|
6
|
-
7z x "$($zipPath)" -oc:\ -y # Unzip to c:\
|
7
|
-
Write-Host "JRuby installed.`n" -ForegroundColor green
|
@@ -1,7 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
if [[ "$REPORT_COVERAGE" == "true" ]] && [[ "$TRAVIS_BRANCH" == "master" ]]; then
|
3
|
-
echo "Reporting test coverage for 'master' branch."
|
4
|
-
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter;
|
5
|
-
chmod +x ./cc-test-reporter;
|
6
|
-
./cc-test-reporter before-build;
|
7
|
-
fi
|
data/support/start_xvfb.sh
DELETED