// Type definitions for fluent-ffmpeg 2.0.1 // Project: https://www.npmjs.com/package/fluent-ffmpeg // Definitions by: Zorbing /* =================== USAGE =================== import * as ffmpeg from "fluent-ffmpeg"; =============================================== */ /// declare module Ffprobe { interface TagData { [key: string]: string; } interface DispositionData { // possible values: 0, 1 default: number; // possible values: 0 dub: number; // possible values: 0 original: number; // possible values: 0 comment: number; // possible values: 0 lyrics: number; // possible values: 0 karaoke: number; // possible values: 0, 1 forced: number; // possible values: 0 hearing_impaired: number; // possible values: 0 visual_impaired: number; // possible values: 0 clean_effects: number; // possible values: 0 attached_pic: number; } interface StreamData { // possible values: 0, 1, 2, 3, 4 index: number; // possible values: "mpeg4", "ac3", "h264", "aac", "mp3", "fraps", "pcm_s16le", "srt", "rawvideo", "pcm_s32le", "pcm_alaw", "wmav2", "wmv2", "flac", "vp8", "vorbis", "pgssub" codec_name: string; // possible values: "MPEG-4 part 2", "ATSC A/52A (AC-3)", "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10", "AAC (Advanced Audio Coding)", "MP3 (MPEG audio layer 3)", "Fraps", "PCM signed 16-bit little-endian", "SubRip subtitle", "raw video", "PCM signed 32-bit little-endian", "PCM A-law / G.711 A-law", "Windows Media Audio 2", "Windows Media Video 8", "FLAC (Free Lossless Audio Codec)", "On2 VP8", "Vorbis", "HDMV Presentation Graphic Stream subtitles" codec_long_name: string; // possible values: "Simple Profile", "unknown", "Constrained Baseline", "LC", "Advanced Simple Profile", "Main", "High", "Baseline", "High 10" profile: string; // possible values: "video", "audio", "subtitle" codec_type: string; // possible values: "1/25", "1/48000", "1/60", "1/44100", "1/30", "1/192000", "1/50", "1001/48000", "1/1000", "1/50000", "50/2997", "500/29917", "1/48", "1001/60000", "1001/120000", "1/24", "1001/30000", "1/60000", "1/30000", "1/15", "1/59922", "1/32000", "1/90000", "1/180000", "1/16000" codec_time_base: string; // possible values: "XVID", "[0] [0][0]", "avc1", "mp4a", "U[0][0][0]", "FPS1", "[1][0][0][0]", "[0][0][0][0]", "IYUV", "UYVY", "[6][0][0][0]", "DIVX", "DX50", "AVC1", "a[1][0][0]", "WMV2", "sowt", "HDMV", "AC-3", "[144][0][0][0]" codec_tag_string: string; // possible values: "0x44495658", "0x2000", "0x31637661", "0x6134706d", "0x0055", "0x31535046", "0x0001", "0x0000", "0x56555949", "0x59565955", "0x0006", "0x58564944", "0x30355844", "0x31435641", "0x0161", "0x32564d57", "0x74776f73", "0x564d4448", "0x332d4341", "0x0090" codec_tag: string; // possible values: "N/A", "0x1011", "0x1100", "0x1200" id: string; // possible values: "25/1", "0/0", "30/1", "30000/1001", "359/12", "24/1", "60000/1001", "24000/1001", "15/1", "29961/1000", "29917/1000", "2997/100", "21/1" r_frame_rate: string; // possible values: "25/1", "0/0", "3620000/120667", "30/1", "30000/1001", "3505000/116841", "474500/15833", "24/1", "60000/1001", "197386875/3293071", "102195000/1704953", "73386000/1224323", "264000/8801", "24000/1001", "15/1", "29961/1000", "358760/11971", "29917/1000", "2997/100", "4025000/192617" avg_frame_rate: string; // possible values: "1/25", "1/32000", "1/48000", "1/1000", "1/44100", "1/24000", "1/30", "1/192000", "1/25000", "1/15360", "1/30000", "1/90000", "1/60000", "1/48", "1/24", "1001/30000", "1/40000", "1/15", "1/29961", "1/50000", "1/29917", "1/29970", "1/16000" time_base: string; // possible values: 0, 1000, "-1600", 24, 6006, 3003, 1001, 2000, 2002, 93600 start_pts: number | string; // possible values: 0, 0.04, "-0.033333", 0.024, 0.066733, 0.033367, 0.041667, 0.083417, 0.033333, 1.04 start_time: number | string; // possible values: 6354, "N/A", 5134, 5335, 7471, 362001, 15948854, 7523, 7383, 20303, 10786, 24341, 14219, 7628, 165, 7551, 15965, 6659, 16517, 13889, 9673, 8820, 5438, 7138, 8364, 10112, 6442, 7036, 7048, 6385, 15712, 6046, 6850, 7160, 920000, 1770496, 620544, 1925696, 146880, 8688640, 4926000, 4867072, 3334331, 6375424, 4337333, 5540864, 3769766, 116841, 5150703, 158330, 6981603, 7812096, 4252000, 2342340, 1241088, 2522520, 1344512, 33513480, 17869824, 52689136, 28094464, 6666660, 3552256, 7477470, 3983360, 8918910, 4756480, 27837810, 14842880, 4675671, 2490368, 3409906, 1812480, 6121615, 3262464, 630630, 334848, 11863852, 8720384, 105612, 4655153, 37200, 34177024, 15473458, 11372544, 19311292, 14193664, 8261632, 5620615, 16122106, 14812160, 10172162, 9345024, 101, 110, 36, 98, 91, 100, 130, 25847808, 17586569, 8800256, 5987000, 6898688, 3911000, 12105728, 6890000, 22792770, 12151808, 160, 162000, 325632, 5281792, 3302299, 3420, 3298, 3414, 1713, 201, 14090076, 12944384, 3961856, 2695693, 4937728, 3355000, 3347456, 2277275, 956000, 844799, 1591200, 782288, 501000, 883712, 17463296, 11879868, 2113, 9213204, 8464384, 4981977, 9963936, 621621, 328704, 1810809, 961536, 299275, 13196263, 447000, 657408, 5885952, 3993000, 444000, 711680, 1499896, 702000, 702720, 768000, 1474560, 3135600, 3136320, 3467106, 617690 duration_ts: number | string; // possible values: 254.16, "N/A", 205.36, 213.4, 298.84, 362.001, 361.652018, 300.92, 295.32, 812.12, 431.44, 973.64, 568.76, 305.12, 5.5, 302.04, 638.6, 266.36, 660.68, 555.56, 386.92, 352.8, 217.52, 285.52, 334.56, 404.48, 257.68, 281.44, 281.92, 255.4, 628.48, 241.84, 274, 286.4, 36.8, 36.885333, 40.4, 40.118667, 146.88, 197.021315, 197.04, 110.364444, 111.144367, 144.567438, 144.577767, 125.643175, 125.658867, 116.841, 116.795986, 158.33, 158.312993, 177.145034, 177.166667, 26.026, 25.856, 28.028, 28.010667, 372.372, 372.288, 585.434844, 585.301333, 74.074, 74.005333, 83.083, 82.986667, 99.099, 99.093333, 309.309, 309.226667, 51.9519, 51.882667, 37.887844, 37.76, 68.017944, 67.968, 7.007, 6.976, 197.730867, 197.741134, 105.612, 105.559025, 775, 774.989206, 257.890967, 257.880816, 321.854867, 321.851791, 187.338594, 187.353833, 335.877208, 335.876644, 211.920042, 211.905306, 4.04, 4.4, 1.44, 4.083333, 3.036367, 3.336667, 4.337667, 586.118095, 586.218967, 199.55229, 199.566667, 156.432834, 156.44, 274.506304, 275.6, 253.253, 253.162667, 6.666667, 6.75, 6.784, 110.037333, 110.076633, 114.114, 110.043267, 113.9138, 114.2, 8.04, 293.54325, 293.523447, 89.838005, 89.856433, 111.966621, 111.978906, 75.906032, 75.909167, 19.12, 19.15644, 17.68, 17.738957, 20.04, 20.038821, 395.993107, 395.9956, 2.113, 191.94175, 191.936145, 207.582375, 207.582, 6.9069, 6.848, 20.1201, 20.032, 299.275, 299.234989, 14.9, 14.907211, 133.468299, 133.469265, 14.814815, 14.826667, 1499.896, 7.8, 7.808, 30.72, 34.84, 34.848, 38.5234, 38.605625 duration: number | string; // possible values: 1852202, 256000, 2569227, 829146, 384000, 1044664, 270535, 95899, 1731717, 1586138, 1104475, 2483692, 192000, 1546473, 1761655, 1773095, 279355095, 6144000, 2025392, 922588, 1728848, 1008664, 1578126, 1644263, 1140841, 2180493, 1623289, 1531830, 2262475, 2511546, 3844410, 2632761, 3493214, 1222194, 1463390, 2480590, 1346989, 6366106, 317375, 1936035, 127592, "N/A", 224000, 125477, 500433, 123159, 1944978, 119249, 624795, 125485, 530664, 217188, 93428, 1286720, 151239, 115782, 120616, 12030229, 128029, 11991343, 128116, 11981900, 128000, 12044352, 128003, 12064919, 127999, 12001121, 128009, 12025206, 128031, 11993789, 128015, 12080969, 12223455, 12092907, 5335816, 128014, 2534167, 192018, 5464002, 149159, 5299188, 150629, 2307724, 151457, 5743521, 151720, 112185, 133613, 1607011, 151622, 1863445, 151384, 279244800, 627787156, 698112000, 710948571, 1787713979, 3072000, 1005381818, 1536000, 1004377441, 6523709, 705600, 121236, 350089, 101656, 504881, 104617, 81677, 125572, 3537420, 11998423, 3085237, 3671070, 189375, 192086, 12235437, 13332803, 11675521, 1105138325, 8855662, 11004924, 5206145, 320000, 3232384, 1411200, 277862400, 1841436, 151791, 109750, 155564, 123229, 350629, 108220, 539481, 7055040, 317588, 3479319, 125704, 1322685, 189588, 123269, 76564, 40000, 185000, 1868851, 151411, 18800288, 11576333, 11988697, 936366, 125889, 9074853, 94459, 131590, 3025401, 12057179, 127596, 16744190, 95966 bit_rate: number | string; // possible values: "N/A", 111496, 348750, 127852, 153656, 195232, 145112, 153272, 113776, 176696, 135656, 201416, 213992, 195656, 182408, 197208, 243296, 183680, 183664, 137288, 170560, 129656, 143632, 271500, 192000, 188456, 126504, 138960, 125792, 390354, 125704, 189837, 205808, 187080, 181896, 178016, 199500, 128000, 96000 max_bit_rate: number | string; // possible values: "N/A", 8, 32, 16, 10 bits_per_raw_sample: number | string; // possible values: 6354, 8135680, 5134, 6573056, 5335, 10246656, 7471, 9564160, 10860, 15575, 7523, 9631744, 7383, 14177280, 20303, 25990144, 10786, 10353382, 24341, 31159296, 14219, 18202624, 7628, 9765888, 165, 1056000, 7551, 9666560, 15965, 20438016, 6659, 8524800, 16517, 21141760, 13889, 17779712, 9673, 12383232, 8820, 16937472, 5438, 6963200, 7138, 13708800, 8364, 10708992, 10112, 12946432, 6442, 6182986, 7036, 13512192, 7048, 9024512, 6385, 8175616, 15712, 20114432, 6046, 7739392, 6850, 6574822, 7160, 9167872, 920, 1729, 1212, 1881, "N/A", 8485, 4926, 4753, 3331, 6226, 4333, 5411, 3766, 3505, 5030, 4745, 6818, 7629, 4252, 780, 1680, 1313, 11160, 17451, 35091, 27436, 2220, 3469, 2490, 3890, 2970, 4645, 9270, 14495, 3114, 2432, 2271, 1770, 4077, 3186, 210, 327, 5926, 8516, 3168, 4546, 18600, 33376, 7729, 11106, 9646, 13861, 8068, 5615, 8053, 14465, 5081, 9126, 101, 110, 36, 98, 196000, 91, 145746, 100, 160160, 130, 191291, 25242, 17569, 8594, 5987, 6737, 3911, 11822, 6890, 7590, 11867, 160, 215040, 162, 318, 5158, 3299, 3420, 5032427, 3298, 4852908, 3414, 4563069, 1713, 5033280, 201, 7038, 12641, 3869, 2693, 4822, 3355, 3269, 2275, 478, 825, 442, 764, 501, 863, 17054, 11868, 4602, 8266, 4977, 9963936, 414, 321, 1206, 939, 8969, 12887, 447, 642, 5748, 3993, 444, 695, 768, 1440, 805, 603 nb_frames: number | string; // possible values: "N/A" nb_read_frames: string; // possible values: "N/A" nb_read_packets: string; disposition: DispositionData; tags: TagData; } interface VideoStreamData extends StreamData { // possible values: 720, 540, 1920, 512, 640, 480, 1280, 150, 320, 2000, 1728, 1440 width: number; // possible values: 576, 360, 1200, 384, 1080, 480, 268, 720, 320, 350, 90, 270, 240, 1120, 356, 1088 height: number; // possible values: 720, 544, 1920, 512, 640, 480, 1280, 150, 320, 2000, 1728, 1440 coded_width: number; // possible values: 576, 368, 1200, 384, 1088, 480, 272, 720, 320, 352, 1080, 90, 240, 1120, 356 coded_height: number; // possible values: 0, 1, 2 has_b_frames: number; // possible values: "1:1", "0:1", "481:480", "10240:10239", "4:3" sample_aspect_ratio: string; // possible values: "5:4", "3:2", "0:1", "4:3", "16:9", "120:67", "48:35", "481:270", "25:14", "8:5", "16384:10239", "160:89", "30:17" display_aspect_ratio: string; // possible values: "yuv420p", "yuvj420p", "bgra", "uyvy422", "yuv420p10le" pix_fmt: string; // possible values: 3, 30, 5, "-99", 41, 31, 40, 21, 13, 1, 51, 50, 11, 42 level: number | string; // possible values: "N/A", "pc", "tv" color_range: string; // possible values: "unknown", "bt709", "bt470bg" color_space: string; // possible values: "unknown", "bt470m", "iec61966-2-4" color_transfer: string; // possible values: "unknown", "bt709" color_primaries: string; // possible values: "left", "unspecified" chroma_location: string; // possible values: "N/A" timecode: string; // possible values: 1, 3, 4, 2, 12 refs: number; // possible values: 0 quarter_sample?: number; // possible values: 0 divx_packed?: number; // possible values: "true", "false" is_avc?: string; // possible values: 4, 2, 0 nal_length_size?: number; } interface AudioStreamData extends StreamData { // possible values: "fltp", "s16p", "s16", "s32" sample_fmt: string; // possible values: 48000, 44100, 192000, 32000, 16000 sample_rate: number; // possible values: 2, 1 channels: number; // possible values: "stereo", "unknown", "mono" channel_layout: string; // possible values: 0, 16, 32, 8 bits_per_sample: number; // possible values: "-1" dmix_mode?: string; // possible values: "-1.000000" ltrt_cmixlev?: string; // possible values: "-1.000000" ltrt_surmixlev?: string; // possible values: "-1.000000" loro_cmixlev?: string; // possible values: "-1.000000" loro_surmixlev?: string; } interface SubtitleStreamData extends StreamData { // possible values: "N/A", 1920 width: number | string; // possible values: "N/A", 1080 height: number | string; } interface FormatData { filename: string; // possible values: 2, 5, 1, 3 nb_streams: number; // possible values: 0, 1 nb_programs: number; // possible values: "avi", "mov,mp4,m4a,3gp,3g2,mj2", "matroska,webm", "asf", "mpegts" format_name: string; // possible values: "AVI (Audio Video Interleaved)", "QuickTime / MOV", "Matroska / WebM", "ASF (Advanced / Active Streaming Format)", "MPEG-TS (MPEG-2 Transport Stream)" format_long_name: string; // possible values: 0, "-0.033333", 1.04 start_time: number | string; // possible values: 254.16, 205.36, 213.4, 298.84, 362, 300.92, 295.32, 812.12, 431.44, 973.64, 568.76, 305.12, 5.5, 302.04, 638.6, 266.36, 660.68, 555.56, 386.92, 352.8, 217.52, 285.52, 334.56, 404.48, 257.68, 281.44, 281.92, 255.4, 628.48, 241.84, 274, 286.4, 36.885333, 40.4, 146.88, 197.04, 111.143333, 144.576667, 125.658333, 116.84, 158.33, 177.166667, 26.026, 28.028, 372.372, 585.434844, 74.074, 83.083, 99.099, 309.309, 51.9519, 37.887844, 68.017944, 7.007, 197.74, 105.611667, 775, 257.89, 321.853333, 187.353333, 335.876667, 211.92, 4.04, 4.4, 1.44, 4.083333, 3.036367, 3.336667, 4.337667, 586.218333, 199.566667, 156.44, 275.6, 253.253, 6.666667, 6.784, 110.076633, 114.114, 110.043267, 113.9138, 114.2, 8.04, 293.541667, 89.855, 111.978333, 75.908333, 19.156444, 17.739, 20.04, 395.995, 2.113, 191.941667, 207.582375, 6.9069, 20.1201, 299.275, 14.907211, 133.468333, 14.826667, 276.068, 1439.563, 33.012, 1499.896, 7.808, 30.72, 34.848, 38.592 duration: number; // possible values: 67293478, 72803810, 32656624, 48933286, 17039901, 75113908, 73070414, 138911218, 144693098, 220305764, 144025568, 77737826, 195127976, 86478210, 94710296, 66408538, 105017344, 127943304, 92338812, 67660232, 66539174, 71978396, 75168266, 127776130, 87314314, 149079280, 102130128, 120002332, 116748756, 52285174, 91784682, 57726490, 30805998, 10462421, 37602221, 15477613, 28758614, 13495228, 10352421, 4628755, 28585936, 5289637, 39579811, 42525792, 564008000, 891877194, 112965829, 126041862, 150636741, 468950129, 79414866, 58592591, 104035400, 4817909, 67446449, 74185119, 528186602, 79359280, 237280548, 5818919, 73938316, 53438088, 139627008, 342149120, 349065120, 124423584, 904759288, 349060608, 378160640, 415547904, 4052992, 34720184, 15197287, 3691843, 126257496, 384109574, 2784754, 3266868, 171055560, 186154740, 163351288, 15771587072, 132316672, 161936290, 78870132, 66304968, 277869568, 73226986, 3010874, 6670818, 6172404, 17643411, 7983693, 3808350, 10022059, 88060, 48530992, 527993947, 10136912, 30537776, 39979584, 17272651, 3816383, 5972195, 53106341, 458933255, 2354207, 421659500, 20840448, 46801441, 96337920, 81903536 size: number; // possible values: 2118145, 2836143, 1224240, 1309952, 376572, 1996913, 1979423, 1368381, 2682979, 1810161, 2025818, 2038223, 283822510, 2290510, 1186474, 1994549, 1271627, 1842368, 1909207, 1534245, 2447192, 2016766, 1797423, 2527217, 2710782, 4237614, 2898130, 3758882, 1486109, 1729579, 2679844, 1612471, 6681462, 2071766, 2048051, 628404, 2070019, 746744, 659083, 316929, 1444372, 238854, 12166237, 12138088, 12117087, 12187551, 12200321, 12136476, 12160505, 12128974, 12228983, 12371797, 12236229, 5500681, 2728692, 5619463, 5452248, 2461802, 5897855, 248468, 1761082, 2017292, 276489124, 622089309, 691218059, 691242133, 1772589770, 691209124, 996350283, 996318551, 7474971, 473819, 609211, 188792, 3664949, 12133623, 3341704, 3852438, 12431743, 13529101, 11871823, 1105672367, 9619247, 11772554, 5538934, 4644831, 276487132, 1995682, 268065, 476579, 650511, 7368136, 3600515, 1520299, 202468, 333402, 2022739, 20348315, 11741200, 12142196, 1068704, 9269420, 228751, 3222407, 1538935, 2550403, 570509, 2249006, 21352918, 12187875, 22116143, 16978344 bit_rate: number; // possible values: 100 probe_score: number; tags: TagData; } interface Metadata { streams: StreamData[]; format: FormatData; } interface Callback { (err: any, ffprobeData: Ffprobe.Metadata): T; } } declare module Ffmpeg { interface CommandOptions { /** * input file name or readable stream (ignored if an input file is passed to the constructor) */ source?: string | NodeJS.ReadableStream; /** * ffmpeg timeout in seconds (defaults to no timeout) */ timeout?: number; /** * directory to load module presets from (defaults to `lib/presets` directory in fluent-ffmpeg tree) */ presets?: string; /** * @see presets */ preset?: string; /** * ffmpeg niceness value, between -20 and 20; ignored on Windows platforms (default to 0) */ niceness?: number; /** * @see niceness */ priority?: number; /** * logger object with `debug()`, `info()`, `warn()` and `error()` methods (defaults to no logging) */ logger?: { debug: Function; info: Function; warn: Function; error: Function; }; } interface FilterData { [key: string]: { description: string; input: string; multipleInputs: boolean; output: string; multipleOutputs: boolean; }; } interface FilterCallback { (err: any, filters: FilterData): T; } interface CodecData { [key: string]: { description: string; canDecode: boolean; canEncode: boolean; }; } interface CodecCallback { (err: any, codecs: CodecData): T; } interface EncoderData { [key: string]: { description: string; type: boolean; frameMT: boolean; sliceMT: boolean; experimental: boolean; drawHorizBand: boolean; directRendering: boolean; }; } interface EncoderCallback { (err: any, encoders: EncoderData): T; } interface FormatData { [key: string]: { description: string; canDemux: boolean; canMux: boolean; }; } interface FormatCallback { (err: any, formats: FormatData): T; } /** * If multiple timemarks are passed and no variable format token ('%s' or '%i') is specified in the filename pattern, _%i will be added automatically. */ interface ScreenshotsConfig { /** * Output folder for generated image files. * Defaults to the current folder. */ folder?: string; /** * Output filename pattern. * Defaults to "tn.png". * * The `filename` option specifies a filename pattern for generated files. * It may contain the following format tokens: * - '%s': offset in seconds * - '%w': screenshot width * - '%h': screenshot height * - '%r': screenshot resolution (same as '%wx%h') * - '%f': input filename * - '%b': input basename (filename w/o extension) * - '%i': index of screenshot in timemark array (can be zero-padded by using it like %000i) */ filename?: string; /** * Specifies how many thumbnails to generate. * When using this option, thumbnails are generated at regular intervals in the video (for example, when requesting 3 thumbnails, at 25%, 50% and 75% of the video length). * `count` is ignored when `timemarks` or `timestamps` is specified. */ count?: number; /** * Specifies an array of timestamps in the video where thumbnails should be taken. * Each timestamp may be a number (in seconds), a percentage string (eg. "50%") or a timestamp string with format "hh:mm:ss.xxx" (where hours, minutes and milliseconds are both optional). */ timestamps?: number[] | string[]; /** * @see timestamps */ timemarks?: number[] | string[]; /** * Specifies a target size for thumbnails (with the same format as the `.size()` method). * *Note:* you should not use the `.size()` method when generating thumbnails. */ size?: string; } interface FilterObject { filter: string; options?: string | string[] | { [key: string]: string }; } interface FilterSpecification { filter: string; inputs?: string | string[]; outputs?: string | string[]; options?: string | string | any; } interface CodecDataEventData { format: string; audio: string; video: string; duration: string; audio_details: string[]; video_details: string[]; } interface ProgressEventData { frames: number; currentFps: number; currentKbps: number; targetSize: number; timemark: string; percent: number; } interface Command extends NodeJS.EventEmitter { /** * Clone an ffmpeg command * * This method is useful when you want to process the same input multiple times. * It returns a new FfmpegCommand instance with the exact same options. * * All options set _after_ the clone() call will only be applied to the instance * it has been called on. * * @example * var command = ffmpeg('/path/to/source.avi') * .audioCodec('libfaac') * .videoCodec('libx264') * .format('mp4'); * * command.clone() * .size('320x200') * .save('/path/to/output-small.mp4'); * * command.clone() * .size('640x400') * .save('/path/to/output-medium.mp4'); * * command.save('/path/to/output-original-size.mp4'); * * @method FfmpegCommand#clone * @return FfmpegCommand */ clone(): Command; /** * ================== * file: ./ffprobe.js * ================== */ /** * A callback passed to the {@link FfmpegCommand#ffprobe} method. * * @callback FfmpegCommand~ffprobeCallback * * @param {Error|null} err error object or null if no error happened * @param {Object} ffprobeData ffprobe output data; this object * has the same format as what the following command returns: * * `ffprobe -print_format json -show_streams -show_format INPUTFILE` * @param {Array} ffprobeData.streams stream information * @param {Object} ffprobeData.format format information */ /** * Run ffprobe on last specified input * * @method FfmpegCommand#ffprobe * @category Metadata * * @param {FfmpegCommand~ffprobeCallback} callback callback function * */ ffprobe(callback: Ffprobe.Callback): T; /** * Run ffprobe on last specified input * * @method FfmpegCommand#ffprobe * @category Metadata * * @param {Number} [index] 0-based index of input to probe (defaults to last input) * @param {FfmpegCommand~ffprobeCallback} callback callback function * */ ffprobe(index: number, callback: Ffprobe.Callback): T; /** * =================== * file: ./receipes.js * =================== */ /** * Execute ffmpeg command and save output to a file * * @method FfmpegCommand#save * @category Processing * @aliases saveToFile * * @param {String} output file path * @return FfmpegCommand */ save(output: string): Command; /** * @see FfmpegCommand.saveToFile */ saveToFile(output: string): Command; /** * Execute ffmpeg command and save output to a stream * * If 'stream' is not specified, a PassThrough stream is created and returned. * 'options' will be used when piping ffmpeg output to the output stream * (@see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options) * * @method FfmpegCommand#pipe * @category Processing * @aliases stream,writeToStream * * @param {stream.Writable} [stream] output stream * @param {Object} [options={}] pipe options * @return Output stream */ pipe(stream?: NodeJS.WritableStream, options?); /** * @see FfmpegCommand.pipe */ writeToStream(stream?, options?); /** * @see FfmpegCommand.pipe */ stream(stream?, options?); /** * Generate images from a video * * Note: this method makes the command emit a 'filenames' event with an array of * the generated image filenames. * * @method FfmpegCommand#screenshots * @category Processing * @aliases takeScreenshots,thumbnail,thumbnails,screenshot * * @param {Number|Object} [config=1] screenshot count or configuration object with * the following keys: * @param {Number} [config.count] number of screenshots to take; using this option * takes screenshots at regular intervals (eg. count=4 would take screens at 20%, 40%, * 60% and 80% of the video length). * @param {String} [config.folder='.'] output folder * @param {String} [config.filename='tn.png'] output filename pattern, may contain the following * tokens: * - '%s': offset in seconds * - '%w': screenshot width * - '%h': screenshot height * - '%r': screenshot resolution (same as '%wx%h') * - '%f': input filename * - '%b': input basename (filename w/o extension) * - '%i': index of screenshot in timemark array (can be zero-padded by using it like `%000i`) * @param {Number[]|String[]} [config.timemarks] array of timemarks to take screenshots * at; each timemark may be a number of seconds, a '[[hh:]mm:]ss[.xxx]' string or a * 'XX%' string. Overrides 'count' if present. * @param {Number[]|String[]} [config.timestamps] alias for 'timemarks' * @param {Boolean} [config.fastSeek] use fast seek (less accurate) * @param {String} [config.size] screenshot size, with the same syntax as {@link FfmpegCommand#size} * @param {String} [folder] output folder (legacy alias for 'config.folder') * @return FfmpegCommand */ screenshots(config?: number | ScreenshotsConfig, folder?: string): Command; /** * @see FfmpegCommand.screenshots */ takeScreenshots(config?: number | ScreenshotsConfig, folder?: string): Command; /** * @see FfmpegCommand.screenshots */ thumbnail(config?: number | ScreenshotsConfig, folder?: string): Command; /** * @see FfmpegCommand.screenshots */ thumbnails(config?: number | ScreenshotsConfig, folder?: string): Command; /** * @see FfmpegCommand.screenshots */ screenshot(config?: number | ScreenshotsConfig, folder?: string): Command; /** * Merge (concatenate) inputs to a single file * * @method FfmpegCommand#concat * @category Processing * @aliases concatenate,mergeToFile * * @param {String|Writable} target output file or writable stream * @param {Object} [options] pipe options (only used when outputting to a writable stream) * @return FfmpegCommand */ concat(target: string | NodeJS.WritableStream, options?): Command; /** * @see FfmpegCommand.concat */ mergeToFile(target: string | NodeJS.WritableStream, options?): Command; /** * @see FfmpegCommand.concat */ concatenate(target: string | NodeJS.WritableStream, options?): Command; /** * ==================== * file: ./processor.js * ==================== */ /** * Run ffmpeg command * * @method FfmpegCommand#run * @category Processing * @aliases exec,execute */ run(): void; /** * @see FfmpegCommand.run */ exec(): void; /** * @see FfmpegCommand.run */ execute(): void; /** * Renice current and/or future ffmpeg processes * * Ignored on Windows platforms. * * @method FfmpegCommand#renice * @category Processing * * @param {Number} [niceness=0] niceness value between -20 (highest priority) and 20 (lowest priority) * @return FfmpegCommand */ renice(niceness?: number): Command; /** * Kill current ffmpeg process, if any * * @method FfmpegCommand#kill * @category Processing * * @param {String} [signal=SIGKILL] signal name * @return FfmpegCommand */ kill(signal?: string): Command; /** * ======================= * file: ./capabilities.js * ======================= */ /** * Manually define the ffmpeg binary full path. * * @method FfmpegCommand#setFfmpegPath * * @param {String} ffmpegPath The full path to the ffmpeg binary. * @return FfmpegCommand */ setFfmpegPath(ffmpegPath: string): Command; /** * Manually define the ffprobe binary full path. * * @method FfmpegCommand#setFfprobePath * * @param {String} ffprobePath The full path to the ffprobe binary. * @return FfmpegCommand */ setFfprobePath(ffprobePath: string): Command; /** * Manually define the flvtool2/flvmeta binary full path. * * @method FfmpegCommand#setFlvtoolPath * * @param {String} flvtool The full path to the flvtool2 or flvmeta binary. * @return FfmpegCommand */ setFlvtoolPath(flvtool: string): Command; /** * A callback passed to {@link FfmpegCommand#availableFilters}. * * @callback FfmpegCommand~filterCallback * @param {Error|null} err error object or null if no error happened * @param {Object} filters filter object with filter names as keys and the following * properties for each filter: * @param {String} filters.description filter description * @param {String} filters.input input type, one of 'audio', 'video' and 'none' * @param {Boolean} filters.multipleInputs whether the filter supports multiple inputs * @param {String} filters.output output type, one of 'audio', 'video' and 'none' * @param {Boolean} filters.multipleOutputs whether the filter supports multiple outputs */ /** * Query ffmpeg for available filters * * @method FfmpegCommand#availableFilters * @category Capabilities * @aliases getAvailableFilters * * @param {FfmpegCommand~filterCallback} callback callback function */ availableFilters(callback: FilterCallback): T; /** * @see FfmpegCommand.availableFilters */ getAvailableFilters(callback: FilterCallback): T; /** * A callback passed to {@link FfmpegCommand#availableCodecs}. * * @callback FfmpegCommand~codecCallback * @param {Error|null} err error object or null if no error happened * @param {Object} codecs codec object with codec names as keys and the following * properties for each codec (more properties may be available depending on the * ffmpeg version used): * @param {String} codecs.description codec description * @param {Boolean} codecs.canDecode whether the codec is able to decode streams * @param {Boolean} codecs.canEncode whether the codec is able to encode streams */ /** * Query ffmpeg for available codecs * * @method FfmpegCommand#availableCodecs * @category Capabilities * @aliases getAvailableCodecs * * @param {FfmpegCommand~codecCallback} callback callback function */ availableCodecs(callback: CodecCallback): T; /** * @see FfmpegCommand.availableCodecs */ getAvailableCodecs(callback: CodecCallback): T; /** * A callback passed to {@link FfmpegCommand#availableEncoders}. * * @callback FfmpegCommand~encodersCallback * @param {Error|null} err error object or null if no error happened * @param {Object} encoders encoders object with encoder names as keys and the following * properties for each encoder: * @param {String} encoders.description codec description * @param {Boolean} encoders.type "audio", "video" or "subtitle" * @param {Boolean} encoders.frameMT whether the encoder is able to do frame-level multithreading * @param {Boolean} encoders.sliceMT whether the encoder is able to do slice-level multithreading * @param {Boolean} encoders.experimental whether the encoder is experimental * @param {Boolean} encoders.drawHorizBand whether the encoder supports draw_horiz_band * @param {Boolean} encoders.directRendering whether the encoder supports direct encoding method 1 */ /** * Query ffmpeg for available encoders * * @method FfmpegCommand#availableEncoders * @category Capabilities * @aliases getAvailableEncoders * * @param {FfmpegCommand~encodersCallback} callback callback function */ availableEncoders(callback: EncoderCallback): T; /** * @see FfmpegCommand.availableEncoders */ getAvailableEncoders(callback: EncoderCallback): T; /** * A callback passed to {@link FfmpegCommand#availableFormats}. * * @callback FfmpegCommand~formatCallback * @param {Error|null} err error object or null if no error happened * @param {Object} formats format object with format names as keys and the following * properties for each format: * @param {String} formats.description format description * @param {Boolean} formats.canDemux whether the format is able to demux streams from an input file * @param {Boolean} formats.canMux whether the format is able to mux streams into an output file */ /** * Query ffmpeg for available formats * * @method FfmpegCommand#availableFormats * @category Capabilities * @aliases getAvailableFormats * * @param {FfmpegCommand~formatCallback} callback callback function */ availableFormats(callback: FormatCallback): T; /** * @see FfmpegCommand.availableFormats */ getAvailableFormats(callback: FormatCallback): T; /** * ======================== * file: ./options/input.js * ======================== */ /** * Add an input to command * * Also switches "current input", that is the input that will be affected * by subsequent input-related methods. * * Note: only one stream input is supported for now. * * @method FfmpegCommand#input * @category Input * @aliases mergeAdd,addInput * * @param {String|Readable} source input file path or readable stream * @return FfmpegCommand */ input(source: string | NodeJS.ReadableStream): Command; /** * @see FfmpegCommand.input */ mergeAdd(source: string | NodeJS.ReadableStream): Command; /** * @see FfmpegCommand.input */ addInput(source: string | NodeJS.ReadableStream): Command; /** * Specify input format for the last specified input * * @method FfmpegCommand#inputFormat * @category Input * @aliases withInputFormat,fromFormat * * @param {String} format input format * @return FfmpegCommand */ inputFormat(format: string): Command; /** * @see FfmpegCommand.inputFormat */ withInputFormat(format: string): Command; /** * @see FfmpegCommand.inputFormat */ fromFormat(format: string): Command; /** * Specify input FPS for the last specified input * (only valid for raw video formats) * * @method FfmpegCommand#inputFps * @category Input * @aliases withInputFps,withInputFPS,withFpsInput,withFPSInput,inputFPS,inputFps,fpsInput * * @param {Number} fps input FPS * @return FfmpegCommand */ FPSInput(fps: number): Command; /** * @see FfmpegCommand.FPSInput */ withInputFps(fps: number): Command; /** * @see FfmpegCommand.FPSInput */ withInputFPS(fps: number): Command; /** * @see FfmpegCommand.FPSInput */ withFpsInput(fps: number): Command; /** * @see FfmpegCommand.FPSInput */ withFPSInput(fps: number): Command; /** * @see FfmpegCommand.FPSInput */ inputFPS(fps: number): Command; /** * @see FfmpegCommand.FPSInput */ inputFps(fps: number): Command; /** * @see FfmpegCommand.FPSInput */ fpsInput(fps: number): Command; /** * Use native framerate for the last specified input * * @method FfmpegCommand#native * @category Input * @aliases nativeFramerate,withNativeFramerate * * @return FfmmegCommand */ native(): Command; /** * @see FfmpegCommand.native */ nativeFramerate(): Command; /** * @see FfmpegCommand.native */ withNativeFramerate(): Command; /** * Specify input seek time for the last specified input * * @method FfmpegCommand#seekInput * @category Input * @aliases setStartTime,seekTo * * @param {String|Number} seek seek time in seconds or as a '[hh:[mm:]]ss[.xxx]' string * @return FfmpegCommand */ seekInput(seek: string | number): Command; /** * @see FfmpegCommand.seekInput */ setStartTime(seek: string | number): Command; /** * Loop over the last specified input * * @method FfmpegCommand#loop * @category Input * * @param {String|Number} [duration] loop duration in seconds or as a '[[hh:]mm:]ss[.xxx]' string * @return FfmpegCommand */ loop(duration?: string | number): Command; /** * ======================== * file: ./options/audio.js * ======================== */ /** * Disable audio in the output * * @method FfmpegCommand#noAudio * @category Audio * @aliases withNoAudio * @return FfmpegCommand */ noAudio(): Command; /** * @see FfmpegCommand.noAudio */ withNoAudio(): Command; /** * Specify audio codec * * @method FfmpegCommand#audioCodec * @category Audio * @aliases withAudioCodec * * @param {String} codec audio codec name * @return FfmpegCommand */ audioCodec(codec: string): Command; /** * @see FfmpegCommand.audioCodec */ withAudioCodec(codec: string): Command; /** * Specify audio bitrate * * @method FfmpegCommand#audioBitrate * @category Audio * @aliases withAudioBitrate * * @param {String|Number} bitrate audio bitrate in kbps (with an optional 'k' suffix) * @return FfmpegCommand */ audioBitrate(bitrate: string | number): Command; /** * @see FfmpegCommand.audioBitrate */ withAudioBitrate(bitrate: string | number): Command; /** * Specify audio channel count * * @method FfmpegCommand#audioChannels * @category Audio * @aliases withAudioChannels * * @param {Number} channels channel count * @return FfmpegCommand */ audioChannels(channels: number): Command; /** * @see FfmpegCommand.audioChannels */ withAudioChannels(channels: number): Command; /** * Specify audio frequency * * @method FfmpegCommand#audioFrequency * @category Audio * @aliases withAudioFrequency * * @param {Number} freq audio frequency in Hz * @return FfmpegCommand */ audioFrequency(freq: number): Command; /** * @see FfmpegCommand.audioFrequency */ withAudioFrequency(freq: number): Command; /** * Specify audio quality * * @method FfmpegCommand#audioQuality * @category Audio * @aliases withAudioQuality * * @param {Number} quality audio quality factor * @return FfmpegCommand */ audioQuality(quality: number): Command; /** * @see FfmpegCommand.audioQuality */ withAudioQuality(quality: number): Command; /** * Specify custom audio filter(s) * * Can be called both with one or many filters, or a filter array. * * @example * command.audioFilters('filter1'); * * @example * command.audioFilters('filter1', 'filter2=param1=value1:param2=value2'); * * @method FfmpegCommand#audioFilters * @aliases withAudioFilter,withAudioFilters,audioFilter * @category Audio * * @param {...String} filters audio filter strings * @return FfmpegCommand */ audioFilters(...filters: string[]): Command; /** * Specify custom audio filter(s) * * Can be called both with one or many filters, or a filter array. * * @example * command.audioFilters( * { * filter: 'filter1', * options: ['value1', 'value2'] * }, * { * filter: 'filter2', * options: { param1: 'value1', param2: 'value2' } * } * ); * * @method FfmpegCommand#audioFilters * @aliases withAudioFilter,withAudioFilters,audioFilter * @category Audio * * @param {...Object} filters audio filter specifications with the following properties: * @param {String} filters.filter filter name * @param {String|String[]|Object} [filters.options] filter option string, array, or object * @return FfmpegCommand */ audioFilters(...filters: FilterObject[]): Command; /** * Specify custom audio filter(s) * * Can be called both with one or many filters, or a filter array. * * @example * command.audioFilters(['filter1', 'filter2']); * * @example * command.audioFilters([ * { * filter: 'filter1' * }, * { * filter: 'filter2', * options: 'param=value:param=value' * } * ]); * * @method FfmpegCommand#audioFilters * @aliases withAudioFilter,withAudioFilters,audioFilter * @category Audio * * @param {String[]|Object[]} filters audio filter string array or specification array, each with the following properties: * @param {String} filters.filter filter name * @param {String|String[]|Object} [filters.options] filter option string, array, or object * @return FfmpegCommand */ audioFilters(filters: string[] | FilterObject[]): Command; /** * @see FfmpegCommand.audioFilters */ withAudioFilter(...filters: string[]): Command; /** * @see FfmpegCommand.audioFilters */ withAudioFilter(filters: string[]): Command; /** * @see FfmpegCommand.audioFilters */ withAudioFilter(...filters: FilterObject[]): Command; /** * @see FfmpegCommand.audioFilters */ withAudioFilter(filters: FilterObject[]): Command; /** * @see FfmpegCommand.audioFilters */ withAudioFilters(...filters: string[]): Command; /** * @see FfmpegCommand.audioFilters */ withAudioFilters(filters: string[]): Command; /** * @see FfmpegCommand.audioFilters */ withAudioFilters(...filters: FilterObject[]): Command; /** * @see FfmpegCommand.audioFilters */ withAudioFilters(filters: FilterObject[]): Command; /** * @see FfmpegCommand.audioFilters */ audioFilter(...filters: string[]): Command; /** * @see FfmpegCommand.audioFilters */ audioFilter(filters: string[]): Command; /** * @see FfmpegCommand.audioFilters */ audioFilter(...filters: FilterObject[]): Command; /** * @see FfmpegCommand.audioFilters */ audioFilter(filters: FilterObject[]): Command; /** * ======================== * file: ./options/video.js * ======================== */ /** * Disable video in the output * * @method FfmpegCommand#noVideo * @category Video * @aliases withNoVideo * * @return FfmpegCommand */ noVideo(): Command; /** * @see FfmpegCommand.noVideo */ withNoVideo(): Command; /** * Specify video codec * * @method FfmpegCommand#videoCodec * @category Video * @aliases withVideoCodec * * @param {String} codec video codec name * @return FfmpegCommand */ videoCodec(codec: string): Command; /** * @see FfmpegCommand.videoCodec */ withVideoCodec(codec: string): Command; /** * Specify video bitrate * * @method FfmpegCommand#videoBitrate * @category Video * @aliases withVideoBitrate * * @param {String|Number} bitrate video bitrate in kbps (with an optional 'k' suffix) * @param {Boolean} [constant=false] enforce constant bitrate * @return FfmpegCommand */ videoBitrate(bitrate: string | number, constant? : boolean): Command; /** * @see FfmpegCommand.videoBitrate */ withVideoBitrate(bitrate: string | number, constant? : boolean): Command; /** * Specify custom video filter(s) * * Can be called both with one or many filters, or a filter array. * * @example * command.videoFilters('filter1'); * * @example * command.videoFilters('filter1', 'filter2=param1=value1:param2=value2'); * * @method FfmpegCommand#videoFilters * @category Video * @aliases withVideoFilter,withVideoFilters,videoFilter * * @param {...String} filters video filter strings * @return FfmpegCommand */ videoFilters(...filters: string[]): Command; /** * Specify custom video filter(s) * * Can be called both with one or many filters, or a filter array. * * @example * command.videoFilters( * { * filter: 'filter1', * options: ['value1', 'value2'] * }, * { * filter: 'filter2', * options: { param1: 'value1', param2: 'value2' } * } * ); * * @method FfmpegCommand#videoFilters * @category Video * @aliases withVideoFilter,withVideoFilters,videoFilter * * @param {...Object} filters video filter specifications with the following properties: * @param {String} filters.filter filter name * @param {String|String[]|Object} [filters.options] filter option string, array, or object * @return FfmpegCommand */ videoFilters(...filters: FilterObject[]): Command; /** * Specify custom video filter(s) * * Can be called both with one or many filters, or a filter array. * * @example * command.videoFilters(['filter1', 'filter2']); * * @example * command.videoFilters([ * { * filter: 'filter1' * }, * { * filter: 'filter2', * options: 'param=value:param=value' * } * ]); * * @method FfmpegCommand#videoFilters * @category Video * @aliases withVideoFilter,withVideoFilters,videoFilter * * @param {String[]|Object[]} filters video filter string array or specification array, each with the following properties: * @param {String} filters.filter filter name * @param {String|String[]|Object} [filters.options] filter option string, array, or object * @return FfmpegCommand */ videoFilters(filters: string[] | FilterObject[]): Command; /** * @see FfmpegCommand.videoFilters */ withVideoFilter(...filters: string[]): Command; /** * @see FfmpegCommand.videoFilters */ withVideoFilter(filters: string[]): Command; /** * @see FfmpegCommand.videoFilters */ withVideoFilter(...filters: FilterObject[]): Command; /** * @see FfmpegCommand.videoFilters */ withVideoFilter(filters: FilterObject[]): Command; /** * @see FfmpegCommand.videoFilters */ withVideoFilters(...filters: string[]): Command; /** * @see FfmpegCommand.videoFilters */ withVideoFilters(filters: string[]): Command; /** * @see FfmpegCommand.videoFilters */ withVideoFilters(...filters: FilterObject[]): Command; /** * @see FfmpegCommand.videoFilters */ withVideoFilters(filters: FilterObject[]): Command; /** * @see FfmpegCommand.videoFilters */ videoFilter(...filters: string[]): Command; /** * @see FfmpegCommand.videoFilters */ videoFilter(filters: string[]): Command; /** * @see FfmpegCommand.videoFilters */ videoFilter(...filters: FilterObject[]): Command; /** * @see FfmpegCommand.videoFilters */ videoFilter(filters: FilterObject[]): Command; /** * Specify output FPS * * @method FfmpegCommand#fps * @category Video * @aliases withOutputFps,withOutputFPS,withFpsOutput,withFPSOutput,withFps,withFPS,outputFPS,outputFps,fpsOutput,FPSOutput,FPS * * @param {Number} fps output FPS * @return FfmpegCommand */ fps(fps: number): Command; /** * @see FfmpegCommand.fps */ withOutputFps(fps: number): Command; /** * @see FfmpegCommand.fps */ withOutputFPS(fps: number): Command; /** * @see FfmpegCommand.fps */ withFpsOutput(fps: number): Command; /** * @see FfmpegCommand.fps */ withFPSOutput(fps: number): Command; /** * @see FfmpegCommand.fps */ withFps(fps: number): Command; /** * @see FfmpegCommand.fps */ withFPS(fps: number): Command; /** * @see FfmpegCommand.fps */ outputFPS(fps: number): Command; /** * @see FfmpegCommand.fps */ outputFps(fps: number): Command; /** * @see FfmpegCommand.fps */ fpsOutput(fps: number): Command; /** * @see FfmpegCommand.fps */ FPSOutput(fps: number): Command; /** * @see FfmpegCommand.fps */ FPS(fps: number): Command; /** * Only transcode a certain number of frames * * @method FfmpegCommand#frames * @category Video * @aliases takeFrames,withFrames * * @param {Number} frames frame count * @return FfmpegCommand */ frames(frames: number): Command; /** * @see FfmpegCommand.frames */ takeFrames(frames: number): Command; /** * @see FfmpegCommand.frames */ withFrames(frames: number): Command; /** * ============================ * file: ./options/videosize.js * ============================ */ /** * Keep display aspect ratio * * This method is useful when converting an input with non-square pixels to an output format * that does not support non-square pixels. It rescales the input so that the display aspect * ratio is the same. * * @method FfmpegCommand#keepDAR * @category Video size * @aliases keepPixelAspect,keepDisplayAspect,keepDisplayAspectRatio * * @return FfmpegCommand */ keepDAR(): Command; /** * Only for compatibility, this is not about keeping _pixel_ aspect ratio * * @see FfmpegCommand.keepDAR */ keepPixelAspect(): Command; /** * @see FfmpegCommand.keepDAR */ keepDisplayAspect(): Command; /** * @see FfmpegCommand.keepDAR */ keepDisplayAspectRatio(): Command; /** * Set output size * * The 'size' parameter can have one of 4 forms: * - 'X%': rescale to xx % of the original size * - 'WxH': specify width and height * - 'Wx?': specify width and compute height from input aspect ratio * - '?xH': specify height and compute width from input aspect ratio * * Note: both dimensions will be truncated to multiples of 2. * * @method FfmpegCommand#size * @category Video size * @aliases withSize,setSize * * @param {String} size size string, eg. '33%', '320x240', '320x?', '?x240' * @return FfmpegCommand */ size(size: string): Command; /** * @see FfmpegCommand.size */ withSize(size: string): Command; /** * @see FfmpegCommand.size */ setSize(size: string): Command; /** * Set output aspect ratio * * @method FfmpegCommand#aspect * @category Video size * @aliases withAspect,withAspectRatio,setAspect,setAspectRatio,aspectRatio * * @param {String|Number} aspect aspect ratio (number or 'X:Y' string) * @return FfmpegCommand */ aspect(aspect: string | number): Command; /** * @see FfmpegCommand.aspect */ withAspect(aspect: string | number): Command; /** * @see FfmpegCommand.aspect */ withAspectRatio(aspect: string | number): Command; /** * @see FfmpegCommand.aspect */ setAspect(aspect: string | number): Command; /** * @see FfmpegCommand.aspect */ setAspectRatio(aspect: string | number): Command; /** * @see FfmpegCommand.aspect */ aspectRatio(aspect: string | number): Command; /** * Enable auto-padding the output * * @method FfmpegCommand#autopad * @category Video size * @aliases applyAutopadding,applyAutoPadding,applyAutopad,applyAutoPad,withAutopadding,withAutoPadding,withAutopad,withAutoPad,autoPad * * @param {Boolean} [pad=true] enable/disable auto-padding * @param {String} [color='black'] pad color * @return FfmpegCommand */ autopad(pad?: boolean, color?: string): Command; /** * @see FfmpegCommand.autopad */ applyAutopadding(pad?: boolean, color?: string): Command; /** * @see FfmpegCommand.autopad */ applyAutoPadding(pad?: boolean, color?: string): Command; /** * @see FfmpegCommand.autopad */ applyAutopad(pad?: boolean, color?: string): Command; /** * @see FfmpegCommand.autopad */ applyAutoPad(pad?: boolean, color?: string): Command; /** * @see FfmpegCommand.autopad */ withAutopadding(pad?: boolean, color?: string): Command; /** * @see FfmpegCommand.autopad */ withAutoPadding(pad?: boolean, color?: string): Command; /** * @see FfmpegCommand.autopad */ withAutopad(pad?: boolean, color?: string): Command; /** * @see FfmpegCommand.autopad */ withAutoPad(pad?: boolean, color?: string): Command; /** * @see FfmpegCommand.autopad */ autoPad(pad?: boolean, color?: string): Command; /** * ========================= * file: ./options/output.js * ========================= */ /** * Add output * * @method FfmpegCommand#output * @category Output * @aliases addOutput * * @param {String|Writable} target target file path or writable stream * @param {Object} [pipeopts={}] pipe options (only applies to streams) * @return FfmpegCommand */ output(target: string | NodeJS.WritableStream): Command; /** * @see FfmpegCommand.output */ addOutput(target: string | NodeJS.WritableStream): Command; /** * Specify output seek time * * @method FfmpegCommand#seek * @category Input * @aliases seekOutput * * @param {String|Number} seek seek time in seconds or as a '[hh:[mm:]]ss[.xxx]' string * @return FfmpegCommand */ seek(seek: string | number): Command; /** * @see FfmpegCommand.seek */ seekOutput(seek: string | number): Command; /** * Set output duration * * @method FfmpegCommand#duration * @category Output * @aliases withDuration,setDuration * * @param {String|Number} duration duration in seconds or as a '[[hh:]mm:]ss[.xxx]' string * @return FfmpegCommand */ duration(duration: string | number): Command; /** * @see FfmpegCommand.duration */ withDuration(duration: string | number): Command; /** * @see FfmpegCommand.duration */ setDuration(duration: string | number): Command; /** * Set output format * * @method FfmpegCommand#format * @category Output * @aliases toFormat,withOutputFormat,outputFormat * * @param {String} format output format name * @return FfmpegCommand */ format(format: string): Command; /** * @see FfmpegCommand.format */ toFormat(format: string): Command; /** * @see FfmpegCommand.format */ withOutputFormat(format: string): Command; /** * @see FfmpegCommand.format */ outputFormat(format: string): Command; /** * Add stream mapping to output * * @method FfmpegCommand#map * @category Output * * @param {String} spec stream specification string, with optional square brackets * @return FfmpegCommand */ map(spec: string): Command; /** * Run flvtool2/flvmeta on output * * @method FfmpegCommand#flvmeta * @category Output * @aliases updateFlvMetadata * * @return FfmpegCommand */ flvmeta(): Command; /** * @see FfmpegCommand.flvmeta */ updateFlvMetadata(): Command; /** * ========================= * file: ./options/custom.js * ========================= */ /** * Add custom input option(s) * * When passing a single string or an array, each string containing two * words is split (eg. inputOptions('-option value') is supported) for * compatibility reasons. This is not the case when passing more than * one argument. * * @example * command.inputOptions('option1'); * * @example * command.inputOptions('option1', 'option2'); * * @method FfmpegCommand#inputOptions * @category Custom options * @aliases addInputOption,addInputOptions,withInputOption,withInputOptions,inputOption * * @param {...String} options option string(s) * @return FfmpegCommand */ inputOptions(...options: string[]): Command; /** * Add custom input option(s) * * When passing a single string or an array, each string containing two * words is split (eg. inputOptions('-option value') is supported) for * compatibility reasons. This is not the case when passing more than * one argument. * * @example * command.inputOptions(['option1', 'option2']); * * @method FfmpegCommand#inputOptions * @category Custom options * @aliases addInputOption,addInputOptions,withInputOption,withInputOptions,inputOption * * @param {String[]} options option string array * @return FfmpegCommand */ inputOptions(options: string[]): Command; /** * @see FfmpegCommand.inputOptions */ addInputOption(...options: string[]): Command; /** * @see FfmpegCommand.inputOptions */ addInputOption(options: string[]): Command; /** * @see FfmpegCommand.inputOptions */ addInputOptions(...options: string[]): Command; /** * @see FfmpegCommand.inputOptions */ addInputOptions(options: string[]): Command; /** * @see FfmpegCommand.inputOptions */ withInputOption(...options: string[]): Command; /** * @see FfmpegCommand.inputOptions */ withInputOption(options: string[]): Command; /** * @see FfmpegCommand.inputOptions */ withInputOptions(...options: string[]): Command; /** * @see FfmpegCommand.inputOptions */ withInputOptions(options: string[]): Command; /** * @see FfmpegCommand.inputOptions */ inputOption(...options: string[]): Command; /** * @see FfmpegCommand.inputOptions */ inputOption(options: string[]): Command; /** * Add custom output option(s) * * @example * command.outputOptions('option1'); * * @example * command.outputOptions('option1', 'option2'); * * @method FfmpegCommand#outputOptions * @category Custom options * @aliases addOutputOption,addOutputOptions,addOption,addOptions,withOutputOption,withOutputOptions,withOption,withOptions,outputOption * * @param {...String} options option string(s) * @return FfmpegCommand */ outputOptions(...options: string[]): Command; /** * Add custom output option(s) * * @example * command.outputOptions(['option1', 'option2']); * * @method FfmpegCommand#outputOptions * @category Custom options * @aliases addOutputOption,addOutputOptions,addOption,addOptions,withOutputOption,withOutputOptions,withOption,withOptions,outputOption * * @param {String[]} options option string array * @return FfmpegCommand */ outputOptions(options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ addOutputOption(...options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ addOutputOption(options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ addOutputOptions(...options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ addOutputOptions(options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ addOption(...options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ addOption(options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ addOptions(...options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ addOptions(options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ withOutputOption(...options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ withOutputOption(options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ withOutputOptions(...options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ withOutputOptions(options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ withOption(...options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ withOption(options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ withOptions(...options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ withOptions(options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ outputOption(...options: string[]): Command; /** * @see FfmpegCommand.outputOptions */ outputOption(options: string[]): Command; /** * Specify a complex filtergraph * * Calling this method will override any previously set filtergraph, but you can set * as many filters as needed in one call. * * @example Overlay an image over a video (using a filtergraph string) * ffmpeg() * .input('video.avi') * .input('image.png') * .complexFilter('[0:v][1:v]overlay[out]', ['out']); * * @example Overlay an image over a video (using a filter array) * ffmpeg() * .input('video.avi') * .input('image.png') * .complexFilter([{ * filter: 'overlay', * inputs: ['0:v', '1:v'], * outputs: ['out'] * }], ['out']); * * @example Split video into RGB channels and output a 3x1 video with channels side to side * ffmpeg() * .input('video.avi') * .complexFilter([ * // Duplicate video stream 3 times into streams a, b, and c * { filter: 'split', options: '3', outputs: ['a', 'b', 'c'] }, * * // Create stream 'red' by cancelling green and blue channels from stream 'a' * { filter: 'lutrgb', options: { g: 0, b: 0 }, inputs: 'a', outputs: 'red' }, * * // Create stream 'green' by cancelling red and blue channels from stream 'b' * { filter: 'lutrgb', options: { r: 0, b: 0 }, inputs: 'b', outputs: 'green' }, * * // Create stream 'blue' by cancelling red and green channels from stream 'c' * { filter: 'lutrgb', options: { r: 0, g: 0 }, inputs: 'c', outputs: 'blue' }, * * // Pad stream 'red' to 3x width, keeping the video on the left, and name output 'padded' * { filter: 'pad', options: { w: 'iw*3', h: 'ih' }, inputs: 'red', outputs: 'padded' }, * * // Overlay 'green' onto 'padded', moving it to the center, and name output 'redgreen' * { filter: 'overlay', options: { x: 'w', y: 0 }, inputs: ['padded', 'green'], outputs: 'redgreen'}, * * // Overlay 'blue' onto 'redgreen', moving it to the right * { filter: 'overlay', options: { x: '2*w', y: 0 }, inputs: ['redgreen', 'blue']}, * ]); * * @method FfmpegCommand#complexFilter * @category Custom options * @aliases filterGraph * * @param {String|Array} spec filtergraph string or array of filter specification * objects, each having the following properties: * @param {String} spec.filter filter name * @param {String|Array} [spec.inputs] (array of) input stream specifier(s) for the filter, * defaults to ffmpeg automatically choosing the first unused matching streams * @param {String|Array} [spec.outputs] (array of) output stream specifier(s) for the filter, * defaults to ffmpeg automatically assigning the output to the output file * @param {Object|String|Array} [spec.options] filter options, can be omitted to not set any options * @param {Array} [map] (array of) stream specifier(s) from the graph to include in * ffmpeg output, defaults to ffmpeg automatically choosing the first matching streams. * @return FfmpegCommand */ complexFilter(spec: string | FilterSpecification[], map: string[]): Command; /** * @see FfmpegCommand.complexFilter */ filterGraph(spec: string | FilterSpecification[], map: string[]): Command; /** * Use preset * * @method FfmpegCommand#preset * @category Miscellaneous * @aliases usingPreset * * @param {String|Function} preset preset name or preset function * @return FfmpegCommand */ preset(preset: string | Function): Command; /** * @see FfmpegCommand.preset */ usingPreset(preset: string | Function): Command; on(event: 'codecData', listener: (data: CodecDataEventData) => any): Command; on(event: 'progress', listener: (info: ProgressEventData) => any): Command; on(event: 'end', listener: () => any): Command; on(event: 'error', listener: (error: any) => any): Command; on(event: string, listener: Function): Command; } interface CommandStatic { (options?: CommandOptions): Command; (file: string | NodeJS.ReadableStream, options?: CommandOptions): Command; new (options?: CommandOptions): Command; new (file: string | NodeJS.ReadableStream, options?: CommandOptions): Command; /** * @see (new FfmpegCommand(file)).ffprobe(callback) */ ffprobe(file, callback: (error: any, metadata: Ffprobe.Metadata) => void); /** * @see (new FfmpegCommand()).setFfmpegPath(path) */ setFfmpegPath(path: string): void; /** * @see (new FfmpegCommand()).setFfprobePath(path) */ setFfprobePath(path: string): void; /** * @see (new FfmpegCommand()).setFlvtoolPath(path) */ setFlvtoolPath(path: string): void; /** * @see (new FfmpegCommand()).availableFilters(callback) */ availableFilters(callback: Function): void; /** * @see (new FfmpegCommand()).availableFilters(callback) */ getAvailableFilters(callback: Function): void; /** * @see (new FfmpegCommand()).availableCodecs(callback) */ availableCodecs(callback: Function): void; /** * @see (new FfmpegCommand()).availableCodecs(callback) */ getAvailableCodecs(callback: Function): void; /** * @see (new FfmpegCommand()).availableFormats(callback) */ availableFormats(callback: Function): void; /** * @see (new FfmpegCommand()).availableFormats(callback) */ getAvailableFormats(callback: Function): void; } } declare module "fluent-ffmpeg" { export = ffmpeg; } declare var ffmpeg: Ffmpeg.CommandStatic;