[FFmpeg-devel] [PATCH]Add Opus and Speex muxer

James Almer jamrial at gmail.com
Sat Nov 30 01:47:14 CET 2013


On 29/11/13 9:09 PM, Carl Eugen Hoyos wrote:
> HI!
> 
> Attached patch - mostly untested - tries to address ticket #3181
> 
> Please comment, Carl Eugen

This is a good chance to address some issues regarding the muxer mimetypes.
Refer to http://tools.ietf.org/html/rfc5334 where the Media Types got 
redefined.

We're wrongly setting the mime type for every Ogg file as "application/ogg" 
when in all cases it should be either "video/ogg" and "audio/ogg".
We shouldn't use application/ogg at all since it requires a Skeleton header 
and our muxer lacks the implementation.

tl;dr from the rfc:

"application/ogg" *must* have a Skeleton stream and only be used with complex 
files (Several video, audio, subtitles streams or such). The extension 
should be .ogx

"video/ogg" doesn't require a Skeleton header but it's recommended. It should 
be for files with video streams that don't warrant being served as 
application/ogg (For example a single video, audio and subtitle streams).
The recommended extension is .ogv

"audio/ogg" doesn't require a Skeleton header but it's recommended. It should
only be used for audio only files (Vorbis, Speex, Opus, etc). The recommended 
extensions are .ogg for Vorbis, .opus for Opus, .spx for Speex, and .oga for 
anything else (FLAC, PCM, etc).

No matter how we approach this, the current ff_ogg_muxer will be affected.
One option is to make ff_ogg_muxer the Vorbis exclusive muxer, then adding 
ff_oga_muxer and Opus/Speex as in this patch (All these with "audio/ogg" 
mimetype), and finally ff_ogv_muxer with "video/ogg".

Some comments for this patch regardless of what we do with all the stuff above.

> +#if CONFIG_SPEEX_MUXER
> +AVOutputFormat ff_speex_muxer = {
> +    .name              = "speex",
> +    .long_name         = NULL_IF_CONFIG_SMALL("Speex"),
> +    .mime_type         = "application/ogg",

This needs to be changed to "audio/ogg".

> +    .extensions        = "spx",
> +    .priv_data_size    = sizeof(OGGContext),
> +    .audio_codec       = AV_CODEC_ID_SPEEX,

.video_codec = AV_CODEC_ID_NONE,

> +    .write_header      = ogg_write_header,
> +    .write_packet      = ogg_write_packet,
> +    .write_trailer     = ogg_write_trailer,
> +    .flags             = AVFMT_TS_NEGATIVE,
> +    .priv_class        = &ogg_muxer_class,
> +};
> +#endif

Same for Opus.

Also, you should add relevant _select lines to configure so the Opus and Speex 
muxers get enabled when the existing ogg muxer is enabled. Otherwise any build 
that does something like "--disable-everything --enable-muxer=ogg" alone will 
have trouble muxing opus and spx files even though the necessary code is all 
present.

Regards.


More information about the ffmpeg-devel mailing list