ffmpeg 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/LICENSE +20 -0
- data/README.textile +45 -0
- data/Rakefile +45 -0
- data/VERSION.yml +5 -0
- data/features/ffmpeg.feature +9 -0
- data/features/steps/ffmpeg_steps.rb +0 -0
- data/features/support/env.rb +11 -0
- data/ffmpeg.gemspec +86 -0
- data/lib/ffmpeg.rb +121 -0
- data/lib/ffmpeg/audio_options.rb +47 -0
- data/lib/ffmpeg/class_methods.rb +18 -0
- data/lib/ffmpeg/ffmpeg_command.rb +25 -0
- data/lib/ffmpeg/file_extensions.rb +150 -0
- data/lib/ffmpeg/helper_methods.rb +8 -0
- data/lib/ffmpeg/main_options.rb +165 -0
- data/lib/ffmpeg/meta_data.rb +22 -0
- data/lib/ffmpeg/video_advanced_options.rb +275 -0
- data/lib/ffmpeg/video_options.rb +197 -0
- data/rdoc/classes/FFMpeg.html +250 -0
- data/rdoc/classes/FFMpeg.src/M000005.html +27 -0
- data/rdoc/classes/FFMpeg.src/M000006.html +29 -0
- data/rdoc/classes/FFMpeg.src/M000007.html +18 -0
- data/rdoc/classes/FFMpeg.src/M000008.html +24 -0
- data/rdoc/classes/FFMpeg/AudioOptions.html +269 -0
- data/rdoc/classes/FFMpeg/AudioOptions.src/M000093.html +18 -0
- data/rdoc/classes/FFMpeg/AudioOptions.src/M000094.html +18 -0
- data/rdoc/classes/FFMpeg/AudioOptions.src/M000095.html +18 -0
- data/rdoc/classes/FFMpeg/AudioOptions.src/M000096.html +18 -0
- data/rdoc/classes/FFMpeg/AudioOptions.src/M000097.html +18 -0
- data/rdoc/classes/FFMpeg/AudioOptions.src/M000098.html +18 -0
- data/rdoc/classes/FFMpeg/AudioOptions.src/M000099.html +18 -0
- data/rdoc/classes/FFMpeg/AudioOptions.src/M000100.html +18 -0
- data/rdoc/classes/FFMpeg/ClassMethods.html +131 -0
- data/rdoc/classes/FFMpeg/ClassMethods.src/M000049.html +18 -0
- data/rdoc/classes/FFMpeg/HelperMethods.html +131 -0
- data/rdoc/classes/FFMpeg/HelperMethods.src/M000074.html +19 -0
- data/rdoc/classes/FFMpeg/MainOptions.html +494 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000075.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000076.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000077.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000078.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000079.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000080.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000081.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000082.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000083.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000084.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000085.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000086.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000087.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000088.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000089.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000090.html +18 -0
- data/rdoc/classes/FFMpeg/MainOptions.src/M000091.html +18 -0
- data/rdoc/classes/FFMpeg/MetaData.html +151 -0
- data/rdoc/classes/FFMpeg/MetaData.src/M000092.html +24 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.html +924 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000009.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000010.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000011.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000012.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000013.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000014.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000015.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000016.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000017.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000018.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000019.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000020.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000021.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000022.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000023.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000024.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000025.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000026.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000027.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000028.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000029.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000030.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000031.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000032.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000033.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000034.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000035.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000036.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000037.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000038.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000039.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000040.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000041.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000042.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000043.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000044.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000045.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000046.html +22 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000047.html +18 -0
- data/rdoc/classes/FFMpeg/VideoAdvancedOptions.src/M000048.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.html +630 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000050.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000051.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000052.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000053.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000054.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000055.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000056.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000057.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000058.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000059.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000060.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000061.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000062.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000063.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000064.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000065.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000066.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000067.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000068.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000069.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000070.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000071.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000072.html +18 -0
- data/rdoc/classes/FFMpeg/VideoOptions.src/M000073.html +18 -0
- data/rdoc/classes/FFMpegCommand.html +176 -0
- data/rdoc/classes/FFMpegCommand.src/M000001.html +18 -0
- data/rdoc/classes/FFMpegCommand.src/M000002.html +18 -0
- data/rdoc/classes/FFMpegCommand.src/M000003.html +18 -0
- data/rdoc/classes/FFMpegCommand.src/M000004.html +22 -0
- data/rdoc/classes/FileExtensions.html +118 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/README_textile.html +171 -0
- data/rdoc/files/lib/ffmpeg/audio_options_rb.html +101 -0
- data/rdoc/files/lib/ffmpeg/class_methods_rb.html +101 -0
- data/rdoc/files/lib/ffmpeg/ffmpeg_command_rb.html +101 -0
- data/rdoc/files/lib/ffmpeg/file_extensions_rb.html +101 -0
- data/rdoc/files/lib/ffmpeg/helper_methods_rb.html +101 -0
- data/rdoc/files/lib/ffmpeg/main_options_rb.html +101 -0
- data/rdoc/files/lib/ffmpeg/meta_data_rb.html +101 -0
- data/rdoc/files/lib/ffmpeg/video_advanced_options_rb.html +101 -0
- data/rdoc/files/lib/ffmpeg/video_options_rb.html +101 -0
- data/rdoc/files/lib/ffmpeg_rb.html +116 -0
- data/rdoc/fr_class_index.html +36 -0
- data/rdoc/fr_file_index.html +36 -0
- data/rdoc/fr_method_index.html +126 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- data/spec/audio_options_spec.rb +72 -0
- data/spec/ffmpeg_spec.rb +161 -0
- data/spec/files/terminal.mpg +0 -0
- data/spec/meta_spec.rb +15 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/video_advanced_options_spec.rb +349 -0
- data/spec/video_options_spec.rb +200 -0
- metadata +213 -0
@@ -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,165 @@
|
|
1
|
+
module FFMpeg
|
2
|
+
module MainOptions
|
3
|
+
|
4
|
+
def source(*filename)
|
5
|
+
FFMpegCommand << "-i #{filename}"
|
6
|
+
end
|
7
|
+
|
8
|
+
def target(target)
|
9
|
+
FFMpegCommand << "#{target}"
|
10
|
+
end
|
11
|
+
|
12
|
+
#
|
13
|
+
# Overwrite output file if it already exists
|
14
|
+
#
|
15
|
+
def overwrite_existing_file
|
16
|
+
FFMpegCommand.add_at("-y", 0)
|
17
|
+
end
|
18
|
+
|
19
|
+
#
|
20
|
+
# Set the duration specified in seconds.
|
21
|
+
# hh:mm:ss[.xxx] syntax is also supported
|
22
|
+
#
|
23
|
+
# duration "600"
|
24
|
+
#
|
25
|
+
# or
|
26
|
+
#
|
27
|
+
# duration "00:10:00"
|
28
|
+
#
|
29
|
+
def duration(duration)
|
30
|
+
FFMpegCommand << "-t #{duration}"
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# Set a file size limit in bytes
|
35
|
+
#
|
36
|
+
# file_size_limit 104_857_600
|
37
|
+
#
|
38
|
+
def file_size_limit(limit)
|
39
|
+
FFMpegCommand << "-fs #{limit.to_s}"
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
# Seek to given time position in seconds.
|
44
|
+
# hh:mm:ss[.xxx] syntax is also supported.
|
45
|
+
#
|
46
|
+
# seek "600"
|
47
|
+
#
|
48
|
+
# or
|
49
|
+
#
|
50
|
+
# seek "00:10:00"
|
51
|
+
#
|
52
|
+
def seek(position)
|
53
|
+
FFMpegCommand << "-ss #{position}"
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# Set the input time offset in seconds.
|
58
|
+
# [-]hh:mm:ss[.xxx] syntax is also supported.
|
59
|
+
# This option affects all the input files that follow it.
|
60
|
+
# The offset is added to the timestamps of the input files.
|
61
|
+
# Specifying a positive offset means that the corresponding
|
62
|
+
# streams are delayed by 'offset' seconds.
|
63
|
+
#
|
64
|
+
# offset "600"
|
65
|
+
#
|
66
|
+
# or
|
67
|
+
#
|
68
|
+
# offset "00:10:00"
|
69
|
+
#
|
70
|
+
def offset(offset)
|
71
|
+
FFMpegCommand << "-itsoffset #{offset}"
|
72
|
+
end
|
73
|
+
|
74
|
+
#
|
75
|
+
# Set the title.
|
76
|
+
#
|
77
|
+
# title "Some Title"
|
78
|
+
#
|
79
|
+
def title(title)
|
80
|
+
FFMpegCommand << "-title '#{title}'"
|
81
|
+
end
|
82
|
+
|
83
|
+
#
|
84
|
+
# Set the author.
|
85
|
+
#
|
86
|
+
# author "PMH"
|
87
|
+
#
|
88
|
+
def author(author)
|
89
|
+
FFMpegCommand << "-author '#{author}'"
|
90
|
+
end
|
91
|
+
|
92
|
+
#
|
93
|
+
# Set the copyright.
|
94
|
+
#
|
95
|
+
# copyright "(c) Patrik Hedman 2009"
|
96
|
+
#
|
97
|
+
def copyright(copyright)
|
98
|
+
FFMpegCommand << "-copyright '#{copyright}'"
|
99
|
+
end
|
100
|
+
|
101
|
+
#
|
102
|
+
# Set the comment.
|
103
|
+
#
|
104
|
+
# comment "Some comment"
|
105
|
+
#
|
106
|
+
def comment(comment)
|
107
|
+
FFMpegCommand << "-comment '#{comment}'"
|
108
|
+
end
|
109
|
+
|
110
|
+
#
|
111
|
+
# Set the album.
|
112
|
+
#
|
113
|
+
# album "An awesome album"
|
114
|
+
#
|
115
|
+
def album(album)
|
116
|
+
FFMpegCommand << "-album '#{album}'"
|
117
|
+
end
|
118
|
+
|
119
|
+
#
|
120
|
+
# Set the track number:
|
121
|
+
#
|
122
|
+
# track 1
|
123
|
+
#
|
124
|
+
def track(track)
|
125
|
+
FFMpegCommand << "-track #{track}"
|
126
|
+
end
|
127
|
+
|
128
|
+
#
|
129
|
+
# Set the year.
|
130
|
+
#
|
131
|
+
# year 1985
|
132
|
+
#
|
133
|
+
def year(year)
|
134
|
+
FFMpegCommand << "-year #{year}"
|
135
|
+
end
|
136
|
+
|
137
|
+
#
|
138
|
+
# Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd", "ntsc-svcd", ... ).
|
139
|
+
# All the format options (bitrate, codecs, buffer sizes) are then set automatically.
|
140
|
+
# Nevertheless you can specify additional options as long as you know they do not conflict
|
141
|
+
# with the standard.
|
142
|
+
#
|
143
|
+
# target "vcd"
|
144
|
+
#
|
145
|
+
def target(target)
|
146
|
+
FFMpegCommand << "-target #{target}"
|
147
|
+
end
|
148
|
+
|
149
|
+
#
|
150
|
+
# Set the number of frames to record.
|
151
|
+
#
|
152
|
+
# frames_to_record 50
|
153
|
+
#
|
154
|
+
def frames_to_record(frames)
|
155
|
+
FFMpegCommand << "-dframes #{frames}"
|
156
|
+
end
|
157
|
+
|
158
|
+
#
|
159
|
+
# Force subtitle codec ('copy' to copy stream)
|
160
|
+
#
|
161
|
+
def subtitle_codec(codec)
|
162
|
+
FFMpegCommand << "-scodec #{codec}"
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module FFMpeg
|
2
|
+
module MetaData
|
3
|
+
EXIF_UTILITY = 'exiftool'
|
4
|
+
|
5
|
+
#
|
6
|
+
# Retrieves meta data from the file using exiftool, and returned in a hash
|
7
|
+
# allowing for complex conversion rules.
|
8
|
+
#
|
9
|
+
# video_bitrate "300k" if meta[:video_bitrate].to_f > 300
|
10
|
+
#
|
11
|
+
def meta
|
12
|
+
if `which #{EXIF_UTILITY}`.empty?
|
13
|
+
{}
|
14
|
+
else
|
15
|
+
@meta_data ||= `#{EXIF_UTILITY} #{@from_file}`.split("\n").inject({}) {|hash, element|
|
16
|
+
hash.merge(((split = element.split(':')) && split.first.strip.downcase.gsub(/[^a-zA-Z0-9]/, "_").to_sym) => (split.shift && split).join(':').strip)
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
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
|