python / cpython

The Python programming language
https://www.python.org/
Other
60.9k stars 29.4k forks source link

.ass files give incorrect MIME types #120258

Open rcombs opened 1 month ago

rcombs commented 1 month ago

Bug report

Bug description:

Advanced SubStation is a common subtitle format, with file usually having the extension .ass, and the .ass extension is not commonly used for AAC audio files. However, mimetypes currently gives audio/aac as the type for .ass files:

mimetypes.guess_type('test.ass') # -> ('audio/aac', None)

This appears to be due to this erroneous line: https://github.com/python/cpython/blob/4fc82b6d3b99f873179937215833e7a573ca7876/Lib/mimetypes.py#L534

CPython versions tested on:

3.12

Operating systems tested on:

macOS

Linked PRs

ericvsmith commented 4 weeks ago

Are you sure .ass isn't also used for AAC files? It's possible for a single extension to be used by more than one mime type. I'd be hesitant to change it.

barneygale commented 4 weeks ago

.ass is also used for Arnold scene descriptions: https://help.autodesk.com/view/ARNOL/ENU/?guid=arnold_user_guide_ac_scene_source_html

rcombs commented 4 weeks ago

I've been doing work in A/V across consumer and professional spaces for over a decade, from open-source to commercial software, and I've never seen .ass used as an extension for an AAC file; raw AAC bitstreams are fairly uncommon to begin with, and LOAS/LATM is essentially only seen in broadcast (where it's encapsulated in an MPEG-2 transport stream). Meanwhile, .ass is one of the most common text subtitle formats in current usage (along with WebVTT, TTML, and SRT).

tirkarthi commented 3 weeks ago

This was added in https://github.com/python/cpython/pull/24287 . As noted in the description this looks like an IANA recognized usage.

https://www.iana.org/assignments/media-types/audio/aac

File extension(s): .adts or .aac (ADTS), .loas or .ass (LATM/LOAS)