Skip to content
2 changes: 2 additions & 0 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@ mimetypes
* Valid extensions start with a '.' or are empty for
:meth:`mimetypes.MimeTypes.add_type`.
Undotted extensions now raise a :exc:`ValueError`.
* Add more MIME types.
(Contributed by Charlie Lin in :gh:`146341`.)

shutil
------
Expand Down
11 changes: 11 additions & 0 deletions Lib/mimetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,13 @@ def _default_mime_types():
'.sgml' : 'text/x-sgml',
'.vcf' : 'text/x-vcard',
'.xml' : 'text/xml',
'.3gp' : 'video/3gpp',
'.3g2' : 'video/3gpp2',
Comment on lines +684 to +685

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have these earlier in the dict:

        '.3gp'    : 'audio/3gpp',
...
        '.3g2'    : 'audio/3gpp2',

So these new video ones overwrite the audio ones.

Should we change it to the video ones, and remove the audio?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, they're both official MIME types: iana.org/assignments/media-types/audio/3gpp and iana.org/assignments/media-types/video/3gpp. The only major difference as far as I can tell is that the former cannot contain any visual data

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, per the official 3GPP TS 26.244 V19.1.0 Specification:

The type "video/3gpp" is valid for all files. It is valid to serve an audio-only file as "video/3gpp".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, remove the audio

'.m4s' : 'video/iso.segment',
'.lot' : 'video/lottie+json',
'.mkv' : 'video/matroska',
'.mk3d' : 'video/matroska-3d',
'.mj2' : 'video/mj2',
'.mp4' : 'video/mp4',
'.mpeg' : 'video/mpeg',
'.m1v' : 'video/mpeg',
Expand All @@ -692,6 +697,12 @@ def _default_mime_types():
'.ogv' : 'video/ogg',
'.mov' : 'video/quicktime',
'.qt' : 'video/quicktime',
'.pyv' : 'video/vnd.ms-playready.media.pyv',
'.bik' : 'video/vnd.radgamettools.bink',
'.bk2' : 'video/vnd.radgamettools.bink',
'.sswf' : 'video/vnd.sealed.swf',
'.ssw' : 'video/vnd.sealed.swf',
'.yt' : 'video/vnd.youtube.yt',
'.webm' : 'video/webm',
'.avi' : 'video/vnd.avi',
'.m4v' : 'video/x-m4v',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Add the following MIME types corresponding to file extensions:

``.3gp`` for ``video/3gpp``
``.3g2`` for ``video/3gpp2``
``.m4s`` for ``video/iso.segment``
``.lot`` for ``video/lottie+json``
``.mj2`` for ``video/mj2``
``.pyv`` for ``video/vnd.ms-playready.media.pyv``
``.blk`` and ``.bk2`` for ``video/vnd.radgamettools.bink``
``.sswf`` and ``.ssw`` for ``video/vnd.sealed.swf``
``.yt`` for ``video/vnd.youtube.yt``

(Contributed by Charlie Lin in :gh:`146342`.)
Loading