file-type icon indicating copy to clipboard operation
file-type copied to clipboard

Ability to detect audio WebM

Open Borewit opened this issue 5 years ago • 5 comments

WebM audio file detected as:

{ 
  ext: 'webm',
  mime: 'video/webm' 
}

expected:

{ 
  ext: 'webm',
  mime: 'audio/webm' 
}

Sample file: 02 - Poxfil - Solid Ground (5 sec).opus.webm.zip

Borewit avatar Dec 19 '19 11:12 Borewit

I think we should wait to add more formats until the tokenizer branch has been merged into master.

sindresorhus avatar Dec 23 '19 10:12 sindresorhus

~~WebM is a sub format (based on the profile) of Matroska. It requires to parse the Matroska file. Given the complexity of that format, I am not sure if it belongs in the "core" of file-type. Similar to the MS-CFB (.msi, .doc) It may be better to move this into a plugin. You can use music-metadata (which I am the author of) to retrieve further information about your Matroska file. Maybe I'll write a file-type audio extension plugin using from that recipe one day. Anyway for now I will close this issue. Feel free to reply.~~

WebM detection, within EBML container has been implemented in #286.

Borewit avatar Sep 15 '20 18:09 Borewit

The sample file still gives me video/webm.

pejuam avatar Apr 11 '25 06:04 pejuam

Same here!

Received buffer with mimetype audio/webm;codecs=opus
[FYLE-FYPE] Detected MIME type: { ext: 'webm', mime: 'video/webm' }

guizzo avatar Jun 05 '25 14:06 guizzo

@pejuam, @guizzo, you are right, file-type can distinct sub-type WebM from other EBML, but indeed it cannnot distinct between 'video/webm and audio/webm.

Not sure if that distinction is feasible in file-type. Even in music-metadata I do not have an isVideo detection, as suggested here. Reason being this is not a trivial thing to implement.

Related to issue #400.

Borewit avatar Jun 05 '25 18:06 Borewit

I am working on a plugin for file-type which is able better distinct audio / video types: @file-type/av.

I covered audio and video Matroska files, not sure yet what it takes to cover similar WebM files.

Borewit avatar Jun 30 '25 15:06 Borewit