From 1c9e67fc3201e0e5dee91e8981adf34daaabf33a Mon Sep 17 00:00:00 2001 From: C4illin Date: Sat, 28 Sep 2024 13:02:17 +0200 Subject: [PATCH] fix: support .awb and clean up, fixes #153, #92 --- src/converters/ffmpeg.ts | 223 ++++++++------------------------------- 1 file changed, 42 insertions(+), 181 deletions(-) diff --git a/src/converters/ffmpeg.ts b/src/converters/ffmpeg.ts index ae2660f..d99d2a7 100644 --- a/src/converters/ffmpeg.ts +++ b/src/converters/ffmpeg.ts @@ -6,6 +6,7 @@ export const properties = { muxer: [ "264", "265", + "266", "302", "3dostr", "3g2", @@ -18,6 +19,7 @@ export const properties = { "aac", "aax", "ac3", + "ac4", "ace", "acm", "act", @@ -48,7 +50,6 @@ export const properties = { "apng", "aptx", "aptxhd", - "aptx_hd", "aqt", "aqtitle", "argo_asf", @@ -63,10 +64,12 @@ export const properties = { "av1", "avc", "avi", + "avif", "avr", "avs", "avs2", "avs3", + "awb", "bcstm", "bethsoftvid", "bfi", @@ -75,8 +78,9 @@ export const properties = { "bink", "binka", "bit", - "bmp_pipe", + "bitpacked", "bmv", + "bonk", "boa", "brender_pix", "brstm", @@ -93,7 +97,7 @@ export const properties = { "codec2", "codec2raw", "concat", - "cri_pipe", + "cri", "dash", "dat", "data", @@ -101,8 +105,9 @@ export const properties = { "dav", "dbm", "dcstr", - "dds_pipe", + "dds", "derf", + "dfpwm", "dfa", "dhav", "dif", @@ -131,6 +136,8 @@ export const properties = { "exr_pipe", "f32be", "f32le", + "ec3", + "evc", "f4v", "f64be", "f64le", @@ -157,13 +164,13 @@ export const properties = { "gdv", "genh", "gif", - "gif_pipe", "gsm", "gxf", "h261", "h263", "h264", "h265", + "h266", "h26l", "hca", "hcom", @@ -180,7 +187,6 @@ export const properties = { "ifv", "ilbc", "image2", - "image2pipe", "imf", "imx", "ingenient", @@ -197,21 +203,14 @@ export const properties = { "ivr", "j2b", "j2k", - "j2k_pipe", "jack", "jacosub", - "jpegls_pipe", - "jpeg_pipe", "jv", - "kmsgrab", + "jxl", "kux", "kvag", "lavfi", - "libcdio", - "libdc1394", - "libgme", - "libopenmpt", - "live_flv", + "laf", "lmlm4", "loas", "lrc", @@ -224,16 +223,13 @@ export const properties = { "m4b", "m4v", "mac", - "matroska", "mca", "mcc", "mdl", "med", - "mgsts", "microdvd", "mj2", "mjpeg", - "mjpeg_2000", "mjpg", "mk3d", "mka", @@ -257,9 +253,6 @@ export const properties = { "mpc", "mpc8", "mpeg", - "mpegts", - "mpegtsraw", - "mpegvideo", "mpg", "mpjpeg", "mpl2", @@ -296,26 +289,15 @@ export const properties = { "omg", "openal", "oss", + "osq", "paf", - "pam_pipe", - "pbm_pipe", - "pcx_pipe", - "pgmyuv_pipe", - "pgm_pipe", - "pgx_pipe", - "photocd_pipe", - "pictor_pipe", + "pdv", "pjs", "plm", "pmp", - "png_pipe", "ppm", - "ppm_pipe", - "pp_bnk", - "psd_pipe", "psm", "psp", - "psxstr", "pt36", "ptm", "pulse", @@ -323,7 +305,6 @@ export const properties = { "pvf", "qcif", "qcp", - "qdraw_pipe", "r3d", "rawvideo", "rco", @@ -335,6 +316,7 @@ export const properties = { "rm", "roq", "rpl", + "rka", "rsd", "rso", "rt", @@ -355,6 +337,7 @@ export const properties = { "sbc", "sbg", "scc", + "sdns", "sdp", "sdr2", "sds", @@ -364,10 +347,8 @@ export const properties = { "sfx", "sfx2", "sga", - "sgi_pipe", "shn", "siff", - "simbiosis_imx", "sln", "smi", "smjpeg", @@ -389,12 +370,8 @@ export const properties = { "stp", "str", "sub", - "subviewer", - "subviewer1", - "sunrast_pipe", "sup", "svag", - "svg_pipe", "svs", "sw", "swf", @@ -404,7 +381,6 @@ export const properties = { "thd", "thp", "tiertexseq", - "tiff_pipe", "tmv", "truehd", "tta", @@ -424,6 +400,7 @@ export const properties = { "ul", "ult", "umx", + "usm", "uw", "v", "v210", @@ -447,12 +424,13 @@ export const properties = { "vql", "vt", "vtt", + "vvc", "w64", + "wa", "wav", + "way", "wc3movie", "webm", - "webm_dash_manifest", - "webp_pipe", "webvtt", "wow", "wsaud", @@ -464,32 +442,31 @@ export const properties = { "x11grab", "xa", "xbin", - "xbm_pipe", "xl", "xm", + "xmd", "xmv", "xpk", - "xpm_pipe", "xvag", - "xwd_pipe", "xwma", "y4m", "yop", "yuv", "yuv10", - "yuv4mpegpipe", ], }, to: { muxer: [ "264", "265", + "266", "302", "3g2", "3gp", "a64", "aac", "ac3", + "ac4", "adts", "adx", "afc", @@ -497,43 +474,31 @@ export const properties = { "aifc", "aiff", "al", - "alaw", - "alp", - "alsa", "amr", "amv", "apm", "apng", "aptx", "aptxhd", - "aptx_hd", - "argo_asf", "asf", - "asf_stream", "ass", "ast", "au", + "aud", "avi", - "avm2", + "avif", "avs", "avs2", + "avs3", "bit", "bmp", "c2", - "caca", "caf", "cavs", - "cavsvideo", "chk", - "chromaprint", - "codec2", - "codec2raw", "cpk", - "crc", - "dash", - "data", - "daud", - "dirac", + "cvg", + "dfpwm", "dnxhd", "dnxhr", "dpx", @@ -542,30 +507,16 @@ export const properties = { "dv", "dvd", "eac3", + "ec3", + "evc", "exr", - "f32be", - "f32le", "f4v", - "f64be", - "f64le", - "fbdev", "ffmeta", - "ffmetadata", - "fifo", - "fifo_test", - "filmstrip", - "film_cpk", "fits", "flac", "flm", "flv", - "framecrc", - "framehash", - "framemd5", "g722", - "g723_1", - "g726", - "g726le", "gif", "gsm", "gxf", @@ -573,32 +524,26 @@ export const properties = { "h263", "h264", "h265", - "hash", - "hds", + "h266", + "hdr", "hevc", - "hls", "ico", - "ilbc", "im1", "im24", "im8", - "image2", - "image2pipe", - "ipod", "ircam", "isma", "ismv", "ivf", "j2c", "j2k", - "jacosub", "jls", "jp2", "jpeg", "jpg", "js", "jss", - "kvag", + "jxl", "latm", "lbc", "ljpg", @@ -613,13 +558,9 @@ export const properties = { "m4a", "m4b", "m4v", - "matroska", - "md5", - "microdvd", "mjpeg", "mjpg", "mkv", - "mkvtimestamp_v2", "mlp", "mmf", "mov", @@ -629,26 +570,17 @@ export const properties = { "mpa", "mpd", "mpeg", - "mpeg1video", - "mpeg2video", - "mpegts", "mpg", - "mpjpeg", "msbc", "mts", - "mulaw", "mxf", - "mxf_d10", - "mxf_opatom", - "null", "nut", + "obu", "oga", "ogg", "ogv", "oma", - "opengl", "opus", - "oss", "pam", "pbm", "pcm", @@ -656,14 +588,14 @@ export const properties = { "pfm", "pgm", "pgmyuv", + "phm", "pix", "png", "ppm", "psp", - "pulse", + "qoi", "ra", "ras", - "rawvideo", "rco", "rcv", "rgb", @@ -671,84 +603,47 @@ export const properties = { "roq", "rs", "rso", - "rtp", - "rtp_mpegts", - "rtsp", - "s16be", - "s16le", - "s24be", - "s24le", - "s32be", - "s32le", - "s8", - "sap", "sb", "sbc", "scc", - "sdl", - "sdl2", - "segment", "sf", "sgi", - "singlejpeg", - "smjpeg", - "smoothstreaming", - "sndio", "sox", "spdif", "spx", "srt", "ssa", - "ssegment", - "streamhash", - "stream_segment", "sub", "sun", "sunras", "sup", - "svcd", "sw", "swf", "tco", - "tee", "tga", "thd", "tif", "tiff", - "truehd", "ts", "tta", "ttml", "tun", - "u16be", - "u16le", - "u24be", - "u24le", - "u32be", - "u32le", - "u8", "ub", "ul", - "uncodedframecrc", "uw", - "v4l2", "vag", + "vbn", "vc1", - "vc1test", "vc2", - "vcd", - "vidc", - "video4linux2", "vob", "voc", "vtt", + "vvc", "w64", "wav", + "wbmp", "webm", - "webm_chunk", - "webm_dash_manifest", "webp", - "webvtt", "wma", "wmv", "wtv", @@ -756,12 +651,10 @@ export const properties = { "xbm", "xface", "xml", - "xv", "xwd", "y", "y4m", "yuv", - "yuv4mpegpipe", ], }, }; @@ -774,38 +667,6 @@ export async function convert( // biome-ignore lint/suspicious/noExplicitAny: options?: any, ): Promise { - // let command = "ffmpeg"; - - // these are containers that can contain multiple formats - // const autoDetect = [ - // "mp4", - // "mkv", - // "avi", - // "mov", - // "m4a", - // "3gp", - // "3g2", - // "mj2", - // "psp", - // "m4b", - // "ism", - // "ismv", - // "isma", - // "f4v", - // ]; - - // if (!(fileType in autoDetect)) { - // command += ` -f "${fileType}"`; - // } - - // command += ` -i "${filePath}"`; - - // if (!(convertTo in autoDetect)) { - // command += ` -f "${convertTo}"`; - // } - - // command += ` "${targetPath}"`; - const command = `ffmpeg -i "${filePath}" "${targetPath}"`; return new Promise((resolve, reject) => { @@ -825,4 +686,4 @@ export async function convert( resolve("success"); }); }); -} +} \ No newline at end of file