diff mbox series

[FFmpeg-devel,v4,7/9] avformat: add h266/vvc muxer

Message ID 20210125141507.11012-8-nuomi2021@gmail.com
State Superseded
Headers show
Series add vvc raw demuxer, muxer, parser, metadata bsf
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Nuo Mi Jan. 25, 2021, 2:15 p.m. UTC
---
 libavformat/Makefile     |  1 +
 libavformat/allformats.c |  1 +
 libavformat/rawenc.c     | 25 +++++++++++++++++++++++++
 3 files changed, 27 insertions(+)

Comments

Moritz Barsnick Feb. 3, 2021, 1:45 p.m. UTC | #1
On Mon, Jan 25, 2021 at 22:15:05 +0800, Nuo Mi wrote:
> +    .extensions        = "hevc,h266,266",

Is ".hevc" a valid extension for H.266/VVC?

Moritz
James Almer Feb. 3, 2021, 1:57 p.m. UTC | #2
On 2/3/2021 10:45 AM, Moritz Barsnick wrote:
> On Mon, Jan 25, 2021 at 22:15:05 +0800, Nuo Mi wrote:
>> +    .extensions        = "hevc,h266,266",
> 
> Is ".hevc" a valid extension for H.266/VVC?

Most assuredly not, and just a copy paste error.

> 
> Moritz
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
Nuo Mi Feb. 6, 2021, 3:26 a.m. UTC | #3
On Wed, Feb 3, 2021 at 9:57 PM James Almer <jamrial@gmail.com> wrote:

> On 2/3/2021 10:45 AM, Moritz Barsnick wrote:
> > On Mon, Jan 25, 2021 at 22:15:05 +0800, Nuo Mi wrote:
> >> +    .extensions        = "hevc,h266,266",
> >
> > Is ".hevc" a valid extension for H.266/VVC?
>
> Most assuredly not, and just a copy paste error.
>
Yes, It's a typo. Thanks for the correction.
Fixed.

>
> >
> > Moritz
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> >
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 4a5406da38..0253aa7d5a 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -564,6 +564,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_WAV_DEMUXER)               += wavdec.o pcm.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index a2182e0603..2ec3eeda7b 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -463,6 +463,7 @@  extern AVInputFormat  ff_vpk_demuxer;
 extern AVInputFormat  ff_vplayer_demuxer;
 extern AVInputFormat  ff_vqf_demuxer;
 extern AVInputFormat  ff_vvc_demuxer;
+extern AVOutputFormat ff_vvc_muxer;
 extern AVInputFormat  ff_w64_demuxer;
 extern AVOutputFormat ff_w64_muxer;
 extern AVInputFormat  ff_wav_demuxer;
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 32704f9bfd..5eb95f069c 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -372,6 +372,31 @@  AVOutputFormat ff_hevc_muxer = {
 };
 #endif
 
+#if CONFIG_VVC_MUXER
+static int vvc_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
+{
+    if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x0000001 &&
+                          AV_RB24(pkt->data) != 0x000001) {
+        //TODO: fixed this after vvc codec defined in http://mp4ra.org/#/codecs
+        av_log(s, AV_LOG_ERROR, "vvc: mp4 to annexb is not supported\n");
+        return AVERROR_PATCHWELCOME;
+    }
+    return 1;
+}
+
+AVOutputFormat ff_vvc_muxer = {
+    .name              = "vvc",
+    .long_name         = NULL_IF_CONFIG_SMALL("raw VVC video"),
+    .extensions        = "hevc,h266,266",
+    .audio_codec       = AV_CODEC_ID_NONE,
+    .video_codec       = AV_CODEC_ID_VVC,
+    .write_header      = force_one_stream,
+    .write_packet      = ff_raw_write_packet,
+    .check_bitstream   = vvc_check_bitstream,
+    .flags             = AVFMT_NOTIMESTAMPS,
+};
+#endif
+
 #if CONFIG_M4V_MUXER
 AVOutputFormat ff_m4v_muxer = {
     .name              = "m4v",