Last active
April 8, 2025 21:26
-
-
Save DusanBrejka/35238dccb5cefcc804de1c5a218ee004 to your computer and use it in GitHub Desktop.
FFMPEG - map of formats to default mime types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INCOMPLETE | |
// This command will give you list of available FFMPEG formats and their default Mime types | |
// ffmpeg -formats -hide_banner | tail -n +5 | cut -c5- | cut -d' ' -f1 | xargs -i{} ffmpeg -hide_banner -h demuxer={} | pcregrep -o2 -o4 -M '(Muxer (\w+) )|(Mime type:( .*).)' | |
// And then parse the output with regex to JSON format in JavaScript for example: | |
// str.match(/(.*)\n (.*)/gm).map(m => `"${m.replace(/\n /, '": "')}"`).join(',\n'); | |
// Combine the output with MDN - Common MIME types | |
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types | |
// And with IANA: | |
// https://www.iana.org/assignments/media-types/media-types.xhtml#video | |
// + couple of manual updates | |
const format2mime = { | |
"3dostr" : "application/vnd.pg.format", | |
"3g2" : "video/3gpp2", | |
"3gp" : "video/3gpp", | |
"4xm" : "audio/x-adpcm", | |
"a64" : "application/octet-stream ", | |
"aa" : "application/octet-stream", | |
"aac" : "audio/aac", | |
"ac3" : "audio/x-ac3", | |
"acm" : "application/octet-stream", | |
"act" : "", | |
"adf" : "", | |
"adp" : "", | |
"ads" : "", | |
"adts" : "audio/aac", | |
"adx" : "", | |
"aea" : "", | |
"afc" : "", | |
"aiff" : "audio/aiff", | |
"aix" : "", | |
"alaw" : "", | |
"alias_pix" : "", | |
"alsa" : "", | |
"amr" : "audio/amr", | |
"anm" : "", | |
"apc" : "", | |
"ape" : "", | |
"apng" : "image/png", | |
"aqtitle" : "", | |
"asf" : "video/x-ms-asf", | |
"asf_o" : "", | |
"asf_stream" : "video/x-ms-asf", | |
"ass" : "text/x-ass", | |
"ast" : "", | |
"au" : "audio/basic", | |
"avi" : "video/x-msvideo", | |
"avisynth" : "", | |
"avm2" : "application/x-shockwave-flash", | |
"avr" : "", | |
"avs" : "", | |
"bethsoftvid" : "", | |
"bfi" : "", | |
"bfstm" : "", | |
"bin" : "application/octet-stream", | |
"bink" : "", | |
"bit" : "audio/bit", | |
"bmp_pipe" : "", | |
"bmv" : "", | |
"boa" : "", | |
"brender_pix" : "", | |
"brstm" : "", | |
"c93" : "", | |
"caca" : "", | |
"caf" : "audio/x-caf", | |
"cavsvideo" : "", | |
"cdg" : "", | |
"cdxl" : "", | |
"chromaprint" : "", | |
"cine" : "", | |
"concat" : "", | |
"crc" : "", | |
"dash" : "", | |
"data" : "", | |
"daud" : "", | |
"dcstr" : "", | |
"dds_pipe" : "", | |
"dfa" : "", | |
"dirac" : "", | |
"dnxhd" : "", | |
"dpx_pipe" : "", | |
"dsf" : "", | |
"dsicin" : "", | |
"dss" : "", | |
"dts" : "audio/x-dca", | |
"dtshd" : "", | |
"dv" : "", | |
"dvbsub" : "", | |
"dvbtxt" : "", | |
"dvd" : "video/mpeg", | |
"dxa" : "", | |
"ea" : "", | |
"ea_cdata" : "", | |
"eac3" : "audio/x-eac3", | |
"epaf" : "", | |
"exr_pipe" : "", | |
"f32be" : "", | |
"f32le" : "", | |
"f4v" : "application/f4v", | |
"f64be" : "", | |
"f64le" : "", | |
"fbdev" : "", | |
"ffm" : "", | |
"ffmetadata" : "", | |
"fifo" : "", | |
"film_cpk" : "", | |
"filmstrip" : "", | |
"fits" : "", | |
"flac" : "audio/x-flac", | |
"flic" : "", | |
"flv" : "video/x-flv", | |
"framecrc" : "", | |
"framehash" : "", | |
"framemd5" : "", | |
"frm" : "", | |
"fsb" : "", | |
"g722" : "audio/G722", | |
"g723_1" : "audio/g723", | |
"g726" : "", | |
"g726le" : "", | |
"g729" : "", | |
"gdv" : "", | |
"genh" : "", | |
"gif" : "image/gif", | |
"gsm" : "audio/x-gsm", | |
"gxf" : "", | |
"h261" : "video/x-h261", | |
"h263" : "video/x-h263", | |
"h264" : "", | |
"hash" : "", | |
"hds" : "", | |
"hevc" : "", | |
"hls" : "application/x-mpegURL", | |
"hls,applehttp" : "application/x-mpegURL", | |
"hnm" : "", | |
"ico" : "image/vnd.microsoft.icon", | |
"idcin" : "", | |
"idf" : "", | |
"iec61883" : "", | |
"iff" : "", | |
"ilbc" : "audio/iLBC", | |
"image2" : "", | |
"image2pipe" : "", | |
"ingenient" : "", | |
"ipmovie" : "", | |
"ipod" : "video/mp4", | |
"ircam" : "", | |
"ismv" : "video/mp4", | |
"iss" : "", | |
"iv8" : "", | |
"ivf" : "", | |
"ivr" : "", | |
"j2k_pipe" : "", | |
"jack" : "", | |
"jacosub" : "text/x-jacosub", | |
"jpeg_pipe" : "image/jpeg", | |
"jpegls_pipe" : "image/jpeg", | |
"jv" : "", | |
"kmsgrab" : "", | |
"latm" : "audio/MP4A-LATM", | |
"lavfi" : "", | |
"libcdio" : "", | |
"libdc1394" : "", | |
"libgme" : "", | |
"libopenmpt" : "", | |
"live_flv" : "video/x-flv", | |
"lmlm4" : "", | |
"loas" : "", | |
"lrc" : "", | |
"lvf" : "", | |
"lxf" : "", | |
"m4v" : "video/x-m4v", | |
"matroska" : "video/x-matroska", | |
"matroska,webm" : "video/webm", | |
"md5" : "", | |
"mgsts" : "", | |
"microdvd" : "text/x-microdvd", | |
"mjpeg" : "video/x-mjpeg", | |
"mjpeg_2000" : "video/x-mjpeg", | |
"mkvtimestamp_v2" : "", | |
"mlp" : "", | |
"mlv" : "", | |
"mm" : "", | |
"mmf" : "application/vnd.smaf", | |
"mov" : "", | |
"mov,mp4,m4a,3gp,3g2,mj2" : "video/mp4", | |
"mp2" : "audio/mpeg", | |
"mp3" : "audio/mpeg", | |
"mp4" : "video/mp4", | |
"mpc" : "", | |
"mpc8" : "", | |
"mpeg" : "video/mpeg", | |
"mpeg1video" : "video/mpeg", | |
"mpeg2video" : "video/mpeg", | |
"mpegts" : "video/MP2T", | |
"mpegtsraw" : "video/MP2T", | |
"mpegvideo" : "video/mpeg", | |
"mpjpeg" : "multipart/x-mixed-replace;boundary=ffserver", | |
"mpl2" : "", | |
"mpsub" : "", | |
"msf" : "", | |
"msnwctcp" : "", | |
"mtaf" : "", | |
"mtv" : "", | |
"mulaw" : "", | |
"musx" : "", | |
"mv" : "", | |
"mvi" : "", | |
"mxf" : "application/mxf", | |
"mxf_d10" : "application/mxf", | |
"mxf_opatom" : "application/mxf", | |
"mxg" : "", | |
"nc" : "", | |
"nistsphere" : "", | |
"nsv" : "", | |
"null" : "", | |
"nut" : "video/x-nut", | |
"nuv" : "", | |
"oga" : "audio/ogg", | |
"ogg" : "application/ogg", | |
"ogv" : "video/ogg", | |
"oma" : "audio/x-oma", | |
"openal" : "", | |
"opengl" : "", | |
"opus" : "audio/ogg", | |
"oss" : "", | |
"paf" : "", | |
"pam_pipe" : "", | |
"pbm_pipe" : "", | |
"pcx_pipe" : "", | |
"pgm_pipe" : "", | |
"pgmyuv_pipe" : "", | |
"pictor_pipe" : "", | |
"pjs" : "", | |
"pmp" : "", | |
"png_pipe" : "", | |
"ppm_pipe" : "", | |
"psd_pipe" : "", | |
"psp" : "", | |
"psxstr" : "", | |
"pulse" : "", | |
"pva" : "", | |
"pvf" : "", | |
"qcp" : "", | |
"qdraw_pipe" : "", | |
"r3d" : "", | |
"rawvideo" : "", | |
"realtext" : "", | |
"redspark" : "", | |
"rl2" : "", | |
"rm" : "application/vnd.rn-realmedia", | |
"roq" : "", | |
"rpl" : "", | |
"rsd" : "", | |
"rso" : "", | |
"rtp" : "", | |
"rtp_mpegts" : "", | |
"rtsp" : "", | |
"s16be" : "", | |
"s16le" : "", | |
"s24be" : "", | |
"s24le" : "", | |
"s32be" : "", | |
"s32le" : "", | |
"s337m" : "", | |
"s8" : "", | |
"sami" : "", | |
"sap" : "", | |
"sbg" : "", | |
"scc" : "", | |
"sdl,sdl2" : "", | |
"sdp" : "", | |
"sdr2" : "", | |
"sds" : "", | |
"sdx" : "", | |
"segment" : "", | |
"sgi_pipe" : "", | |
"shn" : "", | |
"siff" : "", | |
"singlejpeg" : "image/jpeg", | |
"sln" : "", | |
"smjpeg" : "image/jpeg", | |
"smk" : "", | |
"smoothstreaming" : "", | |
"smush" : "", | |
"sndio" : "", | |
"sol" : "", | |
"sox" : "", | |
"spdif" : "", | |
"spx" : "audio/ogg", | |
"srt" : "application/x-subrip", | |
"stl" : "", | |
"stream_segment,ssegment" : "", | |
"subviewer" : "", | |
"subviewer1" : "", | |
"sunrast_pipe" : "", | |
"sup" : "application/x-pgs", | |
"svag" : "", | |
"svcd" : "video/mpeg", | |
"svg_pipe" : "", | |
"swf" : "application/x-shockwave-flash", | |
"tak" : "", | |
"tedcaptions" : "", | |
"tee" : "", | |
"thp" : "", | |
"tiertexseq" : "", | |
"tiff_pipe" : "", | |
"tmv" : "", | |
"truehd" : "", | |
"tta" : "audio/x-tta", | |
"tty" : "", | |
"txd" : "", | |
"u16be" : "", | |
"u16le" : "", | |
"u24be" : "", | |
"u24le" : "", | |
"u32be" : "", | |
"u32le" : "", | |
"u8" : "", | |
"uncodedframecrc" : "", | |
"v210" : "", | |
"v210x" : "", | |
"v4l2" : "", | |
"vag" : "", | |
"vc1" : "", | |
"vc1test" : "", | |
"vcd" : "video/mpeg", | |
"video4linux2,v4l2" : "", | |
"vivo" : "", | |
"vmd" : "", | |
"vob" : "video/mpeg", | |
"vobsub" : "", | |
"voc" : "audio/x-voc", | |
"vpk" : "", | |
"vplayer" : "", | |
"vqf" : "", | |
"w64" : "", | |
"wav" : "audio/x-wav", | |
"wc3movie" : "", | |
"webm" : "video/webm", | |
"webm_chunk" : "video/webm", | |
"webm_dash_manifest" : "application/xml", | |
"webp" : "image/webp", | |
"webp_pipe" : "", | |
"webvtt" : "text/vtt", | |
"wsaud" : "", | |
"wsd" : "", | |
"wsvqa" : "", | |
"wtv" : "", | |
"wv" : "audio/x-wavpack", | |
"wve" : "", | |
"x11grab" : "", | |
"xa" : "", | |
"xbin" : "", | |
"xmv" : "", | |
"xpm_pipe" : "", | |
"xv" : "", | |
"xvag" : "", | |
"xwma" : "", | |
"yop" : "" | |
}; | |
// use this to filter out empty keys: | |
Object.fromEntries = arr => Object.assign({}, ...Array.from(arr, ([k, v]) => ({[k]: v}) )); | |
Object.fromEntries( Object.keys(format2mime).filter(k => format2mime[k]).map(k => [k, format2mime[k]]) ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"3dostr" : "application/vnd.pg.format", | |
"3g2" : "video/3gpp2", | |
"3gp" : "video/3gpp", | |
"4xm" : "audio/x-adpcm", | |
"a64" : "application/octet-stream ", | |
"aa" : "application/octet-stream", | |
"aac" : "audio/aac", | |
"ac3" : "audio/x-ac3", | |
"acm" : "application/octet-stream", | |
"adts" : "audio/aac", | |
"aiff" : "audio/aiff", | |
"amr" : "audio/amr", | |
"apng" : "image/png", | |
"asf" : "video/x-ms-asf", | |
"asf_stream" : "video/x-ms-asf", | |
"ass" : "text/x-ass", | |
"au" : "audio/basic", | |
"avi" : "video/x-msvideo", | |
"avm2" : "application/x-shockwave-flash", | |
"bin" : "application/octet-stream", | |
"bit" : "audio/bit", | |
"caf" : "audio/x-caf", | |
"dts" : "audio/x-dca", | |
"dvd" : "video/mpeg", | |
"eac3" : "audio/x-eac3", | |
"f4v" : "application/f4v", | |
"flac" : "audio/x-flac", | |
"flv" : "video/x-flv", | |
"g722" : "audio/G722", | |
"g723_1" : "audio/g723", | |
"gif" : "image/gif", | |
"gsm" : "audio/x-gsm", | |
"h261" : "video/x-h261", | |
"h263" : "video/x-h263", | |
"hls" : "application/x-mpegURL", | |
"hls,applehttp" : "application/x-mpegURL", | |
"ico" : "image/vnd.microsoft.icon", | |
"ilbc" : "audio/iLBC", | |
"ipod" : "video/mp4", | |
"ismv" : "video/mp4", | |
"jacosub" : "text/x-jacosub", | |
"jpeg_pipe" : "image/jpeg", | |
"jpegls_pipe" : "image/jpeg", | |
"latm" : "audio/MP4A-LATM", | |
"live_flv" : "video/x-flv", | |
"m4v" : "video/x-m4v", | |
"matroska" : "video/x-matroska", | |
"matroska,webm" : "video/webm", | |
"microdvd" : "text/x-microdvd", | |
"mjpeg" : "video/x-mjpeg", | |
"mjpeg_2000" : "video/x-mjpeg", | |
"mmf" : "application/vnd.smaf", | |
"mov,mp4,m4a,3gp,3g2,mj2" : "video/mp4", | |
"mp2" : "audio/mpeg", | |
"mp3" : "audio/mpeg", | |
"mp4" : "video/mp4", | |
"mpeg" : "video/mpeg", | |
"mpeg1video" : "video/mpeg", | |
"mpeg2video" : "video/mpeg", | |
"mpegts" : "video/MP2T", | |
"mpegtsraw" : "video/MP2T", | |
"mpegvideo" : "video/mpeg", | |
"mpjpeg" : "multipart/x-mixed-replace;boundary=ffserver", | |
"mxf" : "application/mxf", | |
"mxf_d10" : "application/mxf", | |
"mxf_opatom" : "application/mxf", | |
"nut" : "video/x-nut", | |
"oga" : "audio/ogg", | |
"ogg" : "application/ogg", | |
"ogv" : "video/ogg", | |
"oma" : "audio/x-oma", | |
"opus" : "audio/ogg", | |
"rm" : "application/vnd.rn-realmedia", | |
"singlejpeg" : "image/jpeg", | |
"smjpeg" : "image/jpeg", | |
"spx" : "audio/ogg", | |
"srt" : "application/x-subrip", | |
"sup" : "application/x-pgs", | |
"svcd" : "video/mpeg", | |
"swf" : "application/x-shockwave-flash", | |
"tta" : "audio/x-tta", | |
"vcd" : "video/mpeg", | |
"vob" : "video/mpeg", | |
"voc" : "audio/x-voc", | |
"wav" : "audio/x-wav", | |
"webm" : "video/webm", | |
"webm_chunk" : "video/webm", | |
"webm_dash_manifest" : "application/xml", | |
"webp" : "image/webp", | |
"webvtt" : "text/vtt", | |
"wv" : "audio/x-wavpack" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment