enigmamachine 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +62 -8
- data/VERSION +1 -1
- data/enigmamachine.gemspec +2 -2
- data/lib/enigmamachine.rb +12 -3
- data/lib/enigmamachine/config.ru +1 -1
- metadata +5 -5
data/README.rdoc
CHANGED
@@ -35,9 +35,9 @@ everything else is handled for you.
|
|
35
35
|
|
36
36
|
Once you've installed the gem (see below), you can do something like:
|
37
37
|
|
38
|
-
mkdir enigma
|
39
|
-
cd enigma
|
40
|
-
enigmamachine start # -d to daemonize
|
38
|
+
mkdir enigma
|
39
|
+
cd enigma
|
40
|
+
enigmamachine start # -d to daemonize
|
41
41
|
|
42
42
|
Then check it out in your browser, at http://localhost:2002.
|
43
43
|
|
@@ -56,9 +56,55 @@ Videos are encoded sequentially as they arrive.
|
|
56
56
|
|
57
57
|
== Encoders and Encoding Tasks
|
58
58
|
|
59
|
+
When you POST the location of a video to your enigmamachine, you need to tell
|
60
|
+
your EM what you want to do to the video. For example, you might want to take
|
61
|
+
an uploaded video and encode it as a 320x240 FLV video, with a 320x240 JPEG
|
62
|
+
thumbnail, and a 160x120 miniature thumbnail.
|
59
63
|
|
60
|
-
|
64
|
+
To do this, you'd fire up your enigmamachine by typing
|
61
65
|
|
66
|
+
enigmamachine start
|
67
|
+
|
68
|
+
and go to http://localhost:2002/encoders. Clicking the "new encoder" link will
|
69
|
+
allow you to define a new encoder. Let's call it "Flash video with a couple
|
70
|
+
thumbnails", and save it.
|
71
|
+
|
72
|
+
So, now there's an encoder, but it won't do anything. Let's add some tasks,
|
73
|
+
by clicking on the "new task" link.
|
74
|
+
|
75
|
+
Give the first task a name, like _Encode a 320x240 flv at 25 frames per second_.
|
76
|
+
|
77
|
+
The output file suffix in this case will be *.flv*.
|
78
|
+
|
79
|
+
The encoding command you'll want to use would be
|
80
|
+
_-ab 128 -ar 22050 -b 500000 -r 25 -s 320x240_. This cryptic command string
|
81
|
+
tells ffmpeg to encode a Flash video at 320x240 pixels, with an audio bitrate
|
82
|
+
of 128kbps, an audio sample rate of 22.050khz, and a frame rate of 25fps. You
|
83
|
+
can find out what all the ffmpeg command line switches do by RTFMing at
|
84
|
+
http://www.ffmpeg.org/ffmpeg-doc.html
|
85
|
+
|
86
|
+
You would go on to define a couple more encoding tasks for your encoder.
|
87
|
+
Grabbing a screen frame in ffmpeg can be done with the following command-line
|
88
|
+
switches, which you can put into a task called, let's say,
|
89
|
+
_Grab a 320x240 JPEG thumbnail_:
|
90
|
+
|
91
|
+
-ss 00:00:05 -t 00:00:01 -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240
|
92
|
+
|
93
|
+
Rinse and repeat for the 160x120 thumbnail.
|
94
|
+
|
95
|
+
== Security
|
96
|
+
|
97
|
+
Enigmamachine is set to bind by default to 127.0.0.1 (your system's loopback)
|
98
|
+
interface rather than on all network interfaces.
|
99
|
+
|
100
|
+
Making an enigmamachine available on an untrusted network (like
|
101
|
+
the Internet) would be a suicidal move on your part, since the code used to
|
102
|
+
talk to ffmpeg is a simple exec call and you'll be inviting everyone in the world
|
103
|
+
to execute commands on your server. Have fun with that.
|
104
|
+
|
105
|
+
If you don't know what any of this means, don't run it. I'm not responsible if
|
106
|
+
your enigmamachine screws up your system, allows people to exploit you, or
|
107
|
+
eats your mother.
|
62
108
|
|
63
109
|
== Installation
|
64
110
|
|
@@ -76,12 +122,20 @@ You can install it as a gem by doing:
|
|
76
122
|
|
77
123
|
If this command doesn't make any sense to you, it's because you don't know that
|
78
124
|
"gems" are ruby code packages, somewhat like apt-get except for ruby code only.
|
79
|
-
You can install rubygems
|
125
|
+
You can install rubygems, necessary sqlite headers, and a C compiler on
|
126
|
+
righteous operating systems by typing:
|
127
|
+
|
128
|
+
apt-get install rubygems ruby1.8-dev libopenssl-ruby build-essential libsqlite3-dev # as root
|
129
|
+
|
130
|
+
You'll need to add the following line to your ~/.bashrc file, as well:
|
80
131
|
|
81
|
-
|
132
|
+
export PATH=/var/lib/gems/1.8/bin:$PATH
|
82
133
|
|
83
|
-
Then
|
84
|
-
ffmpeg installed and available in your path.
|
134
|
+
Then _gem install enigmamachine_ should theoretically work. You'll also need a copy of
|
135
|
+
ffmpeg installed and available in your path. On Mac OS X, rubygems should
|
136
|
+
already be installed, although you'll need to have a C compiler available
|
137
|
+
(make sure you install the developer tools that came with your operating
|
138
|
+
system).
|
85
139
|
|
86
140
|
== Status
|
87
141
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/enigmamachine.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{enigmamachine}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["dave"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-08}
|
13
13
|
s.default_executable = %q{enigmamachine}
|
14
14
|
s.description = %q{A RESTful video encoder which you can use as either a front-end to ffmpeg or headless on a server.}
|
15
15
|
s.email = %q{dave@caprica}
|
data/lib/enigmamachine.rb
CHANGED
@@ -60,6 +60,11 @@ class EnigmaMachine < Sinatra::Base
|
|
60
60
|
set :views, File.dirname(__FILE__) + '/enigmamachine/views'
|
61
61
|
set :public, File.dirname(__FILE__) + '/enigmamachine/public'
|
62
62
|
|
63
|
+
# Let's bind this thing to localhost only, it'd be suicidal to put it on the
|
64
|
+
# internet by binding it to all available interfaces.
|
65
|
+
#
|
66
|
+
set :bind, 'localhost'
|
67
|
+
|
63
68
|
# Register helpers
|
64
69
|
#
|
65
70
|
helpers do
|
@@ -69,9 +74,13 @@ class EnigmaMachine < Sinatra::Base
|
|
69
74
|
|
70
75
|
# Set up Rack authentication
|
71
76
|
#
|
72
|
-
|
73
|
-
|
74
|
-
|
77
|
+
# I'm going to disable this for now, although later this might be a good way
|
78
|
+
# of providing security for shared hosts. TODO: figure out how to secure the
|
79
|
+
# app for use on shared hosts.
|
80
|
+
#
|
81
|
+
# use Rack::Auth::Basic do |username, password|
|
82
|
+
# [username, password] == ['admin', 'admin']
|
83
|
+
# end
|
75
84
|
|
76
85
|
# Include flash notices
|
77
86
|
#
|
data/lib/enigmamachine/config.ru
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enigmamachine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- dave
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-08 00:00:00 +01:00
|
19
19
|
default_executable: enigmamachine
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|