Adding obvious types to from the result of FFProbe requests on fluent-ffmpeg (#38649)

* adding a ton of obvious fields to the ffprobe information

* adding tests, fixing issues uncovered by linter

* adding tests, fixing issues uncovered by linter

* I undoing some extra whitespace that the hooks are adding for some reason

* adding newline per linter demand
This commit is contained in:
jcapinc 2019-10-03 16:35:28 -04:00 committed by Ryan Cavanaugh
parent e05312e8cb
commit d941503b4d
2 changed files with 87 additions and 2 deletions

View File

@ -97,3 +97,8 @@ ffmpeg.getAvailableFilters((err, filters) => {
console.log("Available filters:");
console.dir(filters);
});
ffmpeg.ffprobe('/path/to/file.mp4', (err, data) => {
console.log(data.format.filename);
console.log(data.streams[0].bit_rate);
});

View File

@ -93,11 +93,91 @@ declare namespace Ffmpeg {
type FormatsCallback = (err: Error, formats: Formats) => void;
interface FfprobeData {
streams: any[];
format: any;
streams: FfprobeStream[];
format: FfprobeFormat;
chapters: any[];
}
interface FfprobeStream {
[key: string]: any;
index: number;
codec_name?: string;
codec_long_name?: string;
profile?: number;
codec_type?: string;
codec_time_base?: string;
codec_tag_string?: string;
codec_tag?: string;
width?: number;
height?: number;
coded_width?: number;
coded_height?: number;
has_b_frames?: number;
sample_aspect_ratio?: string;
display_aspect_ratio?: string;
pix_fmt?: string;
level?: string;
color_range?: string;
color_space?: string;
color_transfer?: string;
color_primaries?: string;
chroma_location?: string;
field_order?: string;
timecode?: string;
refs?: number;
id?: string;
r_frame_rate?: string;
avg_frame_rate?: string;
time_base?: string;
start_pts?: number;
start_time?: number;
duration_ts?: string;
duration?: string;
bit_rate?: string;
max_bit_rate?: string;
bits_per_raw_sample?: string;
nb_frames?: string;
nb_read_frames?: string;
nb_read_packets?: string;
sample_fmt?: string;
sample_rate?: number;
channels?: number;
channel_layout?: string;
bits_per_sample?: number;
disposition?: FfprobeStreamDisposition;
}
interface FfprobeStreamDisposition {
[key: string]: any;
default?: number;
dub?: number;
original?: number;
comment?: number;
lyrics?: number;
karaoke?: number;
forced?: number;
hearing_impaired?: number;
visual_impaired?: number;
clean_effects?: number;
attached_pic?: number;
timed_thumbnails?: number;
}
interface FfprobeFormat {
[key: string]: any;
filename?: string;
nb_streams?: number;
nb_programs?: number;
format_name?: string;
format_long_name?: string;
start_time?: number;
duration?: number;
size?: number;
bit_rate?: number;
probe_score?: number;
tags?: any[];
}
interface ScreenshotsConfig {
count?: number;
folder?: string;