Anyone know of a reference for mapping ffmpeg format values to MIME types and recommended file extension? My google attempt failed to turn up anything.
I did manually put together a small list with guess-work and clues from Wikipedia, IANA, and the Mozilla Developer Network for the subset of formats that I encountered in my video input test collection:
ffmpeg Format Extension MIME Type
─────────────────────── ───────── ──────────────────────
asf asf application/vnd.ms-asf
avi avi video/x-msvideo
flv flv video/x-flv
matroska,webm webm video/webm
m4v m4v video/x-m4v
mov,mp4,m4a,3gp,3g2,mj2 mp4 video/mp4
mpeg mpeg video/mpeg
mpegts mpeg video/mpeg
mpegvideo mpeg video/mpeg
ogg ogv video/ogg
matroska mkv video/x-matroska
webm webm video/webm
No idea if I've made the right calls, though.
(The test files already have file extensions, but I'm operating on the assumption that the extension of a file a user uploads is irrelevant, and that the file should be renamed based on ffprobe and intelligent mapping...)
In the Connections pane, go to the site, application, or directory for which you want to add a MIME type. In the Home pane, double-click MIME Types. In the MIME Types pane, click Add... in the Actions pane. In the Add MIME Type dialog box, add the file name extension and MIME type, and then click OK.
All MIME type information is stored in a database. The MIME database is located in the directory /usr/share/mime/ . The MIME database contains a large number of common MIME types, stored in the file /usr/share/mime/packages/freedesktop.
The use of –probesize and –analyzeduration help FFMPEG to recognize the audio and video stream parameters of a file, and while they are by no means necessary, their use can help reduce input processing errors, especially when moving across codecs.
Unfortunately there doesn't seem to be a straightforward way to do this so I combined a short list of MIME types myself using multiple different methods - you can try the same approach for extensions:
https://gist.github.com/DusanBrejka/35238dccb5cefcc804de1c5a218ee004
Although this question is over 3 years old, I'm sure someone will find this useful in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With