stlondemand-rvideo 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/CHANGELOG +70 -0
  2. data/ENV +100 -0
  3. data/ENV2 +129 -0
  4. data/LICENSE +20 -0
  5. data/Manifest +72 -0
  6. data/README +106 -0
  7. data/RULES +11 -0
  8. data/Rakefile +63 -0
  9. data/config/boot.rb +25 -0
  10. data/lib/rvideo.rb +49 -0
  11. data/lib/rvideo/command_executor.rb +91 -0
  12. data/lib/rvideo/errors.rb +24 -0
  13. data/lib/rvideo/float.rb +7 -0
  14. data/lib/rvideo/frame_capturer.rb +139 -0
  15. data/lib/rvideo/inspector.rb +519 -0
  16. data/lib/rvideo/reporter.rb +176 -0
  17. data/lib/rvideo/reporter/views/index.html.erb +27 -0
  18. data/lib/rvideo/reporter/views/report.css +27 -0
  19. data/lib/rvideo/reporter/views/report.html.erb +81 -0
  20. data/lib/rvideo/reporter/views/report.js +9 -0
  21. data/lib/rvideo/string.rb +5 -0
  22. data/lib/rvideo/tools/abstract_tool.rb +459 -0
  23. data/lib/rvideo/tools/ffmpeg.rb +314 -0
  24. data/lib/rvideo/tools/ffmpeg2theora.rb +72 -0
  25. data/lib/rvideo/tools/flvtool2.rb +50 -0
  26. data/lib/rvideo/tools/handbrakecli.rb +61 -0
  27. data/lib/rvideo/tools/lame.rb +58 -0
  28. data/lib/rvideo/tools/mencoder.rb +126 -0
  29. data/lib/rvideo/tools/mp4box.rb +21 -0
  30. data/lib/rvideo/tools/mp4creator.rb +35 -0
  31. data/lib/rvideo/tools/mplayer.rb +31 -0
  32. data/lib/rvideo/tools/qtfaststart.rb +37 -0
  33. data/lib/rvideo/tools/segmenter.rb +29 -0
  34. data/lib/rvideo/tools/yamdi.rb +44 -0
  35. data/lib/rvideo/transcoder.rb +170 -0
  36. data/lib/rvideo/version.rb +9 -0
  37. data/scripts/txt2html +67 -0
  38. data/spec/files/boat.avi +0 -0
  39. data/spec/files/kites.mp4 +0 -0
  40. data/spec/fixtures/ffmpeg_builds.yml +28 -0
  41. data/spec/fixtures/ffmpeg_results.yml +608 -0
  42. data/spec/fixtures/files.yml +398 -0
  43. data/spec/fixtures/recipes.yml +58 -0
  44. data/spec/integrations/formats_spec.rb +315 -0
  45. data/spec/integrations/frame_capturer_spec.rb +26 -0
  46. data/spec/integrations/inspection_spec.rb +125 -0
  47. data/spec/integrations/recipes_spec.rb +0 -0
  48. data/spec/integrations/rvideo_spec.rb +17 -0
  49. data/spec/integrations/transcoder_integration_spec.rb +29 -0
  50. data/spec/integrations/transcoding_spec.rb +9 -0
  51. data/spec/spec.opts +1 -0
  52. data/spec/spec_helper.rb +16 -0
  53. data/spec/support.rb +36 -0
  54. data/spec/units/abstract_tool_spec.rb +111 -0
  55. data/spec/units/command_executor_spec.rb +106 -0
  56. data/spec/units/ffmpeg_spec.rb +385 -0
  57. data/spec/units/flvtool2_spec.rb +323 -0
  58. data/spec/units/frame_capturer_spec.rb +71 -0
  59. data/spec/units/inspector_spec.rb +59 -0
  60. data/spec/units/mencoder_spec.rb +4994 -0
  61. data/spec/units/mp4box_spec.rb +34 -0
  62. data/spec/units/mp4creator_spec.rb +34 -0
  63. data/spec/units/mplayer_spec.rb +34 -0
  64. data/spec/units/qtfaststart_spec.rb +35 -0
  65. data/spec/units/string_spec.rb +8 -0
  66. data/spec/units/transcoder_spec.rb +154 -0
  67. data/stlondemand-rvideo.gemspec +36 -0
  68. data/tasks/deployment.rake +5 -0
  69. data/tasks/testing.rake +27 -0
  70. data/tasks/transcoding.rake +40 -0
  71. data/tasks/website.rake +8 -0
  72. data/test_progress_reporting.rb +14 -0
  73. metadata +187 -0
@@ -0,0 +1,34 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ module RVideo
4
+ module Tools
5
+
6
+ describe Mp4box do
7
+ before do
8
+ setup_mp4box_spec
9
+ end
10
+
11
+ it "should initialize with valid arguments" do
12
+ @mp4box.class.should == Mp4box
13
+ end
14
+
15
+ it "should have the correct tool_command" do
16
+ @mp4box.tool_command.should == 'MP4Box'
17
+ end
18
+
19
+ it "should mixin AbstractTool" do
20
+ Mp4box.included_modules.include?(AbstractTool::InstanceMethods).should be_true
21
+ end
22
+
23
+ it "should set supported options successfully" do
24
+ @mp4box.options[:output_file].should == @options[:output_file]
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ def setup_mp4box_spec
31
+ @options = {:output_file => "foo"}
32
+ @command = "MP4Box $output_file$ -ipod"
33
+ @mp4box = RVideo::Tools::Mp4box.new(@command, @options)
34
+ end
@@ -0,0 +1,34 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ module RVideo
4
+ module Tools
5
+
6
+ describe Mp4creator do
7
+ before do
8
+ setup_mp4creator_spec
9
+ end
10
+
11
+ it "should initialize with valid arguments" do
12
+ @mp4creator.class.should == Mp4creator
13
+ end
14
+
15
+ it "should have the correct tool_command" do
16
+ @mp4creator.tool_command.should == 'mp4creator'
17
+ end
18
+
19
+ it "should mixin AbstractTool" do
20
+ Mp4creator.included_modules.include?(AbstractTool::InstanceMethods).should be_true
21
+ end
22
+
23
+ it "should set supported options successfully" do
24
+ @mp4creator.options[:output_file].should == @options[:output_file]
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ def setup_mp4creator_spec
31
+ @options = {:output_file => "foo"}
32
+ @command = "mp4creator -create=temp.aac $output_file$"
33
+ @mp4creator = RVideo::Tools::Mp4creator.new(@command, @options)
34
+ end
@@ -0,0 +1,34 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ module RVideo
4
+ module Tools
5
+
6
+ describe Mplayer do
7
+ before do
8
+ setup_mplayer_spec
9
+ end
10
+
11
+ it "should initialize with valid arguments" do
12
+ @mplayer.class.should == Mplayer
13
+ end
14
+
15
+ it "should have the correct tool_command" do
16
+ @mplayer.tool_command.should == 'mplayer'
17
+ end
18
+
19
+ it "should mixin AbstractTool" do
20
+ Mplayer.included_modules.include?(AbstractTool::InstanceMethods).should be_true
21
+ end
22
+
23
+ it "should set supported options successfully" do
24
+ @mplayer.options[:output_file].should == @options[:output_file]
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ def setup_mplayer_spec
31
+ @options = {:output_file => "foo"}
32
+ @command = "mplayer temp.avi -dumpaudio -dumpfile temp.aac"
33
+ @mplayer = RVideo::Tools::Mplayer.new(@command, @options)
34
+ end
@@ -0,0 +1,35 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ module RVideo
4
+ module Tools
5
+
6
+ describe QtFaststart do
7
+ before do
8
+ setup_qtfaststart_spec
9
+ end
10
+
11
+ it "should initialize with valid arguments" do
12
+ @qtfaststart.class.should == QtFaststart
13
+ end
14
+
15
+ it "should have the correct tool_command" do
16
+ @qtfaststart.tool_command.should == 'qt-faststart'
17
+ end
18
+
19
+ it "should mixin AbstractTool" do
20
+ QtFaststart.included_modules.include?(AbstractTool::InstanceMethods).should be_true
21
+ end
22
+
23
+ it "should set supported options successfully" do
24
+ @qtfaststart.options[:output_file].should == @options[:output_file]
25
+ @qtfaststart.options[:input_file].should == @options[:input_file]
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ def setup_qtfaststart_spec
32
+ @options = {:input_file => "foo.mp4", :output_file => "foo2.mp4"}
33
+ @command = "qt-faststart $input_file$ $output_file$"
34
+ @qtfaststart = RVideo::Tools::QtFaststart.new(@command, @options)
35
+ end
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + "/../spec_helper"
2
+
3
+ describe String, "shell quoting" do
4
+ it "should wrap self in single quotes" do
5
+ "foo".shell_quoted.should == "'foo'"
6
+ "foo & bar $(rm -rf /)".shell_quoted.should == "'foo & bar $(rm -rf /)'"
7
+ end
8
+ end
@@ -0,0 +1,154 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ def setup_spec
4
+ @options = {
5
+ :output_file => "bar",
6
+ :resolution => "baz"
7
+ }
8
+
9
+ @input_file = spec_file "kites.mp4"
10
+ @simple_avi = "ffmpeg -i $input_file$ -ar 44100 -ab 64 -vcodec xvid -acodec mp3 -r 29.97 $resolution$ -y $output_file$"
11
+
12
+ @transcoder = RVideo::Transcoder.new(@input_file)
13
+ @transcoder.stub! :do_execute
14
+
15
+ @mock_original_file = mock(:original)
16
+ @mock_original_file.stub!(:raw_response)
17
+ RVideo::Inspector.stub!(:new).and_return(@mock_original_file)
18
+ end
19
+
20
+ # TODO it would be nice if there was less mocking in here
21
+ # also some of these tests are worthless, but anyway..
22
+
23
+ module RVideo
24
+
25
+ describe Transcoder, "execution" do
26
+ before do
27
+ setup_spec
28
+ @transcoder.stub!(:check_integrity).and_return(true)
29
+ end
30
+
31
+ it "should pass a string as-is, along with options" do
32
+ @transcoder.stub!(:parse_and_execute)
33
+ @simple_avi = "ffmpeg -i foo"
34
+ @transcoder.execute(@simple_avi, @options)
35
+ end
36
+
37
+ it "should store a Tool object at transcoder.executed_commands" do
38
+ @mock_ffmpeg = mock("ffmpeg")
39
+ Tools::AbstractTool.stub!(:assign).and_return(@mock_ffmpeg)
40
+ @mock_ffmpeg.should_receive(:execute)
41
+ @mock_ffmpeg.stub!(:original=)
42
+ @transcoder.execute(@simple_avi, @options)
43
+ @transcoder.executed_commands.size.should == 1
44
+ @transcoder.executed_commands.first.should == @mock_ffmpeg
45
+ end
46
+
47
+ it "should set original file" do
48
+ @mock_ffmpeg = mock("ffmpeg")
49
+ Tools::AbstractTool.stub!(:assign).and_return(@mock_ffmpeg)
50
+ @mock_ffmpeg.stub!(:execute)
51
+ @mock_ffmpeg.should_receive(:original=).with(@transcoder.original)
52
+ @transcoder.execute(@simple_avi, @options)
53
+ end
54
+
55
+ # FIXME
56
+ # it "should raise an exception when trying to call a tool that doesn't exist" do
57
+ # lambda {
58
+ # @transcoder.send(:parse_and_execute, "foo -i bar", {})
59
+ # }.should raise_error(TranscoderError::UnknownTool, /recipe tried to use the 'foo' tool/)
60
+ # end
61
+
62
+ it "should raise an exception when the first argument is not a string" do
63
+ [String, 1, 1.0, true, nil, :foo].each do |obj|
64
+ lambda {
65
+ @transcoder.execute(obj, @options)
66
+ }.should raise_error(TranscoderError::ParameterError, /expected.*recipe.*string/i)
67
+ end
68
+ end
69
+ end
70
+
71
+ describe Transcoder, "file integrity checks" do
72
+
73
+ before do
74
+ setup_spec
75
+ @transcoder.stub!(:parse_and_execute)
76
+ @mock_processed_file = mock("processed")
77
+ @mock_original_file.stub!(:duration).and_return 10
78
+ @mock_original_file.stub!(:invalid?).and_return false
79
+ @mock_processed_file.stub!(:duration).and_return 10
80
+ @mock_processed_file.stub!(:invalid?).and_return false
81
+ Inspector.stub!(:new).with(:file => "bar").and_return(@mock_processed_file)
82
+ end
83
+
84
+ it "should call the inspector twice on a successful job, and should set @original and @processed" do
85
+ @transcoder.original.should_not be_nil
86
+ @transcoder.processed.should be_nil
87
+
88
+ @transcoder.execute(@simple_avi, @options)
89
+ @transcoder.original.should == @mock_original_file
90
+ @transcoder.processed.should == @mock_processed_file
91
+ end
92
+
93
+ it "should check integrity" do
94
+ @transcoder.should_receive(:check_integrity).once.and_return true
95
+ @transcoder.execute(@simple_avi, @options).should be_true
96
+ @transcoder.errors.should be_empty
97
+ end
98
+
99
+ it "should fail if output duration is more than 10% different than the original" do
100
+ @mock_processed_file.should_receive(:duration).twice.and_return(0)
101
+ @transcoder.execute(@simple_avi, @options).should be_false
102
+ @transcoder.errors.should == ["Processed file has a duration of 0"]
103
+ end
104
+
105
+ it "should fail if the processed file is invalid" do
106
+ @mock_processed_file.should_receive(:invalid?).and_return(true)
107
+ @transcoder.execute(@simple_avi, @options).should be_false
108
+ @transcoder.errors.should_not be_empty
109
+ end
110
+
111
+ end
112
+
113
+ describe Transcoder, "#parse_and_execute" do
114
+ before do
115
+ setup_spec
116
+ @mock_tool = mock("tool")
117
+ @mock_tool.stub!(:execute)
118
+ @mock_tool.stub!(:original=)
119
+ @options_plus_input = @options.merge(:input_file => @input_file)
120
+ end
121
+
122
+ it "should assign a command via AbstractTool.assign, and pass the right options" do
123
+ Tools::AbstractTool.should_receive(:assign).with(@simple_avi, @options_plus_input).and_return(@mock_tool)
124
+ @transcoder.send(:parse_and_execute, @simple_avi, @options)
125
+ end
126
+
127
+ it "should call Tools::AbstractTool once with a one-line recipe" do
128
+ Tools::AbstractTool.should_receive(:assign).once.and_return(@mock_tool)
129
+ @transcoder.send(:parse_and_execute, @simple_avi, @options)
130
+ end
131
+
132
+ it "should call twice with a two-line recipe" do
133
+ two_line = "ffmpeg -i foo \n ffmpeg -i bar"
134
+ Tools::AbstractTool.should_receive(:assign).twice.and_return(@mock_tool)
135
+ @transcoder.send(:parse_and_execute, two_line, @options)
136
+ end
137
+
138
+ it "should call five times with a five-line recipe" do
139
+ five_line = "ffmpeg -i foo \n ffmpeg -i bar \n flvtool2 -i foo \n mp4box \n ffmpeg 8"
140
+ Tools::AbstractTool.should_receive(:assign).exactly(5).and_return(@mock_tool)
141
+ @transcoder.stub!(:do_execute)
142
+ @transcoder.send(:parse_and_execute, five_line, @options)
143
+ end
144
+
145
+ it "should pass an exception from the abstract tool" do
146
+ Tools::AbstractTool.should_receive(:assign).and_raise(TranscoderError::UnexpectedResult)
147
+
148
+ lambda {
149
+ @transcoder.send(:parse_and_execute, @simple_avi, @options)
150
+ }.should raise_error(TranscoderError::UnexpectedResult)
151
+ end
152
+ end
153
+
154
+ end
@@ -0,0 +1,36 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{stlondemand-rvideo}
5
+ s.version = "0.9.7"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Peter Boling, Jonathan Dahl (Slantwise Design), Seth Thomas Rasmussen"]
9
+ s.date = %q{2010-05-17}
10
+ s.description = %q{Inspect and transcode video and audio files.}
11
+ s.email = %q{sethrasmussen@gmail.com}
12
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/rvideo.rb", "lib/rvideo/command_executor.rb", "lib/rvideo/errors.rb", "lib/rvideo/float.rb", "lib/rvideo/frame_capturer.rb", "lib/rvideo/inspector.rb", "lib/rvideo/reporter.rb", "lib/rvideo/reporter/views/index.html.erb", "lib/rvideo/reporter/views/report.css", "lib/rvideo/reporter/views/report.html.erb", "lib/rvideo/reporter/views/report.js", "lib/rvideo/string.rb", "lib/rvideo/tools/abstract_tool.rb", "lib/rvideo/tools/ffmpeg.rb", "lib/rvideo/tools/ffmpeg2theora.rb", "lib/rvideo/tools/flvtool2.rb", "lib/rvideo/tools/mencoder.rb", "lib/rvideo/tools/mp4box.rb", "lib/rvideo/tools/mp4creator.rb", "lib/rvideo/tools/mplayer.rb", "lib/rvideo/tools/qtfaststart.rb", "lib/rvideo/tools/segmenter.rb", "lib/rvideo/tools/yamdi.rb", "lib/rvideo/tools/handbrakecli.rb", "lib/rvideo/tools/lame.rb", "lib/rvideo/transcoder.rb", "lib/rvideo/version.rb", "tasks/deployment.rake", "tasks/testing.rake", "tasks/transcoding.rake", "tasks/website.rake"]
13
+ s.files = ["CHANGELOG", "ENV", "ENV2", "LICENSE", "Manifest", "README", "RULES", "Rakefile", "config/boot.rb", "lib/rvideo.rb", "lib/rvideo/command_executor.rb", "lib/rvideo/errors.rb", "lib/rvideo/float.rb", "lib/rvideo/frame_capturer.rb", "lib/rvideo/inspector.rb", "lib/rvideo/reporter.rb", "lib/rvideo/reporter/views/index.html.erb", "lib/rvideo/reporter/views/report.css", "lib/rvideo/reporter/views/report.html.erb", "lib/rvideo/reporter/views/report.js", "lib/rvideo/string.rb", "lib/rvideo/tools/abstract_tool.rb", "lib/rvideo/tools/ffmpeg.rb", "lib/rvideo/tools/ffmpeg2theora.rb", "lib/rvideo/tools/flvtool2.rb", "lib/rvideo/tools/mencoder.rb", "lib/rvideo/tools/mp4box.rb", "lib/rvideo/tools/mp4creator.rb", "lib/rvideo/tools/mplayer.rb", "lib/rvideo/tools/qtfaststart.rb", "lib/rvideo/tools/segmenter.rb", "lib/rvideo/tools/yamdi.rb", "lib/rvideo/transcoder.rb", "lib/rvideo/version.rb", "stlondemand-rvideo.gemspec", "scripts/txt2html", "spec/files/boat.avi", "spec/files/kites.mp4", "spec/fixtures/ffmpeg_builds.yml", "spec/fixtures/ffmpeg_results.yml", "spec/fixtures/files.yml", "spec/fixtures/recipes.yml", "spec/integrations/formats_spec.rb", "spec/integrations/frame_capturer_spec.rb", "spec/integrations/inspection_spec.rb", "spec/integrations/recipes_spec.rb", "spec/integrations/rvideo_spec.rb", "spec/integrations/transcoder_integration_spec.rb", "spec/integrations/transcoding_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/support.rb", "spec/units/abstract_tool_spec.rb", "spec/units/command_executor_spec.rb", "spec/units/ffmpeg_spec.rb", "spec/units/flvtool2_spec.rb", "spec/units/frame_capturer_spec.rb", "spec/units/inspector_spec.rb", "spec/units/mencoder_spec.rb", "spec/units/mp4box_spec.rb", "spec/units/mp4creator_spec.rb", "spec/units/mplayer_spec.rb", "spec/units/qtfaststart_spec.rb", "spec/units/string_spec.rb", "spec/units/transcoder_spec.rb", "tasks/deployment.rake", "tasks/testing.rake", "tasks/transcoding.rake", "tasks/website.rake", "test_progress_reporting.rb"]
14
+ s.homepage = %q{http://github.com/greatseth/rvideo}
15
+ s.rdoc_options = ["--quiet", "--title", "rvideo documentation", "--opname", "index.html", "--line-numbers", "--main", "README", "--inline-source"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{stlondemand-rvideo}
18
+ s.rubygems_version = %q{1.3.6}
19
+ s.summary = %q{Inspect and transcode video and audio files.}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
26
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
27
+ s.add_development_dependency(%q<rspec>, [">= 0"])
28
+ else
29
+ s.add_dependency(%q<activesupport>, [">= 0"])
30
+ s.add_dependency(%q<rspec>, [">= 0"])
31
+ end
32
+ else
33
+ s.add_dependency(%q<activesupport>, [">= 0"])
34
+ s.add_dependency(%q<rspec>, [">= 0"])
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ desc "Release the website and new gem version"
2
+ task :deploy => [:manifest, :release, :publish_docs]
3
+
4
+ desc "Regenerates website, rdoc and package. Installs the gem locally."
5
+ task "deploy:local" => ["web:generate", :redocs, :repackage, :install]
@@ -0,0 +1,27 @@
1
+ begin
2
+ require "spec/rake/spectask"
3
+ rescue LoadError
4
+ puts "To use rspec for testing you must install rspec gem:"
5
+ puts "$ sudo gem install rspec"
6
+ exit
7
+ end
8
+
9
+ namespace :spec do
10
+ desc "Run Unit Specs"
11
+ Spec::Rake::SpecTask.new("units") do |t|
12
+ t.spec_files = FileList['spec/units/**/*.rb']
13
+ t.spec_opts = %w( --color )
14
+ end
15
+
16
+ desc "Run Integration Specs"
17
+ Spec::Rake::SpecTask.new("integrations") do |t|
18
+ t.spec_files = FileList['spec/integrations/**/*.rb']
19
+ t.spec_opts = %w( --color )
20
+ end
21
+ end
22
+
23
+ desc "Run unit and integration specs"
24
+ task :spec => ["spec:units", "spec:integrations"]
25
+
26
+ # Echo defines the :default task to run the :test task
27
+ task :test => :spec
@@ -0,0 +1,40 @@
1
+ def transcode_single_job(recipe, input_file)
2
+ puts "Transcoding #{File.basename(input_file)} to #{recipe}"
3
+ r = YAML.load_file(File.dirname(__FILE__) + '/test/recipes.yml')[recipe]
4
+ transcoder = RVideo::Transcoder.new(input_file)
5
+ output_file = "#{TEMP_PATH}/#{File.basename(input_file, ".*")}-#{recipe}.#{r['extension']}"
6
+ FileUtils.mkdir_p(File.dirname(output_file))
7
+ begin
8
+ transcoder.execute(r['command'], {:output_file => output_file}.merge(r))
9
+ puts "Finished #{File.basename(output_file)} in #{transcoder.total_time}"
10
+ rescue StandardError => e
11
+ puts "Error transcoding #{File.basename(output_file)} - #{e.class} (#{e.message}\n#{e.backtrace})"
12
+ end
13
+ end
14
+
15
+ def set_logger(path_or_io)
16
+ RVideo::Transcoder.logger = Logger.new(path_or_io)
17
+ end
18
+
19
+ ###
20
+
21
+ desc "Process a file"
22
+ task :transcode do
23
+ set_logger STDOUT
24
+ transcode_single_job ENV['RECIPE'], ENV['FILE']
25
+ end
26
+
27
+ desc "Batch transcode files"
28
+ task "transcode:batch" do
29
+ set_logger File.dirname(__FILE__) + '/test/output.log'
30
+
31
+ f = YAML.load_file(File.dirname(__FILE__) + '/test/batch_transcode.yml')
32
+
33
+ recipes = f['recipes']
34
+ files = f['files']
35
+
36
+ files.each do |f|
37
+ file = "#{File.dirname(__FILE__)}/test/files/#{f}"
38
+ recipes.each { |r| transcode_single_job r, file }
39
+ end
40
+ end
@@ -0,0 +1,8 @@
1
+ namespace :web do
2
+ desc "Regnerate website files from text templates"
3
+ task :generate do
4
+ Dir['website/**/*.txt'].each do |txt|
5
+ sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ require 'lib/rvideo'
2
+
3
+ transcoder = RVideo::Transcoder.new
4
+
5
+ recipe = "ffmpeg -i $input_file$ -ar 22050 -ab 64 -f flv -y $output_file$"
6
+ recipe += "\nflvtool2 -U $output_file$"
7
+ begin
8
+ transcoder.execute(recipe, {:input_file => "tmp/broken.avi",
9
+ :output_file => "tmp/output.flv", :progress => true}) do |progress|
10
+ puts "#{progress[:tool].tool_command}: #{progress[:progress]}%"
11
+ end
12
+ rescue RVideo::TranscoderError => e
13
+ puts "Unable to transcode file: #{e.class} - #{e.message}"
14
+ end
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stlondemand-rvideo
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.9.7
6
+ platform: ruby
7
+ authors:
8
+ - Peter Boling, Jonathan Dahl (Slantwise Design), Seth Thomas Rasmussen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2010-05-17 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activesupport
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: rspec
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ type: :development
36
+ version_requirements: *id002
37
+ description: Inspect and transcode video and audio files.
38
+ email: sethrasmussen@gmail.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - CHANGELOG
45
+ - LICENSE
46
+ - README
47
+ - lib/rvideo.rb
48
+ - lib/rvideo/command_executor.rb
49
+ - lib/rvideo/errors.rb
50
+ - lib/rvideo/float.rb
51
+ - lib/rvideo/frame_capturer.rb
52
+ - lib/rvideo/inspector.rb
53
+ - lib/rvideo/reporter.rb
54
+ - lib/rvideo/reporter/views/index.html.erb
55
+ - lib/rvideo/reporter/views/report.css
56
+ - lib/rvideo/reporter/views/report.html.erb
57
+ - lib/rvideo/reporter/views/report.js
58
+ - lib/rvideo/string.rb
59
+ - lib/rvideo/tools/abstract_tool.rb
60
+ - lib/rvideo/tools/ffmpeg.rb
61
+ - lib/rvideo/tools/ffmpeg2theora.rb
62
+ - lib/rvideo/tools/flvtool2.rb
63
+ - lib/rvideo/tools/mencoder.rb
64
+ - lib/rvideo/tools/mp4box.rb
65
+ - lib/rvideo/tools/mp4creator.rb
66
+ - lib/rvideo/tools/mplayer.rb
67
+ - lib/rvideo/tools/qtfaststart.rb
68
+ - lib/rvideo/tools/segmenter.rb
69
+ - lib/rvideo/tools/yamdi.rb
70
+ - lib/rvideo/tools/handbrakecli.rb
71
+ - lib/rvideo/tools/lame.rb
72
+ - lib/rvideo/transcoder.rb
73
+ - lib/rvideo/version.rb
74
+ - tasks/deployment.rake
75
+ - tasks/testing.rake
76
+ - tasks/transcoding.rake
77
+ - tasks/website.rake
78
+ files:
79
+ - CHANGELOG
80
+ - ENV
81
+ - ENV2
82
+ - LICENSE
83
+ - Manifest
84
+ - README
85
+ - RULES
86
+ - Rakefile
87
+ - config/boot.rb
88
+ - lib/rvideo.rb
89
+ - lib/rvideo/command_executor.rb
90
+ - lib/rvideo/errors.rb
91
+ - lib/rvideo/float.rb
92
+ - lib/rvideo/frame_capturer.rb
93
+ - lib/rvideo/inspector.rb
94
+ - lib/rvideo/reporter.rb
95
+ - lib/rvideo/reporter/views/index.html.erb
96
+ - lib/rvideo/reporter/views/report.css
97
+ - lib/rvideo/reporter/views/report.html.erb
98
+ - lib/rvideo/reporter/views/report.js
99
+ - lib/rvideo/string.rb
100
+ - lib/rvideo/tools/abstract_tool.rb
101
+ - lib/rvideo/tools/ffmpeg.rb
102
+ - lib/rvideo/tools/ffmpeg2theora.rb
103
+ - lib/rvideo/tools/flvtool2.rb
104
+ - lib/rvideo/tools/mencoder.rb
105
+ - lib/rvideo/tools/mp4box.rb
106
+ - lib/rvideo/tools/mp4creator.rb
107
+ - lib/rvideo/tools/mplayer.rb
108
+ - lib/rvideo/tools/qtfaststart.rb
109
+ - lib/rvideo/tools/segmenter.rb
110
+ - lib/rvideo/tools/yamdi.rb
111
+ - lib/rvideo/transcoder.rb
112
+ - lib/rvideo/version.rb
113
+ - stlondemand-rvideo.gemspec
114
+ - scripts/txt2html
115
+ - spec/files/boat.avi
116
+ - spec/files/kites.mp4
117
+ - spec/fixtures/ffmpeg_builds.yml
118
+ - spec/fixtures/ffmpeg_results.yml
119
+ - spec/fixtures/files.yml
120
+ - spec/fixtures/recipes.yml
121
+ - spec/integrations/formats_spec.rb
122
+ - spec/integrations/frame_capturer_spec.rb
123
+ - spec/integrations/inspection_spec.rb
124
+ - spec/integrations/recipes_spec.rb
125
+ - spec/integrations/rvideo_spec.rb
126
+ - spec/integrations/transcoder_integration_spec.rb
127
+ - spec/integrations/transcoding_spec.rb
128
+ - spec/spec.opts
129
+ - spec/spec_helper.rb
130
+ - spec/support.rb
131
+ - spec/units/abstract_tool_spec.rb
132
+ - spec/units/command_executor_spec.rb
133
+ - spec/units/ffmpeg_spec.rb
134
+ - spec/units/flvtool2_spec.rb
135
+ - spec/units/frame_capturer_spec.rb
136
+ - spec/units/inspector_spec.rb
137
+ - spec/units/mencoder_spec.rb
138
+ - spec/units/mp4box_spec.rb
139
+ - spec/units/mp4creator_spec.rb
140
+ - spec/units/mplayer_spec.rb
141
+ - spec/units/qtfaststart_spec.rb
142
+ - spec/units/string_spec.rb
143
+ - spec/units/transcoder_spec.rb
144
+ - tasks/deployment.rake
145
+ - tasks/testing.rake
146
+ - tasks/transcoding.rake
147
+ - tasks/website.rake
148
+ - test_progress_reporting.rb
149
+ - lib/rvideo/tools/handbrakecli.rb
150
+ - lib/rvideo/tools/lame.rb
151
+ homepage: http://github.com/greatseth/rvideo
152
+ licenses: []
153
+
154
+ post_install_message:
155
+ rdoc_options:
156
+ - --quiet
157
+ - --title
158
+ - rvideo documentation
159
+ - --opname
160
+ - index.html
161
+ - --line-numbers
162
+ - --main
163
+ - README
164
+ - --inline-source
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ none: false
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: "0"
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ none: false
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: "1.2"
179
+ requirements: []
180
+
181
+ rubyforge_project: stlondemand-rvideo
182
+ rubygems_version: 1.8.8
183
+ signing_key:
184
+ specification_version: 3
185
+ summary: Inspect and transcode video and audio files.
186
+ test_files: []
187
+