[FFmpeg-devel] [PATCH 4/4] avformat: add an Ogg Video muxer

James Almer jamrial at gmail.com
Thu Jul 7 02:25:27 EEST 2016


RFC 5334 recommendens this extension to go alongside the video/ogg
mimetype for video files, with or without audio and subtitles [1].

[1] https://tools.ietf.org/html/rfc5334#section-10.2

Signed-off-by: James Almer <jamrial at gmail.com>
---
TODO: Version bump and changelog entry.

 configure                |  1 +
 libavformat/allformats.c |  1 +
 libavformat/oggenc.c     | 21 ++++++++++++++++++++-
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 126d0d6..14dde90 100755
--- a/configure
+++ b/configure
@@ -2854,6 +2854,7 @@ nut_muxer_select="riffenc"
 nuv_demuxer_select="riffdec"
 oga_muxer_select="ogg_muxer"
 ogg_demuxer_select="dirac_parse"
+ogv_muxer_select="ogg_muxer"
 opus_muxer_select="ogg_muxer"
 psp_muxer_select="mov_muxer"
 rtp_demuxer_select="sdp_demuxer"
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index d490cc4..418dfff 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -225,6 +225,7 @@ void av_register_all(void)
     REGISTER_DEMUXER (NUV,              nuv);
     REGISTER_MUXER   (OGA,              oga);
     REGISTER_MUXDEMUX(OGG,              ogg);
+    REGISTER_MUXER   (OGV,              ogv);
     REGISTER_MUXDEMUX(OMA,              oma);
     REGISTER_MUXER   (OPUS,             opus);
     REGISTER_DEMUXER (PAF,              paf);
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 2dcab15..1acde18 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -660,7 +660,7 @@ AVOutputFormat ff_ogg_muxer = {
     .name              = "ogg",
     .long_name         = NULL_IF_CONFIG_SMALL("Ogg"),
     .mime_type         = "audio/ogg",
-    .extensions        = "ogg,ogv"
+    .extensions        = "ogg"
 #if !CONFIG_SPX_MUXER
                          ",spx"
 #endif
@@ -695,6 +695,25 @@ AVOutputFormat ff_oga_muxer = {
 };
 #endif
 
+#if CONFIG_OGV_MUXER
+OGG_CLASS(ogv, Ogg video)
+AVOutputFormat ff_ogv_muxer = {
+    .name              = "ogv",
+    .long_name         = NULL_IF_CONFIG_SMALL("Ogg Video"),
+    .mime_type         = "video/ogg",
+    .extensions        = "ogv",
+    .priv_data_size    = sizeof(OGGContext),
+    .audio_codec       = CONFIG_LIBVORBIS_ENCODER ?
+                         AV_CODEC_ID_VORBIS : AV_CODEC_ID_FLAC,
+    .video_codec       = AV_CODEC_ID_THEORA,
+    .write_header      = ogg_write_header,
+    .write_packet      = ogg_write_packet,
+    .write_trailer     = ogg_write_trailer,
+    .flags             = AVFMT_TS_NEGATIVE | AVFMT_ALLOW_FLUSH,
+    .priv_class        = &ogv_muxer_class,
+};
+#endif
+
 #if CONFIG_SPX_MUXER
 OGG_CLASS(spx, Ogg Speex)
 AVOutputFormat ff_spx_muxer = {
-- 
2.9.0



More information about the ffmpeg-devel mailing list