aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Siedel <thomas.ff@spin-digital.com>2023-03-21 16:01:20 +0100
committerJames Almer <jamrial@gmail.com>2023-06-29 14:12:50 -0300
commit45a8a62df9b9c6c93c003b177ce0190860c1f8e8 (patch)
tree71d6ea121fb19619806774642982377d380e8ee9
parentac2b25f4e5ad0f03cf2a17c82defe2b1ba7a02b1 (diff)
downloadffmpeg-45a8a62df9b9c6c93c003b177ce0190860c1f8e8.tar.gz
avformat/rawenc: add H266/VVC muxer
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--Changelog2
-rw-r--r--libavformat/Makefile1
-rw-r--r--libavformat/allformats.c1
-rw-r--r--libavformat/rawenc.c23
4 files changed, 26 insertions, 1 deletions
diff --git a/Changelog b/Changelog
index 9a05ebe016..3876082844 100644
--- a/Changelog
+++ b/Changelog
@@ -22,7 +22,7 @@ version <next>:
- bwdif_cuda filter
- Microsoft RLE video encoder
- Raw AC-4 muxer and demuxer
-- Raw VVC bitstream parser and demuxer
+- Raw VVC bitstream parser, muxer and demuxer
- Bitstream filter for editing metadata in VVC streams
- Bitstream filter for converting VVC from MP4 to Annex B
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 239b779d1e..4cb00f8700 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -604,6 +604,7 @@ OBJS-$(CONFIG_VPK_DEMUXER) += vpk.o
OBJS-$(CONFIG_VPLAYER_DEMUXER) += vplayerdec.o subtitles.o
OBJS-$(CONFIG_VQF_DEMUXER) += vqf.o
OBJS-$(CONFIG_VVC_DEMUXER) += vvcdec.o rawdec.o
+OBJS-$(CONFIG_VVC_MUXER) += rawenc.o
OBJS-$(CONFIG_W64_DEMUXER) += wavdec.o w64.o pcm.o
OBJS-$(CONFIG_W64_MUXER) += wavenc.o w64.o
OBJS-$(CONFIG_WADY_DEMUXER) += wady.o pcm.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 05c4e47a63..6324952bd2 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -487,6 +487,7 @@ extern const AVInputFormat ff_vpk_demuxer;
extern const AVInputFormat ff_vplayer_demuxer;
extern const AVInputFormat ff_vqf_demuxer;
extern const AVInputFormat ff_vvc_demuxer;
+extern const FFOutputFormat ff_vvc_muxer;
extern const AVInputFormat ff_w64_demuxer;
extern const FFOutputFormat ff_w64_muxer;
extern const AVInputFormat ff_wady_demuxer;
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 70d6322c53..f916db13a2 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -378,6 +378,29 @@ const FFOutputFormat ff_h264_muxer = {
};
#endif
+#if CONFIG_VVC_MUXER
+static int vvc_check_bitstream(AVFormatContext *s, AVStream *st,
+ const AVPacket *pkt)
+{
+ if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x0000001 &&
+ AV_RB24(pkt->data) != 0x000001)
+ return ff_stream_add_bitstream_filter(st, "vvc_mp4toannexb", NULL);
+ return 1;
+}
+
+const FFOutputFormat ff_vvc_muxer = {
+ .p.name = "vvc",
+ .p.long_name = NULL_IF_CONFIG_SMALL("raw H.266/VVC video"),
+ .p.extensions = "vvc,h266,266",
+ .p.audio_codec = AV_CODEC_ID_NONE,
+ .p.video_codec = AV_CODEC_ID_VVC,
+ .init = force_one_stream,
+ .write_packet = ff_raw_write_packet,
+ .check_bitstream = vvc_check_bitstream,
+ .p.flags = AVFMT_NOTIMESTAMPS,
+};
+#endif
+
#if CONFIG_HEVC_MUXER
static int hevc_check_bitstream(AVFormatContext *s, AVStream *st,
const AVPacket *pkt)