17

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?

Brian FitzGerald
  • 3,041
  • 3
  • 28
  • 38

1 Answers1

14

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).

Community
  • 1
  • 1
  • Thanks. And how might I generate a .webm audio file? Any thoughts on that? – Brian FitzGerald Jun 14 '16 at 20:23
  • @BrianFitzGerald I added a paragraph about it, but the support for webm is currently rare am I afraid. :-/ Typically you would use OGG for audio as these use the same Vorbis encoder and OGG has better support. –  Jun 14 '16 at 20:26
  • 1
    As K3N said, it's a LOT more common to use the .OGG container format for Opus-codec audio. – cwilso Jun 14 '16 at 20:49
  • 2
    Thanks guys. Part of what .WebM into my mind for audio were the recommendations of the creator of the HowlerJs library, who recommends .WebM as the primary format. I'm dealing with timing/sync issues with certain mp3 files and trying to see if the same issues occur with WebM. https://github.com/goldfire/howler.js/tree/2.0#format-recommendations – Brian FitzGerald Jun 15 '16 at 00:04