x11_recorder 0.0.1
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 +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +53 -0
- data/LICENSE.md +21 -0
- data/README.mdown +43 -0
- data/Rakefile +7 -0
- data/lib/x11_recorder.rb +7 -0
- data/lib/x11_recorder/display.rb +48 -0
- data/lib/x11_recorder/version.rb +5 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/x11_recorder/display_spec.rb +55 -0
- data/x11_recorder.gemspec +26 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 230c768bfb2889155436ab71b053f81ac1ccc87b
|
4
|
+
data.tar.gz: 0b2e9c94f42d7b568b1f1ef13803b897ea6dcdc8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a7419bbfcc5164e38532c385d3b7b8fd5d7258929e146d3b4bedd2782fe4259c17de8966843640c61387be2278ac4c084701a6346ed3f5b609f21a4bfc8c3391
|
7
|
+
data.tar.gz: 1d0fd5571acc6a3d33e0ca46028eec5924bf598fc55a0c24c95632dd780adf42106530e5762b3d1ee6fb253bbafa39a9e864e2b1518fb5fe339247c93876012f
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
x11_recorder (0.0.1)
|
5
|
+
childprocess (>= 0.0.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
childprocess (0.5.3)
|
11
|
+
ffi (~> 1.0, >= 1.0.11)
|
12
|
+
coveralls (0.7.1)
|
13
|
+
multi_json (~> 1.3)
|
14
|
+
rest-client
|
15
|
+
simplecov (>= 0.7)
|
16
|
+
term-ansicolor
|
17
|
+
thor
|
18
|
+
diff-lcs (1.2.5)
|
19
|
+
docile (1.1.5)
|
20
|
+
ffi (1.9.3)
|
21
|
+
mime-types (2.3)
|
22
|
+
multi_json (1.10.1)
|
23
|
+
netrc (0.7.7)
|
24
|
+
rake (0.9.6)
|
25
|
+
rest-client (1.7.2)
|
26
|
+
mime-types (>= 1.16, < 3.0)
|
27
|
+
netrc (~> 0.7)
|
28
|
+
rspec (2.99.0)
|
29
|
+
rspec-core (~> 2.99.0)
|
30
|
+
rspec-expectations (~> 2.99.0)
|
31
|
+
rspec-mocks (~> 2.99.0)
|
32
|
+
rspec-core (2.99.2)
|
33
|
+
rspec-expectations (2.99.2)
|
34
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
35
|
+
rspec-mocks (2.99.2)
|
36
|
+
simplecov (0.9.0)
|
37
|
+
docile (~> 1.1.0)
|
38
|
+
multi_json
|
39
|
+
simplecov-html (~> 0.8.0)
|
40
|
+
simplecov-html (0.8.0)
|
41
|
+
term-ansicolor (1.3.0)
|
42
|
+
tins (~> 1.0)
|
43
|
+
thor (0.19.1)
|
44
|
+
tins (1.3.3)
|
45
|
+
|
46
|
+
PLATFORMS
|
47
|
+
ruby
|
48
|
+
|
49
|
+
DEPENDENCIES
|
50
|
+
coveralls
|
51
|
+
rake (~> 0.9.2)
|
52
|
+
rspec (~> 2.5)
|
53
|
+
x11_recorder!
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Jason Gowan
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.mdown
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
X11 Recorder
|
2
|
+
============
|
3
|
+
|
4
|
+
Thin wrapper around ffmpeg to record X11 displays.
|
5
|
+
|
6
|
+
Requirements
|
7
|
+
====
|
8
|
+
* X11 display
|
9
|
+
* Debian/Ubuntu (apt-get install ffmpeg)
|
10
|
+
* CentOS/RHEL/Fedora -> setup rpmfusion then yum install ffmpeg
|
11
|
+
* Arch Linux (pacman -S ffmpeg)
|
12
|
+
|
13
|
+
Usage
|
14
|
+
====
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
require 'x11_recorder'
|
18
|
+
|
19
|
+
recorder = X11Recorder::Display.new(
|
20
|
+
:filename => 'test_video.mp4',
|
21
|
+
:codec => 'mpeg4',
|
22
|
+
:display => ':1',
|
23
|
+
:frame_rate => '5',
|
24
|
+
:frame_size => '1024x768')
|
25
|
+
|
26
|
+
recorder.start
|
27
|
+
|
28
|
+
# do something
|
29
|
+
|
30
|
+
recorder.stop
|
31
|
+
```
|
32
|
+
|
33
|
+
Note on Patches/Pull Requests
|
34
|
+
=============================
|
35
|
+
|
36
|
+
* Fork the project.
|
37
|
+
* Make your feature addition or bug fix.
|
38
|
+
* Add tests for it. This is important so I don't break it in a
|
39
|
+
future version unintentionally.
|
40
|
+
* Commit, do not mess with rakefile, version, or history.
|
41
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
42
|
+
* Send me a pull request. Bonus points for topic branches.
|
43
|
+
|
data/Rakefile
ADDED
data/lib/x11_recorder.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
module X11Recorder
|
3
|
+
class Display
|
4
|
+
|
5
|
+
DEFAULT_OPTIONS = {
|
6
|
+
:filename => './test.mp4',
|
7
|
+
:codec => 'mpeg4',
|
8
|
+
:display => ENV['DISPLAY'],
|
9
|
+
:frame_rate => '5',
|
10
|
+
:frame_size => '1024x768'
|
11
|
+
}
|
12
|
+
|
13
|
+
def initialize(opts = {})
|
14
|
+
@options = DEFAULT_OPTIONS.dup.merge(opts)
|
15
|
+
end
|
16
|
+
|
17
|
+
def start
|
18
|
+
@recorder = create_process
|
19
|
+
@recorder.start
|
20
|
+
end
|
21
|
+
|
22
|
+
def stop
|
23
|
+
@recorder && @recorder.stop
|
24
|
+
@recorder = nil
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def create_process
|
30
|
+
@output = @options[:filename]
|
31
|
+
|
32
|
+
process = ChildProcess.build(
|
33
|
+
'ffmpeg',
|
34
|
+
'-an',
|
35
|
+
'-y',
|
36
|
+
'-f', 'x11grab',
|
37
|
+
'-r', @options[:frame_rate],
|
38
|
+
'-s', @options[:frame_size],
|
39
|
+
'-i', @options[:display],
|
40
|
+
'-vcodec', @options[:codec],
|
41
|
+
@options[:filename]
|
42
|
+
)
|
43
|
+
|
44
|
+
process.io.stdout = process.io.stderr = File.open('/dev/null', 'w')
|
45
|
+
process
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require File.expand_path("../../spec_helper", __FILE__)
|
2
|
+
|
3
|
+
module X11Recorder
|
4
|
+
describe Display do
|
5
|
+
let(:mock_process) { double(ChildProcess, :start => nil, :stop => nil, :io => double('io').as_null_object) }
|
6
|
+
|
7
|
+
it "can start recorder with default mp4 options" do
|
8
|
+
display = ENV['DISPLAY'] || ':1'
|
9
|
+
ChildProcess.should_receive(:build).with(
|
10
|
+
'ffmpeg',
|
11
|
+
'-an',
|
12
|
+
'-y',
|
13
|
+
'-f', 'x11grab',
|
14
|
+
'-r', '5',
|
15
|
+
'-s', '1024x768',
|
16
|
+
'-i', display,
|
17
|
+
'-vcodec', 'mpeg4',
|
18
|
+
'./test.mp4'
|
19
|
+
).and_return(mock_process)
|
20
|
+
mock_process.should_receive(:start)
|
21
|
+
mock_process.should_receive(:stop)
|
22
|
+
|
23
|
+
recorder = X11Recorder::Display.new
|
24
|
+
recorder.start
|
25
|
+
recorder.stop
|
26
|
+
end
|
27
|
+
|
28
|
+
it "can start recorder with non-default mp4 options" do
|
29
|
+
ChildProcess.should_receive(:build).with(
|
30
|
+
'ffmpeg',
|
31
|
+
'-an',
|
32
|
+
'-y',
|
33
|
+
'-f', 'x11grab',
|
34
|
+
'-r', '6',
|
35
|
+
'-s', '768x768',
|
36
|
+
'-i', ':42',
|
37
|
+
'-vcodec', 'v8',
|
38
|
+
'./test.webm'
|
39
|
+
).and_return(mock_process)
|
40
|
+
mock_process.should_receive(:start)
|
41
|
+
mock_process.should_receive(:stop)
|
42
|
+
|
43
|
+
recorder = X11Recorder::Display.new(
|
44
|
+
:filename => './test.webm',
|
45
|
+
:codec => 'v8',
|
46
|
+
:display => ':42',
|
47
|
+
:frame_rate => '6',
|
48
|
+
:frame_size => '768x768'
|
49
|
+
)
|
50
|
+
recorder.start
|
51
|
+
recorder.stop
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "x11_recorder/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "x11_recorder"
|
7
|
+
s.version = X11Recorder::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Jason Gowan"]
|
10
|
+
s.email = ["gowanjason@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Thin wrapper around ffmpeg to record X11 displays}
|
13
|
+
s.description = %q{Thin wrapper around ffmpeg to record X11 displays}
|
14
|
+
|
15
|
+
s.rubyforge_project = "x11_recorder"
|
16
|
+
|
17
|
+
s.add_dependency "childprocess", ">= 0.0.1"
|
18
|
+
s.add_development_dependency "rspec", "~> 2.5"
|
19
|
+
s.add_development_dependency "coveralls"
|
20
|
+
s.add_development_dependency "rake", "~> 0.9.2"
|
21
|
+
|
22
|
+
s.files = `git ls-files`.split("\n")
|
23
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
24
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
25
|
+
s.require_paths = ["lib"]
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: x11_recorder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jason Gowan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: childprocess
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.0.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: coveralls
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.2
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.9.2
|
69
|
+
description: Thin wrapper around ffmpeg to record X11 displays
|
70
|
+
email:
|
71
|
+
- gowanjason@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- Gemfile
|
77
|
+
- Gemfile.lock
|
78
|
+
- LICENSE.md
|
79
|
+
- README.mdown
|
80
|
+
- Rakefile
|
81
|
+
- lib/x11_recorder.rb
|
82
|
+
- lib/x11_recorder/display.rb
|
83
|
+
- lib/x11_recorder/version.rb
|
84
|
+
- spec/spec_helper.rb
|
85
|
+
- spec/x11_recorder/display_spec.rb
|
86
|
+
- x11_recorder.gemspec
|
87
|
+
homepage: ''
|
88
|
+
licenses: []
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project: x11_recorder
|
106
|
+
rubygems_version: 2.2.0
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Thin wrapper around ffmpeg to record X11 displays
|
110
|
+
test_files:
|
111
|
+
- spec/spec_helper.rb
|
112
|
+
- spec/x11_recorder/display_spec.rb
|