[FFmpeg-devel] [PATCH] avforma: add an AV1 Low overhead bitstream format muxer

James Almer jamrial at gmail.com
Fri Aug 27 22:34:42 EEST 2021


Suggested-by: BBB
Signed-off-by: James Almer <jamrial at gmail.com>
---
 Changelog                 |  1 +
 configure                 |  1 +
 doc/general_contents.texi |  1 +
 libavformat/Makefile      |  1 +
 libavformat/allformats.c  |  1 +
 libavformat/rawenc.c      | 20 ++++++++++++++++++++
 libavformat/version.h     |  4 ++--
 7 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 20d71bed88..a306848ec6 100644
--- a/Changelog
+++ b/Changelog
@@ -12,6 +12,7 @@ version <next>:
 - audio and video segment filters
 - Apple Graphics (SMC) encoder
 - hsvkey and hsvhold video filters
+- AV1 Low overhead bitstream format muxer
 
 
 version 4.4:
diff --git a/configure b/configure
index 9249254b70..af410a9d11 100755
--- a/configure
+++ b/configure
@@ -3388,6 +3388,7 @@ mxf_opatom_muxer_select="mxf_muxer"
 nut_muxer_select="riffenc"
 nuv_demuxer_select="riffdec"
 obu_demuxer_select="av1_frame_merge_bsf av1_parser"
+obu_muxer_select="av1_metadata_bsf"
 oga_muxer_select="ogg_muxer"
 ogg_demuxer_select="dirac_parse"
 ogv_muxer_select="ogg_muxer"
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index edc047e539..ce5fd4639d 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -599,6 +599,7 @@ library:
 @item raw NULL                  @tab X @tab
 @item raw video                 @tab X @tab X
 @item raw id RoQ                @tab X @tab
+ at item raw OBU                   @tab X @tab X
 @item raw SBC                   @tab X @tab X
 @item raw Shorten               @tab   @tab X
 @item raw TAK                   @tab   @tab X
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 7e0f587b41..f7e47563da 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -379,6 +379,7 @@ OBJS-$(CONFIG_NUT_MUXER)                 += nutenc.o nut.o
 OBJS-$(CONFIG_NUV_DEMUXER)               += nuv.o
 OBJS-$(CONFIG_AV1_DEMUXER)               += av1dec.o
 OBJS-$(CONFIG_OBU_DEMUXER)               += av1dec.o
+OBJS-$(CONFIG_OBU_MUXER)                 += rawenc.o
 OBJS-$(CONFIG_OGG_DEMUXER)               += oggdec.o         \
                                             oggparsecelt.o   \
                                             oggparsedirac.o  \
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 111ca3cbf0..5471f7c16f 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -305,6 +305,7 @@ extern const AVInputFormat  ff_nut_demuxer;
 extern const AVOutputFormat ff_nut_muxer;
 extern const AVInputFormat  ff_nuv_demuxer;
 extern const AVInputFormat  ff_obu_demuxer;
+extern const AVOutputFormat ff_obu_muxer;
 extern const AVOutputFormat ff_oga_muxer;
 extern const AVInputFormat  ff_ogg_demuxer;
 extern const AVOutputFormat ff_ogg_muxer;
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 088b62f369..ad29e71099 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -453,6 +453,26 @@ const AVOutputFormat ff_mpeg2video_muxer = {
 };
 #endif
 
+#if CONFIG_OBU_MUXER
+static int obu_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
+{
+    AVStream *st = s->streams[0];
+    return ff_stream_add_bitstream_filter(st, "av1_metadata", "td=insert");
+}
+
+const AVOutputFormat ff_obu_muxer = {
+    .name              = "obu",
+    .long_name         = NULL_IF_CONFIG_SMALL("AV1 low overhead OBU"),
+    .extensions        = "obu",
+    .audio_codec       = AV_CODEC_ID_NONE,
+    .video_codec       = AV_CODEC_ID_AV1,
+    .init              = force_one_stream,
+    .write_packet      = ff_raw_write_packet,
+    .check_bitstream   = obu_check_bitstream,
+    .flags             = AVFMT_NOTIMESTAMPS,
+};
+#endif
+
 #if CONFIG_RAWVIDEO_MUXER
 const AVOutputFormat ff_rawvideo_muxer = {
     .name              = "rawvideo",
diff --git a/libavformat/version.h b/libavformat/version.h
index fc8170a3b1..13df244d97 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,8 +32,8 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  59
-#define LIBAVFORMAT_VERSION_MINOR   4
-#define LIBAVFORMAT_VERSION_MICRO 102
+#define LIBAVFORMAT_VERSION_MINOR   5
+#define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \
-- 
2.32.0



More information about the ffmpeg-devel mailing list