Is WebM for audio too, or just video?

Brian FitzGerald picture Brian FitzGerald · Jun 14, 2016 · Viewed 12.5k times · Source

I've seen mentions of WebM being used for audio, but reading the WebM Project site and googling convert mp3 to webm has led me to believe that WebM is just for video. I definitely see lots of WebM to mp3 conversion utilities, but not the reverse.

I can see it's definitely used for video, but how about audio? If it is intended for audio files too, how do I generate a WebM file?

Answer

user1693593 picture user1693593 · Jun 14, 2016

WebM is just a container format and can contain both video and audio:

WebM is a digital multimedia container file format promoted by the open-source WebM Project. It comprises a subset of the Matroska multimedia container format.

It can be used for audio-only purposes as well as long as the audio is encoded as Vorbis or Opus. Just specify correct mime-type (ibid.):

Audio-only files SHOULD have a mime of “audio/webm”

To generate such a file a suitable software that support the webm container and its supported codecs has to be used. Unfortunately, support for it can be hard to come by. Typically the OGG container is used when you want to encode audio using the Opus codec as it has much broader support, which may explain the lack of support of webm for audio (as of this being written).

Update: One route to WebM is to use FFMpeg (see this answer), just ignore the video options (-vn).