ffmpeg-screenrecorder 1.0.0.beta10 → 1.0.0.beta11
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/ISSUE_TEMPLATE.md +15 -0
- data/.gitignore +107 -107
- data/.travis.yml +32 -24
- data/CHANGES.md +52 -51
- data/README.md +181 -179
- data/ffmpeg-screenrecorder.gemspec +5 -0
- data/lib/ffmpeg-screenrecorder.rb +2 -2
- data/lib/ffmpeg/recorder_options.rb +7 -6
- data/lib/ffmpeg/version.rb +1 -1
- data/lib/ffmpeg/window_titles.rb +81 -77
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c53985bec23bb71bb24147ee248aa12bbca3ac4326fea85272a50901c35ea035
|
4
|
+
data.tar.gz: 1fc08dcbfbf387f288461ae48930b8efd2417cb541ed85ce43f01e99e5ba4cab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cac78ed89acfebc0a9f0533616e8dfc2114f4199919f295076e7bc9874993322ef38dd3793f57a7210fb2235fd5c11923c6a6ab850fdc6afa73a5f1b03f271dc
|
7
|
+
data.tar.gz: c18942bb29c48f98f7457c67339c3383385c4d099da7c83d1e46491f58f482d835cc22e0a2f18aafe15085762f322ca7b7f878fe66bd8d62756c53dc80d2da18
|
@@ -0,0 +1,15 @@
|
|
1
|
+
### Summary
|
2
|
+
A clear and concise description of what the bug is.
|
3
|
+
|
4
|
+
### Debug Info
|
5
|
+
Please provide the following information:
|
6
|
+
|
7
|
+
* Operating system - Microsoft Windows, Linux, or macOS.
|
8
|
+
* `opts` Hash used for the recorder.
|
9
|
+
* Recorder log (`ffmpeg.log`) file as a gist or on pastebin.com.
|
10
|
+
* Set `log_level: Logger::DEBUG`, run the recorder, and share the
|
11
|
+
console output as a gist or on pastebin.com.
|
12
|
+
|
13
|
+
### Expected Behavior
|
14
|
+
|
15
|
+
### Actual Behavior
|
data/.gitignore
CHANGED
@@ -1,108 +1,108 @@
|
|
1
|
-
Gemfile.lock # Part of best practice
|
2
|
-
|
3
|
-
# Created by https://www.gitignore.io/api/rubymine+all
|
4
|
-
|
5
|
-
### RubyMine+all ###
|
6
|
-
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
7
|
-
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
8
|
-
|
9
|
-
/.bundle/
|
10
|
-
/.yardoc
|
11
|
-
/_yardoc/
|
12
|
-
/coverage/
|
13
|
-
/doc/
|
14
|
-
/pkg/
|
15
|
-
/spec/reports/
|
16
|
-
/tmp/
|
17
|
-
/webdrivers_bin
|
18
|
-
*.log
|
19
|
-
*.mkv
|
20
|
-
*.mp4
|
21
|
-
*.avi
|
22
|
-
*.gif
|
23
|
-
|
24
|
-
Gemfile.lock
|
25
|
-
|
26
|
-
# rspec failure tracking
|
27
|
-
.rspec_status
|
28
|
-
|
29
|
-
# User-specific stuff
|
30
|
-
.idea/
|
31
|
-
.idea/**/workspace.xml
|
32
|
-
.idea/**/tasks.xml
|
33
|
-
.idea/**/usage.statistics.xml
|
34
|
-
.idea/**/dictionaries
|
35
|
-
.idea/**/shelf
|
36
|
-
|
37
|
-
# Generated files
|
38
|
-
.idea/**/contentModel.xml
|
39
|
-
|
40
|
-
# Sensitive or high-churn files
|
41
|
-
.idea/**/dataSources/
|
42
|
-
.idea/**/dataSources.ids
|
43
|
-
.idea/**/dataSources.local.xml
|
44
|
-
.idea/**/sqlDataSources.xml
|
45
|
-
.idea/**/dynamic.xml
|
46
|
-
.idea/**/uiDesigner.xml
|
47
|
-
.idea/**/dbnavigator.xml
|
48
|
-
|
49
|
-
# Gradle
|
50
|
-
.idea/**/gradle.xml
|
51
|
-
.idea/**/libraries
|
52
|
-
|
53
|
-
# Gradle and Maven with auto-import
|
54
|
-
# When using Gradle or Maven with auto-import, you should exclude module files,
|
55
|
-
# since they will be recreated, and may cause churn. Uncomment if using
|
56
|
-
# auto-import.
|
57
|
-
# .idea/modules.xml
|
58
|
-
# .idea/*.iml
|
59
|
-
# .idea/modules
|
60
|
-
|
61
|
-
# CMake
|
62
|
-
cmake-build-*/
|
63
|
-
|
64
|
-
# Mongo Explorer plugin
|
65
|
-
.idea/**/mongoSettings.xml
|
66
|
-
|
67
|
-
# File-based project format
|
68
|
-
*.iws
|
69
|
-
|
70
|
-
# IntelliJ
|
71
|
-
out/
|
72
|
-
|
73
|
-
# mpeltonen/sbt-idea plugin
|
74
|
-
.idea_modules/
|
75
|
-
|
76
|
-
# JIRA plugin
|
77
|
-
atlassian-ide-plugin.xml
|
78
|
-
|
79
|
-
# Cursive Clojure plugin
|
80
|
-
.idea/replstate.xml
|
81
|
-
|
82
|
-
# Crashlytics plugin (for Android Studio and IntelliJ)
|
83
|
-
com_crashlytics_export_strings.xml
|
84
|
-
crashlytics.properties
|
85
|
-
crashlytics-build.properties
|
86
|
-
fabric.properties
|
87
|
-
|
88
|
-
# Editor-based Rest Client
|
89
|
-
.idea/httpRequests
|
90
|
-
|
91
|
-
# Android studio 3.1+ serialized cache file
|
92
|
-
.idea/caches/build_file_checksums.ser
|
93
|
-
|
94
|
-
### RubyMine+all Patch ###
|
95
|
-
# Ignores the whole .idea folder and all .iml files
|
96
|
-
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
|
97
|
-
|
98
|
-
.idea/
|
99
|
-
|
100
|
-
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
|
101
|
-
|
102
|
-
*.iml
|
103
|
-
modules.xml
|
104
|
-
.idea/misc.xml
|
105
|
-
*.ipr
|
106
|
-
|
107
|
-
|
1
|
+
Gemfile.lock # Part of best practice
|
2
|
+
|
3
|
+
# Created by https://www.gitignore.io/api/rubymine+all
|
4
|
+
|
5
|
+
### RubyMine+all ###
|
6
|
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
7
|
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
8
|
+
|
9
|
+
/.bundle/
|
10
|
+
/.yardoc
|
11
|
+
/_yardoc/
|
12
|
+
/coverage/
|
13
|
+
/doc/
|
14
|
+
/pkg/
|
15
|
+
/spec/reports/
|
16
|
+
/tmp/
|
17
|
+
/webdrivers_bin
|
18
|
+
*.log
|
19
|
+
*.mkv
|
20
|
+
*.mp4
|
21
|
+
*.avi
|
22
|
+
*.gif
|
23
|
+
|
24
|
+
Gemfile.lock
|
25
|
+
|
26
|
+
# rspec failure tracking
|
27
|
+
.rspec_status
|
28
|
+
|
29
|
+
# User-specific stuff
|
30
|
+
.idea/
|
31
|
+
.idea/**/workspace.xml
|
32
|
+
.idea/**/tasks.xml
|
33
|
+
.idea/**/usage.statistics.xml
|
34
|
+
.idea/**/dictionaries
|
35
|
+
.idea/**/shelf
|
36
|
+
|
37
|
+
# Generated files
|
38
|
+
.idea/**/contentModel.xml
|
39
|
+
|
40
|
+
# Sensitive or high-churn files
|
41
|
+
.idea/**/dataSources/
|
42
|
+
.idea/**/dataSources.ids
|
43
|
+
.idea/**/dataSources.local.xml
|
44
|
+
.idea/**/sqlDataSources.xml
|
45
|
+
.idea/**/dynamic.xml
|
46
|
+
.idea/**/uiDesigner.xml
|
47
|
+
.idea/**/dbnavigator.xml
|
48
|
+
|
49
|
+
# Gradle
|
50
|
+
.idea/**/gradle.xml
|
51
|
+
.idea/**/libraries
|
52
|
+
|
53
|
+
# Gradle and Maven with auto-import
|
54
|
+
# When using Gradle or Maven with auto-import, you should exclude module files,
|
55
|
+
# since they will be recreated, and may cause churn. Uncomment if using
|
56
|
+
# auto-import.
|
57
|
+
# .idea/modules.xml
|
58
|
+
# .idea/*.iml
|
59
|
+
# .idea/modules
|
60
|
+
|
61
|
+
# CMake
|
62
|
+
cmake-build-*/
|
63
|
+
|
64
|
+
# Mongo Explorer plugin
|
65
|
+
.idea/**/mongoSettings.xml
|
66
|
+
|
67
|
+
# File-based project format
|
68
|
+
*.iws
|
69
|
+
|
70
|
+
# IntelliJ
|
71
|
+
out/
|
72
|
+
|
73
|
+
# mpeltonen/sbt-idea plugin
|
74
|
+
.idea_modules/
|
75
|
+
|
76
|
+
# JIRA plugin
|
77
|
+
atlassian-ide-plugin.xml
|
78
|
+
|
79
|
+
# Cursive Clojure plugin
|
80
|
+
.idea/replstate.xml
|
81
|
+
|
82
|
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
83
|
+
com_crashlytics_export_strings.xml
|
84
|
+
crashlytics.properties
|
85
|
+
crashlytics-build.properties
|
86
|
+
fabric.properties
|
87
|
+
|
88
|
+
# Editor-based Rest Client
|
89
|
+
.idea/httpRequests
|
90
|
+
|
91
|
+
# Android studio 3.1+ serialized cache file
|
92
|
+
.idea/caches/build_file_checksums.ser
|
93
|
+
|
94
|
+
### RubyMine+all Patch ###
|
95
|
+
# Ignores the whole .idea folder and all .iml files
|
96
|
+
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
|
97
|
+
|
98
|
+
.idea/
|
99
|
+
|
100
|
+
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
|
101
|
+
|
102
|
+
*.iml
|
103
|
+
modules.xml
|
104
|
+
.idea/misc.xml
|
105
|
+
*.ipr
|
106
|
+
|
107
|
+
|
108
108
|
# End of https://www.gitignore.io/api/rubymine+all
|
data/.travis.yml
CHANGED
@@ -1,24 +1,32 @@
|
|
1
|
-
---
|
2
|
-
sudo: required
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
branches:
|
8
|
-
only:
|
9
|
-
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
1
|
+
---
|
2
|
+
sudo: required
|
3
|
+
dist: xenial
|
4
|
+
language: ruby
|
5
|
+
cache: bundler
|
6
|
+
|
7
|
+
branches:
|
8
|
+
only:
|
9
|
+
- /.*/
|
10
|
+
|
11
|
+
rvm:
|
12
|
+
- 2.3.8
|
13
|
+
- 2.4.5
|
14
|
+
- 2.5.3
|
15
|
+
- 2.6.1
|
16
|
+
|
17
|
+
env:
|
18
|
+
- DISPLAY=":99"
|
19
|
+
|
20
|
+
addons:
|
21
|
+
firefox: latest
|
22
|
+
chrome: stable
|
23
|
+
|
24
|
+
before_install:
|
25
|
+
- gem update --system --no-document
|
26
|
+
|
27
|
+
before_script:
|
28
|
+
- sudo apt-get install -y ffmpeg
|
29
|
+
- ffmpeg -hwaccels
|
30
|
+
- sudo apt-get install wmctrl
|
31
|
+
|
32
|
+
script: xvfb-run --server-args=":99 -ac -screen 0 1024x768x24" bundle exec rake spec
|
data/CHANGES.md
CHANGED
@@ -1,52 +1,53 @@
|
|
1
|
-
### 1.0.0.
|
2
|
-
*
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
*
|
26
|
-
*
|
27
|
-
*
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
*
|
33
|
-
* `
|
34
|
-
*
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
*
|
44
|
-
*
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
*
|
50
|
-
*
|
51
|
-
*
|
1
|
+
### 1.0.0.beta11 (2019-03-11)
|
2
|
+
* Recording FPS (`framerate`) is defaulted to 15.0.
|
3
|
+
* Gem will soo be renamed to `screen_recorder`. Please refer to Issue
|
4
|
+
[#45](https://github.com/kapoorlakshya/ffmpeg-screenrecorder/issues/45)
|
5
|
+
for more information.
|
6
|
+
|
7
|
+
### 1.0.0.beta10 (2019-02-05)
|
8
|
+
* Fixed an edge case in Microsoft Windows specific implementation of
|
9
|
+
`WindowTitles#fetch` where processes with mismatching names and window
|
10
|
+
titles, such as process `"Calculator.exe"` with window title `"CicMarshalWnd"`,
|
11
|
+
were omitted ([#35](https://github.com/kapoorlakshya/ffmpeg-screenrecorder/issues/35)).
|
12
|
+
This fix also prints a warning when this mismatch occurs.
|
13
|
+
* Fixed bug in Linux specific `WindowTitles#fetch` implementation where
|
14
|
+
the filter by application name logic was removed. This filter is required
|
15
|
+
on Linux here because `wmctrl` returns all open window titles unlike
|
16
|
+
Microsoft Windows where `taskmgr` allows us get window titles by process
|
17
|
+
name.
|
18
|
+
* On Linux, you are now required to provide the `input` as `"desktop"`
|
19
|
+
or a display number, such as `":0.0"`. Run `echo $DISPLAY` to check your display number.
|
20
|
+
* QOL improvements - Type checking of inputs, spec cleanup, added more
|
21
|
+
tests, and fixed rubocop warnings.
|
22
|
+
|
23
|
+
### 1.0.0.beta9 (2019-01-22)
|
24
|
+
|
25
|
+
* :warning: `FFMPEG::RecordingRegions` is now `FFMPEG::WindowTitles`, so the module name is true to the function it provides.
|
26
|
+
* Added support for for a user given path via `FFMPEG#ffmpeg_binary=()`.
|
27
|
+
* Removed Bundler version requirement from gemspec to support all versions.
|
28
|
+
* Implement `#discard` (alias `#delete`) to discard the video file. Useful when your test passes and you want to get rid of the video file.
|
29
|
+
|
30
|
+
### 1.0.0.beta8 (2019-01-03)
|
31
|
+
|
32
|
+
* Fix a bug where the gem was incorrectly configured to be required as `ffmpeg/screenrecorder` instead of `ffmpeg-screenrecorder`.
|
33
|
+
* `ScreenRecorder#start` now returns the IO process object in case the user has a use case for it.
|
34
|
+
* `RecordingRegion#fetch` now logs a warning that `x11grab` for Linux does not supporting window recording.
|
35
|
+
* :warning: Parameter `infile` is now `input` to make it more intuitive.
|
36
|
+
|
37
|
+
### 1.0.0.beta7 (2018-12-23)
|
38
|
+
|
39
|
+
* Fix bug in RecorderOptions where an incorrect object was referenced to read the user provided options.
|
40
|
+
|
41
|
+
### 1.0.0.beta6 (2018-12-3)
|
42
|
+
|
43
|
+
* Stopping the screenrecorder now prints the failure reason given by the ffmpeg binary when `#stop` fails (Issue #7).
|
44
|
+
* Log file is now defaulted to `ffmpeg.log` instead of redirecting to nul.
|
45
|
+
* `log_level` now defaults to `Logger::ERROR` instead of `Logger::INFO`.
|
46
|
+
|
47
|
+
### 1.0.0.beta5 (2018-11-26)
|
48
|
+
|
49
|
+
* `Screenrecorder` class is now `ScreenRecorder`.
|
50
|
+
* Add support for Linux.
|
51
|
+
* Now an exception raised if the gem fails to find `ffmpeg`.
|
52
|
+
* Fix a bug where a file named `nul` was created instead of directing the output to `NUL`.
|
52
53
|
* Fix a bug where `RecordingRegions#window_titles` was not returning anything because of missing return keyword.
|
data/README.md
CHANGED
@@ -1,180 +1,182 @@
|
|
1
|
-
# FFMPEG::ScreenRecorder
|
2
|
-
|
3
|
-
[](https://badge.fury.io/rb/ffmpeg-screenrecorder)
|
4
|
-

|
5
|
-
[](https://www.rubydoc.info/github/kapoorlakshya/ffmpeg-screenrecorder/master)
|
6
|
-
[](https://badge.fury.io/rb/ffmpeg-screenrecorder)
|
4
|
+

|
5
|
+
[](https://www.rubydoc.info/github/kapoorlakshya/ffmpeg-screenrecorder/master)
|
6
|
+
[](https://travis-ci.org/kapoorlakshya/ffmpeg-screenrecorder)
|
7
|
+
[](https://codeclimate.com/github/kapoorlakshya/ffmpeg-screenrecorder/maintainability)
|
8
|
+
|
9
|
+
Ruby gem to record your computer screen - desktop or specific
|
10
|
+
application/window - using [FFmpeg](https://www.ffmpeg.org/). Primarily
|
11
|
+
geared towards recording automated UI test executions for easy
|
12
|
+
debugging and documentation.
|
13
|
+
|
14
|
+
## Compatibility
|
15
|
+
|
16
|
+
Supports Windows and Linux as of version `1.0.0-beta5`. macOS support will be added before the final release of `v1.0.0`.
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
#### 1. Setup FFmpeg
|
21
|
+
|
22
|
+
| OS | Download |
|
23
|
+
|-------------------|--------------------------------------------------------------------------------|
|
24
|
+
| Microsoft Windows | [ffmpeg.org#build-windows](https://www.ffmpeg.org/download.html#build-windows) or [libx264 enabled build](https://ffmpeg.zeranoe.com/builds/) |
|
25
|
+
| Linux | [ffmpeg.org#build-linux](https://ffmpeg.org/download.html#build-linux) |
|
26
|
+
| macOS | [ffmpeg.org#build-mac](https://www.ffmpeg.org/download.html#build-mac) |
|
27
|
+
|
28
|
+
Add location of the `ffmpeg/bin` folder to `PATH` environment variable if using Microsoft Windows ([instructions](https://windowsloop.com/install-ffmpeg-windows-10/)).
|
29
|
+
Alternatively, you can define the location using `FFMPEG.ffmpeg_binary='/path/to/binary'` in your project.
|
30
|
+
|
31
|
+
#### 2. Install gem
|
32
|
+
|
33
|
+
Next, add this line to your application's Gemfile:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
gem 'ffmpeg-screenrecorder'
|
37
|
+
```
|
38
|
+
|
39
|
+
And then execute:
|
40
|
+
|
41
|
+
```bash
|
42
|
+
$ bundle
|
43
|
+
```
|
44
|
+
|
45
|
+
Or install it yourself as:
|
46
|
+
|
47
|
+
```bash
|
48
|
+
$ gem install ffmpeg-screenrecorder --pre
|
49
|
+
```
|
50
|
+
|
51
|
+
#### 3. Require gem
|
52
|
+
|
53
|
+
Require this gem in your project and start using the gem:
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
require 'ffmpeg-screenrecorder'
|
57
|
+
```
|
58
|
+
|
59
|
+
## Record Desktop
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
opts = { input: 'desktop',
|
63
|
+
output: 'recording.mp4' }
|
64
|
+
@recorder = FFMPEG::ScreenRecorder.new(opts)
|
65
|
+
@recorder.start
|
66
|
+
|
67
|
+
# ... Run tests or whatever you want to record
|
68
|
+
|
69
|
+
@recorder.stop
|
70
|
+
|
71
|
+
# Recorded file metadata
|
72
|
+
@recorder.video
|
73
|
+
#=> #<FFMPEG::Movie:0x00000000067e0a08
|
74
|
+
@path="recording.mp4",
|
75
|
+
@container="mov,mp4,m4a,3gp,3g2,mj2",
|
76
|
+
@duration=5.0,
|
77
|
+
@time=0.0,
|
78
|
+
@creation_time=nil,
|
79
|
+
@bitrate=1051,
|
80
|
+
@rotation=nil,
|
81
|
+
@video_stream="h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 2560x1440, 1048 kb/s, 15 fps, 15 tbr, 15360 tbn, 30 tbc (default)",
|
82
|
+
@audio_stream=nil,
|
83
|
+
@video_codec="h264 (High 4:4:4 Predictive) (avc1 / 0x31637661)", @colorspace="yuv444p",
|
84
|
+
@video_bitrate=1048,
|
85
|
+
@resolution="2560x1440">
|
86
|
+
```
|
87
|
+
|
88
|
+
## Record Application Window
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
require 'watir'
|
92
|
+
|
93
|
+
browser = Watir::Browser.new :firefox
|
94
|
+
|
95
|
+
FFMPEG::WindowTitles.fetch('firefox') # Name of exe
|
96
|
+
#=> ["Mozilla Firefox"]
|
97
|
+
|
98
|
+
opts = { input: FFMPEG::WindowTitles.fetch('firefox').first,
|
99
|
+
output: 'recording.mp4' }
|
100
|
+
@recorder = FFMPEG::ScreenRecorder.new(opts)
|
101
|
+
@recorder.start
|
102
|
+
|
103
|
+
# Run tests or whatever you want to record
|
104
|
+
|
105
|
+
@recorder.stop
|
106
|
+
browser.quit
|
107
|
+
```
|
108
|
+
|
109
|
+
<b>Limitations</b>
|
110
|
+
- Only works on Microsoft Windows (gdigrab).
|
111
|
+
- `#fetch` only returns titles from currently active (visible) windows.
|
112
|
+
- `#fetch` may return `ArgumentError (invalid byte sequence in UTF-8)`
|
113
|
+
for a window title with non `UTF-8` characters.
|
114
|
+
See [#38](https://github.com/kapoorlakshya/ffmpeg-screenrecorder/issues/38)
|
115
|
+
for workaround.
|
116
|
+
- Always stop the recording before closing the application. Otherwise,
|
117
|
+
ffmpeg will force exit as soon as the window disappears and may produce
|
118
|
+
an invalid video file.
|
119
|
+
- If you're launching multiple applications or testing an application
|
120
|
+
at different window sizes, recording the `desktop` is a better option.
|
121
|
+
|
122
|
+
## Options
|
123
|
+
|
124
|
+
- `:input` - `'desktop'` or application window name
|
125
|
+
- `:output` - Output file location/name
|
126
|
+
- `:framerate` - Capture FPS
|
127
|
+
- `:log` - Defaults to `ffmpeg.log`
|
128
|
+
- `:log_level` for this gem. Default: ERROR
|
129
|
+
|
130
|
+
All 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.
|
131
|
+
|
132
|
+
```ruby
|
133
|
+
opts = { input: 'desktop',
|
134
|
+
output: 'recorder-test.mp4',
|
135
|
+
framerate: 30.0,
|
136
|
+
log: 'recorder.log',
|
137
|
+
log_level: Logger::DEBUG, # For gem
|
138
|
+
advanced: { loglevel: 'level+debug', # For FFmpeg
|
139
|
+
video_size: '640x480',
|
140
|
+
show_region: '1' }
|
141
|
+
}
|
142
|
+
|
143
|
+
#
|
144
|
+
# Command to FFmpeg:
|
145
|
+
#
|
146
|
+
# ffmpeg -y -f gdigrab -r 15 -loglevel level+debug -video_size 640x480
|
147
|
+
# -show_region 1 -i desktop recorder-test.mp4 2> recorder.log
|
148
|
+
```
|
149
|
+
|
150
|
+
## Demo
|
151
|
+
|
152
|
+
You can find example video recordings [here](https://kapoorlakshya.github.io/introducing-ffmpeg-screenrecorder).
|
153
|
+
Cucumber + Watir based example is [here](https://github.com/kapoorlakshya/cucumber-watir-test-recorder-example).
|
154
|
+
|
155
|
+
## Development
|
156
|
+
|
157
|
+
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.
|
158
|
+
|
159
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
160
|
+
|
161
|
+
## Contributing
|
162
|
+
|
163
|
+
Bug reports and pull requests are welcome.
|
164
|
+
|
165
|
+
- Please update the specs for your code changes and run them locally with `bundle exec rake spec`.
|
166
|
+
- Follow the Ruby style guide and format your code - https://github.com/rubocop-hq/ruby-style-guide
|
167
|
+
|
168
|
+
## License
|
169
|
+
|
170
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
171
|
+
|
172
|
+
## Credits
|
173
|
+
|
174
|
+
[](http://streamio.com)
|
175
|
+
|
176
|
+
This gem is based on the [streamio-ffmpeg](https://github.com/streamio/streamio-ffmpeg) gem.
|
177
|
+
<br />
|
178
|
+
<br />
|
179
|
+
|
180
|
+

|
181
|
+
|
180
182
|
Thanks to [SauceLabs](https://saucelabs.com) for providing me with a free account. If you manage an open source project, you can apply for a free account [here](https://saucelabs.com/open-source).
|
@@ -21,9 +21,14 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency 'pry-byebug', '~> 3.6'
|
22
22
|
spec.add_development_dependency 'rake', '~> 10.0'
|
23
23
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
24
|
+
spec.add_development_dependency 'rubocop', '~> 0.59'
|
24
25
|
spec.add_development_dependency 'watir', '~> 6.0'
|
25
26
|
spec.add_development_dependency 'webdrivers', '~> 3.0'
|
26
27
|
|
27
28
|
spec.add_runtime_dependency 'os', '~> 0.9.0'
|
28
29
|
spec.add_runtime_dependency 'streamio-ffmpeg', '~> 1.0'
|
30
|
+
|
31
|
+
spec.post_install_message = 'PLEASE NOTE: ffmpeg-screenrecorder will soon be renamed to screen_recorder. ' \
|
32
|
+
'Please refer to Issue #45 on GitHub for more information ' \
|
33
|
+
'(https://github.com/kapoorlakshya/ffmpeg-screenrecorder/issues/45). Thank you!'
|
29
34
|
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
require 'streamio-ffmpeg'
|
2
|
-
require 'os'
|
1
|
+
require 'streamio-ffmpeg'
|
2
|
+
require 'os'
|
3
3
|
require 'ffmpeg/screenrecorder'
|
@@ -2,6 +2,7 @@ module FFMPEG
|
|
2
2
|
# @since 1.0.0-beta2
|
3
3
|
class RecorderOptions
|
4
4
|
DEFAULT_LOG_FILE = 'ffmpeg.log'.freeze
|
5
|
+
DEFAULT_FPS = 15.0
|
5
6
|
|
6
7
|
def initialize(options)
|
7
8
|
TypeChecker.check options, Hash
|
@@ -13,14 +14,14 @@ module FFMPEG
|
|
13
14
|
# Returns given recording format
|
14
15
|
#
|
15
16
|
def format
|
16
|
-
|
17
|
+
determine_capture_device
|
17
18
|
end
|
18
19
|
|
19
20
|
#
|
20
21
|
# Returns given framerate
|
21
22
|
#
|
22
23
|
def framerate
|
23
|
-
@options[:framerate]
|
24
|
+
@options[:framerate] || DEFAULT_FPS
|
24
25
|
end
|
25
26
|
|
26
27
|
#
|
@@ -70,7 +71,7 @@ module FFMPEG
|
|
70
71
|
# ready for the ffmpeg process to use
|
71
72
|
#
|
72
73
|
def parsed
|
73
|
-
vals = "-f #{
|
74
|
+
vals = "-f #{determine_capture_device} "
|
74
75
|
vals << "-r #{@options[:framerate]} "
|
75
76
|
vals << advanced_options if @options[:advanced]
|
76
77
|
vals << "-i #{determine_input} "
|
@@ -97,7 +98,7 @@ module FFMPEG
|
|
97
98
|
# Returns Array of required options sa Symbols
|
98
99
|
#
|
99
100
|
def required_options
|
100
|
-
%i[
|
101
|
+
%i[input output]
|
101
102
|
end
|
102
103
|
|
103
104
|
#
|
@@ -143,9 +144,9 @@ module FFMPEG
|
|
143
144
|
end
|
144
145
|
|
145
146
|
#
|
146
|
-
# Returns
|
147
|
+
# Returns capture device based on user given value or the current OS.
|
147
148
|
#
|
148
|
-
def
|
149
|
+
def determine_capture_device
|
149
150
|
return @options[:format] if @options[:format]
|
150
151
|
|
151
152
|
if OS.windows?
|
data/lib/ffmpeg/version.rb
CHANGED
data/lib/ffmpeg/window_titles.rb
CHANGED
@@ -1,78 +1,82 @@
|
|
1
|
-
module FFMPEG
|
2
|
-
# @since 1.0.0-beta4
|
3
|
-
module WindowTitles
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
1
|
+
module FFMPEG
|
2
|
+
# @since 1.0.0-beta4
|
3
|
+
module WindowTitles
|
4
|
+
# Regex to filter out "Window Title: N/A" from Chrome extensions and "Window Title: ".
|
5
|
+
# This is done to remove unusable titles and to match the Ffmpeg expected input format
|
6
|
+
# for capturing specific windows.
|
7
|
+
# For example, "Window Title: Google - Mozilla Firefox" becomes "Google - Mozilla Firefox".
|
8
|
+
FILTERED_TITLES = %r{^Window Title:( N/A|\s+)?}
|
9
|
+
|
10
|
+
#
|
11
|
+
# Returns a list of available window titles for the given application (process) name.
|
12
|
+
#
|
13
|
+
def self.fetch(application)
|
14
|
+
FFMPEG.logger.debug "Retrieving available windows for: #{application}"
|
15
|
+
WindowGrabber.new.available_windows_for application
|
16
|
+
end
|
17
|
+
|
18
|
+
# @since 1.0.0-beta4
|
19
|
+
class WindowGrabber
|
20
|
+
#
|
21
|
+
# Returns a cleaned up list of available window titles
|
22
|
+
# for the given application (process) name.
|
23
|
+
#
|
24
|
+
def available_windows_for(application)
|
25
|
+
return windows_os_window(application) if OS.windows?
|
26
|
+
return linux_os_window(application) if OS.linux?
|
27
|
+
|
28
|
+
raise NotImplementedError, 'Your OS is not supported.'
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
#
|
34
|
+
# Returns list of window titles in FFmpeg expected format when using Microsoft Windows
|
35
|
+
#
|
36
|
+
def windows_os_window(application)
|
37
|
+
titles = `tasklist /v /fi "imagename eq #{application}.exe" /fo list | findstr Window`
|
38
|
+
.split("\n")
|
39
|
+
.map { |i| i.gsub(FILTERED_TITLES, '') }
|
40
|
+
.reject(&:empty?)
|
41
|
+
raise RecorderErrors::ApplicationNotFound, "No open windows found for: #{application}.exe" if titles.empty?
|
42
|
+
|
43
|
+
warn_on_mismatch(titles, application)
|
44
|
+
titles
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Returns list of window titles in FFmpeg expected format when using Linux
|
49
|
+
#
|
50
|
+
def linux_os_window(application)
|
51
|
+
FFMPEG.logger.warn 'Default capture device on Linux (x11grab) does not support window recording.'
|
52
|
+
raise DependencyNotFound, 'wmctrl is not installed. Run: sudo apt install wmctrl.' unless wmctrl_installed?
|
53
|
+
|
54
|
+
titles = `wmctrl -l | awk '{$3=""; $2=""; $1=""; print $0}'` # Returns all open windows
|
55
|
+
.split("\n")
|
56
|
+
.map(&:strip)
|
57
|
+
.select { |t| t.match?(/#{application}/i) } # Narrow down to given application
|
58
|
+
raise RecorderErrors::ApplicationNotFound, "No open windows found for: #{application}" if titles.empty?
|
59
|
+
|
60
|
+
titles
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# Returns true if wmctrl is installed
|
65
|
+
#
|
66
|
+
def wmctrl_installed?
|
67
|
+
!`which wmctrl`.empty? # "" when not found
|
68
|
+
end
|
69
|
+
|
70
|
+
#
|
71
|
+
# Prints a warning if the retrieved list of window titles does no include
|
72
|
+
# the given application process name, which applications commonly do.
|
73
|
+
#
|
74
|
+
def warn_on_mismatch(titles, application)
|
75
|
+
unless titles.map(&:downcase).join(',').include? application.to_s
|
76
|
+
FFMPEG.logger.warn "Process name and window title(s) do not match: #{titles}"
|
77
|
+
FFMPEG.logger.warn "Please manually provide the displayed window title."
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end # class WindowGrabber
|
81
|
+
end # module Windows
|
78
82
|
end # module FFMPEG
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffmpeg-screenrecorder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lakshya Kapoor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry-byebug
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.59'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.59'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: watir
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,6 +130,7 @@ executables: []
|
|
116
130
|
extensions: []
|
117
131
|
extra_rdoc_files: []
|
118
132
|
files:
|
133
|
+
- ".github/ISSUE_TEMPLATE.md"
|
119
134
|
- ".gitignore"
|
120
135
|
- ".rspec"
|
121
136
|
- ".rubocop.yml"
|
@@ -139,7 +154,9 @@ homepage: http://github.com/kapoorlakshya/ffmpeg-screenrecorder
|
|
139
154
|
licenses:
|
140
155
|
- MIT
|
141
156
|
metadata: {}
|
142
|
-
post_install_message:
|
157
|
+
post_install_message: 'PLEASE NOTE: ffmpeg-screenrecorder will soon be renamed to
|
158
|
+
screen_recorder. Please refer to Issue #45 on GitHub for more information (https://github.com/kapoorlakshya/ffmpeg-screenrecorder/issues/45).
|
159
|
+
Thank you!'
|
143
160
|
rdoc_options: []
|
144
161
|
require_paths:
|
145
162
|
- lib
|