                 @_audioGain target, callback
 
 
+class OpusConverter extends AudioConverter
+        suffix: =>
+                return "opus"
+
+        audioType: =>
+                return "audio/opus"
+
+        mimeType: =>
+                return "audio/ogg"
+
+        _audioGain: (target, callback) =>
+                callback null
+
+        convert: (source, bitrate, target, callback) =>
+                options =
+                        cwd: "/tmp/"
+                ffmpeg = child_process.spawn FFMPEG, ["-i", source, '-vn', '-acodec', 'libopus', '-ab', bitrate, '-ar', '48000', '-ac', '2', '-loglevel', 'quiet', '-y', target], options
+                ffmpeg.on 'exit', (code) =>
+                        @_conversionDone target, code, callback
+
+
 class VorbisConverter extends AudioConverter
         suffix: =>
                 return "ogg"


# 1 minute of 160 kbps music.
FAILED_CONVERSION_IS_OK_SIZE = 60 * 160 * 1000 / 8

class AudioConverter
        _conversionDone: (target, code, callback) =>

        convert: (source, bitrate, target, callback) =>
                options =
                        cwd: "/tmp/"
                ffmpeg = child_process.spawn FFMPEG, ["-i", source, '-vn', '-acodec', 'libmp3lame', '-ab', bitrate, '-y', '-ar', '48000', '-ac', '2', '-loglevel', 'quiet', target], options
                ffmpeg.on 'exit', (code) =>
                        @_conversionDone target, code, callback

