[fluent-ffmpeg] add more complexFilter parameters (#36239)

* modify compledFilter parameter based on document

* add test about complexFilter

* add _getArguments() definition
This commit is contained in:
하도영 2019-06-20 01:57:58 +09:00 committed by Daniel Rosenwasser
parent e7b5b2048a
commit 576ade641e
2 changed files with 25 additions and 4 deletions

View File

@ -23,6 +23,25 @@ ffmpeg('/path/to/file.avi')
.preset('divx')
.size('640x480');
// get arguments
ffmpeg('/path/to/file.avi')
._getArguments();
// ComplexFilter
ffmpeg('/path/to/file.avi')
.output('outputfile.mp4')
.complexFilter([
{ inputs: '0:v', filter: 'scale', options: { w: 1920, h: 1080, interl: 1 }, outputs: [] },
{ inputs: '0:a', filter: 'amerge', options: { inputs: 2 }, outputs: 'am'},
'[am]aresample=48000:async=1[are]',
{ inputs: 'are', filter: 'channelsplit' , options: { channel_layout: 'stereo'}, outputs: [] }
], [])
.audioCodec('libfaac')
.videoCodec('libx264')
.size('320x200');
// Use the run() method to run commands with multiple outputs
ffmpeg('/path/to/file.avi')
.output('outputfile.mp4')

View File

@ -3,6 +3,7 @@
// Definitions by: KIM Jaesuck a.k.a. gim tcaesvk <https://github.com/tcaesvk>
// DingWeizhe <https://github.com/DingWeizhe>
// Mounir Abid <https://github.com/mabidina>
// Doyoung Ha <https://github.com/hados99>
// Definitions: https://github.com/DefinitelyType/DefinitelyTyped
/// <reference types="node" />
@ -31,8 +32,8 @@ declare namespace Ffmpeg {
interface FilterSpecification {
filter: string;
inputs: string | string[];
outputs: string | string[];
inputs?: string | string[];
outputs?: string | string[];
options?: any | string | any[];
}
@ -271,8 +272,8 @@ declare namespace Ffmpeg {
outputOption(...options: string[]): FfmpegCommand;
outputOptions(options: string[]): FfmpegCommand;
outputOptions(...options: string[]): FfmpegCommand;
filterGraph(spec: string | FilterSpecification[], map: string[]): FfmpegCommand;
complexFilter(spec: string | FilterSpecification[], map: string[]): FfmpegCommand;
filterGraph(spec: string | FilterSpecification | Array<string | FilterSpecification>, map: string[]): FfmpegCommand;
complexFilter(spec: string | FilterSpecification | Array<string | FilterSpecification>, map: string[]): FfmpegCommand;
// options/misc
usingPreset(proset: string | GetPreset): FfmpegCommand;
@ -281,6 +282,7 @@ declare namespace Ffmpeg {
// processor
renice(niceness: number): FfmpegCommand;
kill(signal: string): FfmpegCommand;
_getArguments(): string[];
// capabilities
setFfmpegPath(path: string): FfmpegCommand;