polly-ffmpeg 0.1.9 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ pkg/*
@@ -0,0 +1,4 @@
1
+ ---
2
+ :patch: 1
3
+ :major: 0
4
+ :minor: 2
@@ -0,0 +1,9 @@
1
+ Feature: something something
2
+ In order to something something
3
+ A user something something
4
+ something something something
5
+
6
+ Scenario: something something
7
+ Given inspiration
8
+ When I create a sweet new gem
9
+ Then everyone should see how awesome I am
File without changes
@@ -0,0 +1,11 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
+ require 'ffmpeg'
3
+
4
+ require 'spec/expectations'
5
+
6
+ require 'test/unit/assertions'
7
+
8
+ World do |world|
9
+
10
+ world
11
+ end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ffmpeg}
5
- s.version = "0.1.9"
5
+ s.version = "0.2.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Patrik Hedman"]
9
- s.date = %q{2009-07-03}
9
+ s.date = %q{2009-08-16}
10
10
  s.description = %q{A DSL for building and executing ffmpeg commands}
11
11
  s.email = %q{patrik@moresale.se}
12
12
  s.extra_rdoc_files = [
@@ -14,27 +14,63 @@ Gem::Specification.new do |s|
14
14
  "README.textile"
15
15
  ]
16
16
  s.files = [
17
+ ".gitignore",
17
18
  "LICENSE",
18
19
  "README.textile",
19
20
  "Rakefile",
21
+ "VERSION.yml",
22
+ "features/ffmpeg.feature",
23
+ "features/steps/ffmpeg_steps.rb",
24
+ "features/support/env.rb",
20
25
  "ffmpeg.gemspec",
21
26
  "lib/ffmpeg.rb",
22
27
  "lib/ffmpeg/audio_options.rb",
23
28
  "lib/ffmpeg/class_methods.rb",
24
29
  "lib/ffmpeg/ffmpeg_command.rb",
30
+ "lib/ffmpeg/file_extensions.rb",
25
31
  "lib/ffmpeg/helper_methods.rb",
26
32
  "lib/ffmpeg/main_options.rb",
27
- "lib/ffmpeg/video_options.rb"
33
+ "lib/ffmpeg/video_advanced_options.rb",
34
+ "lib/ffmpeg/video_options.rb",
35
+ "rdoc/classes/FFMpeg.html",
36
+ "rdoc/classes/FFMpeg/AudioOptions.html",
37
+ "rdoc/classes/FFMpeg/ClassMethods.html",
38
+ "rdoc/classes/FFMpeg/HelperMethods.html",
39
+ "rdoc/classes/FFMpeg/MainOptions.html",
40
+ "rdoc/classes/FFMpeg/VideoOptions.html",
41
+ "rdoc/classes/FFMpegCommand.html",
42
+ "rdoc/classes/FileExtensions.html",
43
+ "rdoc/created.rid",
44
+ "rdoc/files/README_textile.html",
45
+ "rdoc/files/lib/ffmpeg/audio_options_rb.html",
46
+ "rdoc/files/lib/ffmpeg/class_methods_rb.html",
47
+ "rdoc/files/lib/ffmpeg/ffmpeg_command_rb.html",
48
+ "rdoc/files/lib/ffmpeg/file_extensions_rb.html",
49
+ "rdoc/files/lib/ffmpeg/helper_methods_rb.html",
50
+ "rdoc/files/lib/ffmpeg/main_options_rb.html",
51
+ "rdoc/files/lib/ffmpeg/video_options_rb.html",
52
+ "rdoc/files/lib/ffmpeg_rb.html",
53
+ "rdoc/fr_class_index.html",
54
+ "rdoc/fr_file_index.html",
55
+ "rdoc/fr_method_index.html",
56
+ "rdoc/index.html",
57
+ "rdoc/rdoc-style.css",
58
+ "spec/audio_options_spec.rb",
59
+ "spec/ffmpeg_spec.rb",
60
+ "spec/spec_helper.rb",
61
+ "spec/video_advanced_options_spec.rb",
62
+ "spec/video_options_spec.rb"
28
63
  ]
29
64
  s.homepage = %q{http://github.com/polly/ffmpeg}
30
65
  s.rdoc_options = ["--charset=UTF-8"]
31
66
  s.require_paths = ["lib"]
32
- s.rubygems_version = %q{1.3.4}
33
- s.summary = %q{Need to write one}
67
+ s.rubygems_version = %q{1.3.3}
68
+ s.summary = %q{TODO}
34
69
  s.test_files = [
35
70
  "spec/audio_options_spec.rb",
36
71
  "spec/ffmpeg_spec.rb",
37
72
  "spec/spec_helper.rb",
73
+ "spec/video_advanced_options_spec.rb",
38
74
  "spec/video_options_spec.rb"
39
75
  ]
40
76
 
@@ -0,0 +1,150 @@
1
+ module FileExtensions
2
+ EXT = [
3
+ "3g2",
4
+ "3gp",
5
+ "4xm",
6
+ "IFF",
7
+ "ISS",
8
+ "MTV",
9
+ "RoQ",
10
+ "aac",
11
+ "ac3",
12
+ "adts",
13
+ "aiff",
14
+ "alaw",
15
+ "amr",
16
+ "apc",
17
+ "ape",
18
+ "asf",
19
+ "asf_stream",
20
+ "ass",
21
+ "au",
22
+ "avi",
23
+ "avm2",
24
+ "avs",
25
+ "bethsoftvid",
26
+ "bfi",
27
+ "c93",
28
+ "cavsvideo",
29
+ "crc",
30
+ "daud",
31
+ "dirac",
32
+ "dnxhd",
33
+ "dsicin",
34
+ "dts",
35
+ "dv",
36
+ "dvd",
37
+ "dxa",
38
+ "ea",
39
+ "ea_cdata",
40
+ "eac3",
41
+ "f32be",
42
+ "f32le",
43
+ "f64be",
44
+ "f64le",
45
+ "ffm",
46
+ "film_cpk",
47
+ "flac",
48
+ "flic",
49
+ "flv",
50
+ "framecrc",
51
+ "gif",
52
+ "gsm",
53
+ "gxf",
54
+ "h261",
55
+ "h263",
56
+ "h264",
57
+ "idcin",
58
+ "image2",
59
+ "image2pipe",
60
+ "ingenient",
61
+ "ipmovie",
62
+ "ipod",
63
+ "lmlm4",
64
+ "m4v",
65
+ "matroska",
66
+ "mjpeg",
67
+ "mlp",
68
+ "mm",
69
+ "mmf",
70
+ "mov",
71
+ "mov",
72
+ "mp4",
73
+ "m4a",
74
+ "3gp",
75
+ "mp2",
76
+ "mp3",
77
+ "mp4",
78
+ "mpc",
79
+ "mpc",
80
+ "mpeg",
81
+ "mpeg1video",
82
+ "mpeg2video",
83
+ "mpegts",
84
+ "mpegtsraw",
85
+ "mpegvideo",
86
+ "mpjpeg",
87
+ "msnwctcp",
88
+ "mulaw",
89
+ "mvi",
90
+ "mxf",
91
+ "mxf_d10",
92
+ "nc",
93
+ "nsv",
94
+ "null",
95
+ "nut",
96
+ "nuv",
97
+ "ogg",
98
+ "oma",
99
+ "psp",
100
+ "psxstr",
101
+ "pva",
102
+ "r3d",
103
+ "rawvideo",
104
+ "rcv",
105
+ "redir",
106
+ "rl2",
107
+ "rm",
108
+ "rpl",
109
+ "rtp",
110
+ "rtsp",
111
+ "s16be",
112
+ "s16le",
113
+ "s24be",
114
+ "s24le",
115
+ "s32be",
116
+ "s32le",
117
+ "s8",
118
+ "sdp",
119
+ "shn",
120
+ "siff",
121
+ "smk",
122
+ "sol",
123
+ "svcd",
124
+ "swf",
125
+ "thp",
126
+ "tiertexseq",
127
+ "tta",
128
+ "txd",
129
+ "u16be",
130
+ "u16le",
131
+ "u24be",
132
+ "u24le",
133
+ "u32be",
134
+ "u32le",
135
+ "u8",
136
+ "vc1",
137
+ "vc1test",
138
+ "vcd",
139
+ "vmd",
140
+ "vob",
141
+ "voc",
142
+ "wav",
143
+ "wc3movie",
144
+ "wsaud",
145
+ "wsvqa",
146
+ "wv",
147
+ "xa",
148
+ "yuv4mpegpipe"
149
+ ]
150
+ end
@@ -0,0 +1,275 @@
1
+ module FFMpeg
2
+ module VideoAdvancedOptions
3
+ # Set pixel format. Use 'list' as parameter to show all the supported pixel formats.
4
+ def pixel_format(format)
5
+ FFMpegCommand << "-pix_fmt #{format}"
6
+ end
7
+
8
+ # Set SwScaler flags (only available when compiled with swscale support).
9
+ def swscaler_flags(flags)
10
+ FFMpegCommand << "-sws_flags #{flags}"
11
+ end
12
+
13
+ # Set the group of pictures size.
14
+ def group_of_pictures_size(size)
15
+ FFMpegCommand << "-g #{size}"
16
+ end
17
+
18
+ # Use only intra frames.
19
+ def use_only_intra_frames
20
+ FFMpegCommand << "-intra"
21
+ end
22
+
23
+ # Discard threshold.
24
+ def video_discard_threshold(number)
25
+ FFMpegCommand << "-vdt #{number}"
26
+ end
27
+
28
+ # Use fixed video quantizer scale (VBR).
29
+ def video_quantizer_scale(scale)
30
+ FFMpegCommand << "-qscale #{scale}"
31
+ end
32
+
33
+ # Use minimum video quantizer scale (VBR)
34
+ def video_minimum_quantizer_scale(scale)
35
+ FFMpegCommand << "-qmin #{scale}"
36
+ end
37
+
38
+ # Use maximum video quantizer scale (VBR)
39
+ def video_maximum_quantizer_scale(scale)
40
+ FFMpegCommand << "-qmax #{scale}"
41
+ end
42
+
43
+ # Use maximum difference between the quantizer scales (VBR)
44
+ def video_maximum_quantizer_difference(diff)
45
+ FFMpegCommand << "-qdiff #{diff}"
46
+ end
47
+
48
+ # Use video quantizer scale blur (VBR) (range 0.0 - 1.0)
49
+ def video_quantizer_scale_blur(blur)
50
+ FFMpegCommand << "-qblur #{blur}"
51
+ end
52
+
53
+ # Use video quantizer scale compression (VBR) (default 0.5). Constant of ratecontrol equation. Recommended range
54
+ # for default rc_eq: 0.0-1.0
55
+ def video_quantizer_scale_compression(compression)
56
+ FFMpegCommand << "-qcomp #{compression}"
57
+ end
58
+
59
+ # Use minimum video lagrange factor (VBR)
60
+ #
61
+ # This option uses 'lambda' units, but you may use the QP2LAMBDA constant to easily convert from 'q' units:
62
+ # ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
63
+ def video_minimum_lagrange_factor(lambda)
64
+ FFMpegCommand << "-lmin #{lambda}"
65
+ end
66
+
67
+ # Use max video lagrange factor (VBR)
68
+ #
69
+ # This option uses 'lambda' units, but you may use the QP2LAMBDA constant to easily convert from 'q' units:
70
+ # ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
71
+ def video_maximum_lagrange_factor(lambda)
72
+ FFMpegCommand << "-lmax #{lambda}"
73
+ end
74
+
75
+ # Use minimum macroblock quantizer scale (VBR)
76
+ #
77
+ # This option uses 'lambda' units, but you may use the QP2LAMBDA constant to easily convert from 'q' units:
78
+ # ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
79
+ def video_minimum_macroblock_scale(lambda)
80
+ FFMpegCommand << "-mblmin #{lambda}"
81
+ end
82
+
83
+ # Use maximum macroblock quantizer scale (VBR).
84
+ #
85
+ # This option uses 'lambda' units, but you may use the QP2LAMBDA constant to easily convert from 'q' units:
86
+ # ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
87
+ def video_maximum_macroblock_scale(lambda)
88
+ FFMpegCommand << "-mblmax #{lambda}"
89
+ end
90
+
91
+ # Use initial complexity for single pass encoding
92
+ def initial_complexity(complexity)
93
+ FFMpegCommand << "-rc_init_cplx #{complexity}"
94
+ end
95
+
96
+ # Use qp factor between P- and B-frames
97
+ def b_frame_factor(factor)
98
+ FFMpegCommand << "-b_qfactor #{factor}"
99
+ end
100
+
101
+ # Use qp factor between P- and I-frames
102
+ def i_frame_factor(factor)
103
+ FFMpegCommand << "-i_qfactor #{factor}"
104
+ end
105
+
106
+ # Use qp offset between P- and B-frames
107
+ def b_frame_offset(offset)
108
+ FFMpegCommand << "-b_qoffset #{offset}"
109
+ end
110
+
111
+ # Use qp offset between P- and I-frames
112
+ def i_frame_offset(offset)
113
+ FFMpegCommand << "-i_qoffset #{offset}"
114
+ end
115
+
116
+ # Set rate control equation (see section 3.11 FFmpeg formula evaluator) (default = tex^qComp).
117
+ def rate_control_equation(equation)
118
+ FFMpegCommand << "-rc_eq string"
119
+ end
120
+
121
+ # Set rate control override for specific intervals
122
+ def rate_control_override(override)
123
+ FFMpegCommand << "-rc_override #{override}"
124
+ end
125
+
126
+ # Set motion estimation method to method. Available methods are (from lowest to best quality):
127
+ #
128
+ # `zero' - Try just the (0, 0) vector.
129
+ # `phods'
130
+ # `log'
131
+ # `x1'
132
+ # `hex'
133
+ # `umh'
134
+ # `epzs' - (default method)
135
+ # `full' - exhaustive search (slow and marginally better than epzs)
136
+ def motion_estimation_method(method)
137
+ FFMpegCommand << "-me_method #{method}"
138
+ end
139
+
140
+ # Set DCT algorithm to algo. Available values are:
141
+ #
142
+ # `0' FF_DCT_AUTO (default)
143
+ # `1' FF_DCT_FASTINT
144
+ # `2' FF_DCT_INT
145
+ # `3' FF_DCT_MMX
146
+ # `4' FF_DCT_MLIB
147
+ # `5' FF_DCT_ALTIVEC
148
+ def dct_algorithm(algorithm)
149
+ FFMpegCommand << "-dct_algo #{algorithm}"
150
+ end
151
+
152
+ # Set IDCT algorithm to algo. Available values are:
153
+ #
154
+ # `0' FF_IDCT_AUTO (default)
155
+ # `1' FF_IDCT_INT
156
+ # `2' FF_IDCT_SIMPLE
157
+ # `3' FF_IDCT_SIMPLEMMX
158
+ # `4' FF_IDCT_LIBMPEG2MMX
159
+ # `5' FF_IDCT_PS2
160
+ # `6' FF_IDCT_MLIB
161
+ # `7' FF_IDCT_ARM
162
+ # `8' FF_IDCT_ALTIVEC
163
+ # `9' FF_IDCT_SH4
164
+ # `10' FF_IDCT_SIMPLEARM
165
+ def idct_algorithm(algorithm)
166
+ FFMpegCommand << "-idct_algo #{algorithm}"
167
+ end
168
+
169
+ # Set error resilience to n.
170
+ #
171
+ # `1' FF_ER_CAREFUL (default)
172
+ # `2' FF_ER_COMPLIANT
173
+ # `3' FF_ER_AGGRESSIVE
174
+ # `4' FF_ER_VERY_AGGRESSIVE
175
+ def error_resilience(number)
176
+ FFMpegCommand << "-er #{number}"
177
+ end
178
+
179
+ # Set error concealment to bit_mask. bit_mask is a bit mask of the following values:
180
+ #
181
+ # `1' FF_EC_GUESS_MVS (default = enabled)
182
+ # `2' FF_EC_DEBLOCK (default = enabled)
183
+ def error_concealment(mask)
184
+ FFMpegCommand << "-ec #{mask}"
185
+ end
186
+
187
+ # Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
188
+ def b_frames(frames)
189
+ FFMpegCommand << "-bf #{frames}"
190
+ end
191
+
192
+ # Macroblock decision mode
193
+ #
194
+ # `0' FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in FFmpeg).
195
+ # `1' FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
196
+ # `2' FF_MB_DECISION_RD: rate distortion
197
+ def macroblock_decision_mode(mode)
198
+ FFMpegCommand << "-mbd #{mode}"
199
+ end
200
+
201
+ # Use four motion vector by macroblock (MPEG-4 only).
202
+ def use_four_motion_vector
203
+ FFMpegCommand << "-4mv"
204
+ end
205
+
206
+ # Use data partitioning (MPEG-4 only).
207
+ def use_data_partitioning
208
+ FFMpegCommand << "-part"
209
+ end
210
+
211
+ # `-bug param'
212
+ # Work around encoder bugs that are not auto-detected.
213
+
214
+ # How strictly to follow the standards.
215
+ def strictness(strictness)
216
+ FFMpegCommand << "-strict #{strictness}"
217
+ end
218
+
219
+ # Enable Advanced intra coding (h263+).
220
+ def enable_advanced_intra_coding
221
+ FFMpegCommand << "-aic"
222
+ end
223
+
224
+ # Enable Unlimited Motion Vector (h263+)
225
+ def enable_unlimited_motion_vector
226
+ FFMpegCommand << "-umv"
227
+ end
228
+
229
+ # Deinterlace pictures.
230
+ def deinterlace
231
+ FFMpegCommand << "-deinterlace"
232
+ end
233
+
234
+ # Force interlacing support in encoder (MPEG-2 and MPEG-4 only). Use this option if your input file is interlaced
235
+ # and you want to keep the interlaced format for minimum losses. The alternative is to deinterlace the input stream
236
+ # with `-deinterlace', but deinterlacing introduces losses.
237
+ def interlacing_support
238
+ FFMpegCommand << "-ilme"
239
+ end
240
+
241
+ # Calculate PSNR of compressed frames.
242
+ def calculate_psnr
243
+ FFMpegCommand << "-psnr"
244
+ end
245
+
246
+ # Dump video coding statistics to `vstats_HHMMSS.log' or the supplied file.
247
+ def dump_video_statistics(file = nil)
248
+ unless file.nil?
249
+ FFMpegCommand << "-vstats_file #{file}"
250
+ else
251
+ FFMpegCommand << "-vstats"
252
+ end
253
+ end
254
+
255
+ # `-top n'
256
+ # top=1/bottom=0/auto=-1 field first
257
+
258
+ # `-dc precision'
259
+ # Intra_dc_precision.
260
+
261
+ # `-vtag fourcc/tag'
262
+ # Force video tag/fourcc.
263
+
264
+ # Show QP histogram.
265
+ def show_qp_histogram
266
+ FFMpegCommand << "-qphist"
267
+ end
268
+
269
+ # Bitstream filters available are "dump_extra", "remove_extra", "noise", "h264_mp4toannexb", "imxdump" and
270
+ # "mjpegadump".
271
+ def video_bitstream_filter(filter)
272
+ FFMpegCommand << "-vbsf #{filter}"
273
+ end
274
+ end
275
+ end