flvtool2 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,109 @@
1
+ = Changelog FLVTool2 - Flash video manipulation
2
+
3
+ == Version 1.0.6
4
+
5
+ * FLVTool2 is now published also as a gem
6
+ * fixed inspect at audio tags (thanks Andrew Wason)
7
+ * updated exe generation to new exerb version (4.1.0)
8
+ * small bugfix for mencoder encoded files causing a segmentation fault
9
+ * Changed newline character of tags.xml file to \n
10
+
11
+ == Version 1.0.5 RC6
12
+
13
+ * Fixed bug, that prevented injection of custom metadata
14
+ * Fixed several bugs, that would cause errors if flv-file has only audio tags (Ticket #7)
15
+
16
+ == Version 1.0.4 RC5
17
+
18
+ * Reorganized directory structure and namespaces
19
+ * Implemented setup for linux OS
20
+ * Made flvtool2 command systemwide available (Ticket #2)
21
+ * Added rake tasks for svn tagging and rubyforge uploads
22
+ * Added README and CHANGELOG
23
+ * Moved version output to separate file to include in Rakefile
24
+ * Recoded calling of before and after filters (Ticket #5)
25
+ * Fixed that header type flag was not written (Ticket #3)
26
+ * Added hasVideo, hasAudio, hasMetadata, hasCuePoints and hasKeyframes metadata
27
+
28
+ == Version 1.0.3 RC4
29
+
30
+ * Redesigned error handling
31
+ * Introduced -a switch, that collapses cutted regions
32
+
33
+ == Version 1.0.2 RC3
34
+
35
+ * stream.log will now be overwritten if exists
36
+ * Fixed that files without keyframes could not be updated
37
+ * Fullfilled help screen
38
+
39
+ == Version 1.0.1 RC2
40
+
41
+ * Introduced l switch, that logs down infomation to stream.log while infile is read. Very handy for debugging!
42
+ * 'pipe' is also recognized as a keyword for in or out pipes
43
+ * Frame sequence calculations will now be cached, resulting in a much better performance.
44
+ * Removed a bug that lets MiXML fail while reading multiline comments.
45
+ * Windows pipes are broken. Linux pipes work as expected. Will fix that later.
46
+ * Removed a bug, that is caused by one byte too long files, generated by ffmpeg.
47
+
48
+ == Version 1.0.0 RC1
49
+
50
+ * added cut command
51
+ * added add command
52
+ * redesigned command line option parsing
53
+ * improved FLVStream
54
+ * added cue point support (onCuePoint tags)
55
+ * made Flash 8 compatible
56
+ * added keyframes in onMetaTag
57
+ * introduced command chaining
58
+ * introduced pipes and redirects
59
+ * improved debug command
60
+ * added simulation mode
61
+ * added Linux start script
62
+ * added automatic exe generation and packaging in Rakefile
63
+ * added version command
64
+
65
+ == Version 0.18
66
+
67
+ * made MetaTag read procedure more stable
68
+
69
+ == Version 0.17
70
+
71
+ * added -a switch, that prints out meta data even on files not converted to FLV 1.1 (-a means print out [a]ll files)
72
+ * added -c switch, that makes FLVTool2 compatible to flashcom (currently only duration is computed like flashcom would)
73
+ * changed the help screen a bit
74
+
75
+ == Version 0.16
76
+
77
+ * print command results are now in the same format, as the flash to_string method would produce
78
+ * new meta-data-creator string
79
+ * application does not shut down anymore, if an error occurs in batch processing
80
+ * added lastkeyframetimestamp
81
+ * added onLastSecond event
82
+ * changed lasttimestamp unit to seconds
83
+ * changed lastkeyframetimestamp unit to seconds
84
+ * added debug command
85
+
86
+ == Version 0.15
87
+
88
+ * removed a bug, that removed first video frame, if a meta tag was inserted
89
+
90
+ == Version 0.14
91
+
92
+ * added print command (YAML and XML support)
93
+ * made -n switch update files if metadatacreator is not FLVTool2
94
+ * removed a bug, that occurs when input file was corrupt
95
+
96
+ == Version 0.13
97
+
98
+ * added -n switch, that only makes updates to FLV v1 files (wich have no meta tag yet or are not taged by FLVTool2)
99
+
100
+ == Version 0.12
101
+
102
+ * updated help screen using directories as in-files
103
+
104
+ == Version 0.11
105
+
106
+ * first release version
107
+
108
+
109
+
data/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ FLVTool2 - Copyright (c) 2005 Norman Timmler (inlet media e.K., Hamburg, Germany)
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions
6
+ are met:
7
+ 1. Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ 2. Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+ 3. The name of the author may not be used to endorse or promote products
13
+ derived from this software without specific prior written permission.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README ADDED
@@ -0,0 +1,27 @@
1
+ = FLVTool2 - Flash video manipulation
2
+
3
+ == Download
4
+
5
+ http://www.inlet-media.de/flvtool2
6
+
7
+ == Installation
8
+
9
+ Unix/Linux/BSD etc.:
10
+
11
+ Execute following commands in directory of README file:
12
+
13
+ ruby setup.rb config
14
+ ruby setup.rb setup
15
+ sudo ruby setup.rb install
16
+
17
+ Windows:
18
+ No installation needed.
19
+
20
+ == Bug reports
21
+
22
+ info@inlet-media.de
23
+
24
+ == License
25
+
26
+ See LICENSE file.
27
+
@@ -0,0 +1,76 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/gempackagetask'
4
+ require File.dirname(__FILE__) + '/lib/flvtool2/version.rb'
5
+
6
+ PKG_NAME = 'flvtool2'
7
+ PKG_VERSION = FLVTool2.version
8
+ PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION.downcase.gsub(/\s/, '_')}"
9
+ PKG_DESTINATION = "../#{PKG_NAME}"
10
+ RELEASE_NAME = "REL #{PKG_VERSION}"
11
+ RUBY_FORGE_PROJECT = PKG_NAME
12
+ RUBY_FORGE_USER = 'inlet'
13
+
14
+ PKG_FILES = FileList[
15
+ '[a-zA-Z]*',
16
+ 'bin/**/*',
17
+ 'examples/**/*',
18
+ 'lib/**/*'
19
+ ] - [
20
+ 'test',
21
+ 'flvtool2.exe',
22
+ 'pkg'
23
+ ]
24
+
25
+ task :default => :all_packages
26
+ task :windows => [:make_exe, :zip]
27
+ task :all_packages => [:package, :windows]
28
+ task :release => [:all_packages, :tag_svn, :rubyforge]
29
+
30
+ task :make_exe do
31
+ `exerb flvtool2.exy`
32
+ end
33
+
34
+ task :zip => :make_exe do
35
+ files = %w{ flvtool2.exe LICENSE CHANGELOG README examples examples/tags.xml }
36
+ `zip pkg/#{PKG_FILE_NAME}.zip #{files.join(' ')} -x .svn`
37
+ end
38
+
39
+ task :tag_svn do
40
+ system("svn cp http://svn.inlet-media.de/svn/flvtool2/trunk http://svn.inlet-media.de/svn/flvtool2/tags/#{PKG_FILE_NAME} -m '* Tag release #{PKG_FILE_NAME}'")
41
+ end
42
+
43
+ spec = Gem::Specification.new do |s|
44
+ s.name = PKG_NAME
45
+ s.version = PKG_VERSION
46
+ s.summary = 'Flash video (FLV) manipulation tool'
47
+ s.description = <<-EOF
48
+ FLVTool2 is a manipulation tool for Macromedia Flash Video files (FLV). It can calculate a lot of meta data, insert an onMetaData tag, cut FLV files, add cue points (onCuePoint), show the FLV structure and print meta data information in XML or YAML.
49
+ EOF
50
+
51
+ s.files = PKG_FILES.to_a.delete_if {|f| f.include?('.svn')}
52
+ s.require_path = 'lib'
53
+
54
+ s.bindir = 'bin' # Use these for applications.
55
+ s.executables = ['flvtool2']
56
+ s.default_executable = 'flvtool2'
57
+
58
+ s.author = "Norman Timmler"
59
+ s.email = "norman.timmler@inlet-media.de"
60
+ s.homepage = "http://www.inlet-media.de/flvtool2"
61
+ s.rubyforge_project = "flvtool2"
62
+ end
63
+
64
+ Rake::GemPackageTask.new(spec) do |pkg|
65
+ pkg.gem_spec = spec
66
+ pkg.need_zip = false
67
+ pkg.need_tar = true
68
+ end
69
+
70
+ desc "Publish the release files to RubyForge."
71
+ task :rubyforge => [ :gem ] do
72
+ `rubyforge login`
73
+ system("rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.gem")
74
+ system("rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.tgz")
75
+ system("rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.zip -t i386")
76
+ end
@@ -0,0 +1,3 @@
1
+ #! /usr/bin/env ruby
2
+ require 'flvtool2'
3
+
@@ -0,0 +1,39 @@
1
+ <?xml version="1.0"?>
2
+ <tags>
3
+ <!-- an event cue point -->
4
+ <metatag event="onCuePoint">
5
+ <name>TestEvent1</name>
6
+ <timestamp>333</timestamp>
7
+ <parameters>
8
+ <speaker>Peter</speaker>
9
+ <says>Hello my Name is Peter.</says>
10
+ </parameters>
11
+ <type>event</type>
12
+ </metatag>
13
+
14
+ <!-- a navigation cue point -->
15
+ <metatag event="onCuePoint">
16
+ <name>TestEvent2</name>
17
+ <timestamp>1000</timestamp>
18
+ <parameters>
19
+ <index>1</index>
20
+ <title>Chapter 1</title>
21
+ </parameters>
22
+ <type>navigation</type>
23
+ </metatag>
24
+
25
+ <!-- this cuepoint overwrites the previuos cue point, because of it's
26
+ identical timestamps and the overwrite parameter was set -->
27
+
28
+ <metatag event="onCuePoint" overwrite="true">
29
+ <name>TestEvent3</name>
30
+ <timestamp>1000</timestamp>
31
+ <parameters>
32
+ <index>1</index>
33
+ <title>Chapter 2</title>
34
+ </parameters>
35
+ <type>navigation</type>
36
+ </metatag>
37
+ </tags>
38
+
39
+
@@ -0,0 +1,22 @@
1
+ general:
2
+ startup: flvtool2.rb
3
+ core: cui
4
+ kcode: none
5
+
6
+ path:
7
+ - lib
8
+
9
+ file:
10
+ flvtool2.rb:
11
+ flv.rb:
12
+ flv/amf_string_buffer.rb:
13
+ flv/audio_tag.rb:
14
+ flv/core_extensions.rb:
15
+ flv/meta_tag.rb:
16
+ flv/stream.rb:
17
+ flv/tag.rb:
18
+ flv/video_tag.rb:
19
+ flvtool2/base.rb:
20
+ flvtool2/version.rb:
21
+ mixml.rb:
22
+ miyaml.rb:
@@ -0,0 +1 @@
1
+ require 'flv/stream'
@@ -0,0 +1,280 @@
1
+ # Copyright (c) 2005 Norman Timmler (inlet media e.K., Hamburg, Germany)
2
+ # All rights reserved.
3
+ #
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions
6
+ # are met:
7
+ # 1. Redistributions of source code must retain the above copyright
8
+ # notice, this list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright
10
+ # notice, this list of conditions and the following disclaimer in the
11
+ # documentation and/or other materials provided with the distribution.
12
+ # 3. The name of the author may not be used to endorse or promote products
13
+ # derived from this software without specific prior written permission.
14
+ #
15
+ # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16
+ # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
+ # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
+ # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
+ # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
+ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+
26
+ class AMFStringBuffer
27
+ def initialize(str = nil)
28
+ @buffer = str || ''
29
+ @pos = 0
30
+ end
31
+
32
+ def seek(pos)
33
+ @pos = pos
34
+ end
35
+
36
+ def read(length)
37
+ raise EOFError if @pos + length > @buffer.length
38
+ rt = @buffer[@pos, length]
39
+ @pos += length
40
+ rt
41
+ end
42
+
43
+ def readchar
44
+ read(1).unpack('C').first
45
+ end
46
+
47
+ def write(str)
48
+ if @pos + str.length > @buffer.length
49
+ @buffer << ' ' * (@pos + str.length - @buffer.length)
50
+ end
51
+ @buffer[@pos, str.length] = str
52
+ @pos += str.length
53
+ end
54
+
55
+ def close
56
+ end
57
+
58
+ def to_s
59
+ @buffer
60
+ end
61
+
62
+ def length
63
+ @buffer.length
64
+ end
65
+
66
+ def eof?
67
+ @pos == length
68
+ end
69
+
70
+ def pos
71
+ @pos
72
+ end
73
+
74
+ def read__AMF_string
75
+ read(read__UI16)
76
+ end
77
+
78
+ def read__AMF_double
79
+ num = read(8).unpack('G').first.to_f
80
+ end
81
+
82
+ def read__AMF_boolean
83
+ read__UI8 == 1
84
+ end
85
+
86
+ def read__AMF_mixed_array
87
+ size = read__UI32 # is not used
88
+ hash = {}
89
+ while !eof?
90
+ key = read__AMF_string
91
+ break if key.empty? && (type = read__UI8) == 9
92
+ hash[key] = read__AMF_data(type)
93
+ end
94
+ hash
95
+ end
96
+
97
+ def read__AMF_object
98
+ object = Object.new
99
+ while !eof?
100
+ key = read__AMF_string
101
+ break if key.empty? && (type = read__UI8) == 9
102
+ object.instance_variable_set( eval(":@#{key}"), read__AMF_data(type) )
103
+ end
104
+ object
105
+ end
106
+
107
+ def read__AMF_array
108
+ size = read__UI32
109
+ array = []
110
+ (1..size).step do |pos|
111
+ break if eof?
112
+ array << read__AMF_data
113
+ end
114
+ array
115
+ end
116
+
117
+ def read__AMF_date
118
+ utc_time = Time.at((read__AMF_double / 1000).to_i)
119
+ utc_time + (read__SI16 * 60) - Time.now.gmtoff
120
+ end
121
+
122
+ def read__AMF_data(type = nil)
123
+ type ||= read__UI8
124
+ value = case type.to_i
125
+ when 0
126
+ read__AMF_double
127
+ when 1
128
+ read__AMF_boolean
129
+ when 2
130
+ read__AMF_string
131
+ when 3
132
+ read__AMF_object
133
+ when 8
134
+ read__AMF_mixed_array
135
+ when 10
136
+ read__AMF_array
137
+ when 11
138
+ read__AMF_date
139
+ else
140
+ end
141
+ return value
142
+ end
143
+
144
+ def write__AMF_string(str)
145
+ write__UI8 2
146
+ write__UI16 str.length
147
+ write str
148
+ end
149
+
150
+ def write__AMF_double(value)
151
+ write__UI8 0
152
+ write [value].pack('G')
153
+ end
154
+
155
+ def write__AMF_boolean(value)
156
+ write__UI8 1
157
+ value = value ? 1 : 0
158
+ write [value].pack('C')
159
+ end
160
+
161
+ def write__AMF_date(time)
162
+ write__UI8 11
163
+ write [(time.to_f * 1000.0)].pack('G')
164
+ write__SI16( (Time.now.gmtoff / 60).to_i )
165
+ end
166
+
167
+ def write__AMF_data(object)
168
+ if object === true || object === false
169
+ write__AMF_boolean object
170
+ elsif object.kind_of? Numeric
171
+ write__AMF_double object
172
+ elsif object.kind_of? Time
173
+ write__AMF_date object
174
+ elsif object.kind_of? Hash
175
+ write__AMF_mixed_array object
176
+ elsif object.kind_of? String
177
+ write__AMF_string object
178
+ elsif object.kind_of? Array
179
+ write__AMF_array object
180
+ else
181
+ write__AMF_object object
182
+ end
183
+ end
184
+
185
+ def write__AMF_key(key)
186
+ write__UI16 key.length
187
+ write key
188
+ end
189
+
190
+ def write__AMF_mixed_array(hash)
191
+ write__UI8 8
192
+ write__UI32 hash.length # length will never be read
193
+
194
+ hash.each_pair do |key, value|
195
+ write__AMF_key key
196
+ write__AMF_data value
197
+ end
198
+
199
+ write__UI16 0
200
+ write__UI8 9
201
+ end
202
+
203
+ def write__AMF_array(array)
204
+ write__UI8 10
205
+ write__UI32 array.length
206
+
207
+ array.each do |value|
208
+ write__AMF_data value
209
+ end
210
+ end
211
+
212
+ def write__AMF_object(object)
213
+ write__UI8 3
214
+
215
+ object.instance_variables.each do |variable|
216
+ write__AMF_key variable.gsub('@', '')
217
+ write__AMF_data object.instance_variable_get( variable.intern )
218
+ end
219
+
220
+ write__UI16 0
221
+ write__UI8 9
222
+ end
223
+
224
+ # FIXME: This methods are copied from flv_stream.rb. Should get in here per
225
+ # include? or something like this.
226
+ def read__UI8
227
+ readchar
228
+ end
229
+
230
+ def read__UI16
231
+ (readchar << 8) + readchar
232
+ end
233
+
234
+ def read__UI24
235
+ (readchar << 16) + (readchar << 8) + readchar
236
+ end
237
+
238
+ def read__UI32
239
+ (readchar << 24) + (readchar << 16) + (readchar << 8) + readchar
240
+ end
241
+
242
+ def read__STRING(length)
243
+ read length
244
+ end
245
+
246
+ def read__SI16
247
+ read(2).reverse.unpack('s').first.to_i
248
+ end
249
+
250
+ def write__UI8(value)
251
+ write [value].pack('C')
252
+ end
253
+
254
+ def write__UI16(value)
255
+ write [(value >> 8) & 0xff].pack('c')
256
+ write [value & 0xff].pack('c')
257
+ end
258
+
259
+ def write__UI24(value)
260
+ write [value >> 16].pack('c')
261
+ write [(value >> 8) & 0xff].pack('c')
262
+ write [value & 0xff].pack('c')
263
+ end
264
+
265
+ def write__UI32(value)
266
+ write [value].pack('N')
267
+ end
268
+
269
+ def write__SI16(value)
270
+ write [(value >> 8) & 0xff].pack('c')
271
+ write [value & 0xff].pack('c')
272
+ end
273
+
274
+ def write__STRING(string)
275
+ write string
276
+ end
277
+ alias_method :<<, :write__STRING
278
+
279
+ end
280
+