-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFFMpeg.hx
More file actions
193 lines (144 loc) · 5.01 KB
/
Copy pathFFMpeg.hx
File metadata and controls
193 lines (144 loc) · 5.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
package js.npm;
import js.node.stream.Writable;
extern class FFMpeg implements npm.Package.Require<"fluent-ffmpeg","*"> {
inline static public function getMetadata( file:String, cb:Metadata->String->Void ):Void {
Type.createInstance( FFMpeg.Metadata, [ file, cb ] );
}
static var Metadata:Class<MetaLib>;
public function new( params:ConstructorParams ) {}
public function withNoVideo():FFMpeg;
public function withNoAudio():FFMpeg;
public function updateFlvMetadata():FFMpeg;
/** eg '4:3' **/
public function withAspect( aspect:String ):FFMpeg;
public function keepPixelAspect( bool:Bool ):FFMpeg;
public function loop( duration:String ):FFMpeg;
public function takeFrames( frameCount:Int ):FFMpeg;
/** eg '640x480' **/
public function withSize( size:String ):FFMpeg;
/** eg true, 'white' **/
public function applyAutoPadding( apply:Bool, color:String ):FFMpeg;
/** eg 'podcast' **/
public function usingPreset( preset:String ):FFMpeg;
/** eg 1024 **/
public function withVideoBitrate( bitrate:Int ):FFMpeg;
/** eg 'divx' **/
public function withVideoCodec( preset:String ):FFMpeg;
/** eg 24 **/
public function withFps( fps:Int ):FFMpeg;
/** eg 24 **/
public function withFpsInput( fps:Int ):FFMpeg;
/** eg 24 **/
public function withFpsOutput( fps:Int ):FFMpeg;
/** eg '128k' **/
public function withAudioBitrate( bitrate:String ):FFMpeg;
/** eg 'libmp3lame' **/
public function withAudioCodec( codec:String ):FFMpeg;
/** eg 2 **/
public function withAudioChannels( channels:Int ):FFMpeg;
public function withAudioQuality( quality:Int ):FFMpeg; // maybe should be string?
public function setStartTime( timestamp:String ):FFMpeg;
public function setDuration( duration:String ):FFMpeg;
public function withAudioFrequency( frequency:String ):FFMpeg;
/** eg '-vtag', 'DIVX' **/
public function addOption( name:String, value:String ):FFMpeg;
/** eg ['-vtag DIVX', '-debug'] **/
public function addOptions( options:Array<String> ):FFMpeg;
/** eg 'myfile.mp3' **/
public function addInput( filename:String ):FFMpeg;
/** eg 'myfile.mp3' **/
public function mergeAdd( filename:String ):FFMpeg;
/** Return callback contains stdout as first argument, stderr as second **/
public function mergeToFile( path:String, cb:Void->Void ):FFMpeg;
/** eg 'avi' **/
public function fromFormat( format:String ):FFMpeg;
/** eg 'avi' **/
public function toFormat( format:String ):FFMpeg;
/** -20 (high priority) to 19 (low priority). Default is 0 **/
public function renice( priority:Int ):FFMpeg;
public function onCodecData( cb:CodecData->Void ):FFMpeg;
/** See `ProgressUpdate` for details. Will post as often as FFMPEG gives output **/
public function onProgress( cb:ProgressUpdate->Void ):FFMpeg;
/**
First format: number of thumbnails, spread evenly, saved to folder, with callback.
Second format: config object defining specific points, saved to folder, with callback
Callback is function(error:String, filenames:Array<String>):Void
See https://github.com/schaermu/node-fluent-ffmpeg#creating-thumbnails-from-a-video-file
**/
@:overload( function( options:TakeScreenshotParams, pathToThumbnailFolder:String, cb:String->Array<String>->Void ):FFMpeg {} )
public function takeScreenshots( number:Int, pathToThumbnailFolder:String, cb:String->Array<String>->Void ):FFMpeg;
/** Return callback contains stdout as first argument, stderr as second **/
public function saveToFile( path:String, tmpFolder:String, cb:Void->Void ):FFMpeg;
}
typedef ConstructorParams = {
/** input source, required **/
source:String,
/** timout of the spawned ffmpeg sub-processes in seconds **/
?timeout:Int,
/** default priority for all ffmpeg sub-processes (optional, defaults to 0 which is no priorization) **/
?priority:Int,
/** set a custom [winston](https://github.com/flatiron/winston) logging instance (optional, default null which will cause fluent-ffmpeg to spawn a winston console logger) **/
?logger:Null<Dynamic>,
/** completely disable logging (optional, defaults to false) **/
?nolog:Bool,
}
typedef TakeScreenshotParams = {
count:Int,
timemarks: Array<String>,
?filename:String
}
typedef ProgressUpdate = {
frames:Int,
currentFps:Int,
currentKbps:Int,
targetSize:Int,
timemark:String
}
/** Not implemented yet **/
typedef CodecData = {
}
extern class MetaLib {
/**
@param file: path to file
@param cb: Callback function(meta:Metadata, error:String):Void
**/
function new( file:String, cb:Metadata->String->Void );
}
/** Not implemented yet **/
typedef Metadata = {
album:String,
artist:String,
audio: {
bitrate:Int,
channels:Int,
codec:String,
sample_rate:Int,
stream:Float
},
date:String,
durationraw:String,
durationsec:Int,
ffmpegversion:String,
major_brand:Null<String>,
synched:Bool,
title:String,
track:String,
video: {
aspect:Float,
aspectString:String,
bitrate:Int,
codec:String,
container:String,
fps:Int,
pixel:Float,
pixelString:String,
resolution: {
w:Int,
h:Int
},
resolutionSquare: {
w:Int,
h:Int
}
}
}