[FFmpeg-devel] [PATCH] avformat/matroska: add support for VVC streams
Nuo Mi
nuomi2021 at gmail.com
Sun Jan 12 05:54:52 EET 2025
On Sat, Jan 11, 2025 at 11:49 PM James Almer <jamrial at gmail.com> wrote:
> As defined in
> https://github.com/ietf-wg-cellar/matroska-specification/blob/master/codec_specs.md#v_mpegiisovvc
>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> libavformat/matroska.c | 1 +
> libavformat/matroskaenc.c | 10 ++++++++--
> 2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/matroska.c b/libavformat/matroska.c
> index d0ecfbeb6a..bbad9a7f54 100644
> --- a/libavformat/matroska.c
> +++ b/libavformat/matroska.c
> @@ -90,6 +90,7 @@ const CodecTags ff_mkv_codec_tags[]={
> {"V_MPEG4/ISO/SP" , AV_CODEC_ID_MPEG4},
> {"V_MPEG4/ISO/AVC" , AV_CODEC_ID_H264},
> {"V_MPEGH/ISO/HEVC" , AV_CODEC_ID_HEVC},
> + {"V_MPEGI/ISO/VVC" , AV_CODEC_ID_VVC},
> {"V_MPEG4/MS/V3" , AV_CODEC_ID_MSMPEG4V3},
> {"V_PRORES" , AV_CODEC_ID_PRORES},
> {"V_REAL/RV10" , AV_CODEC_ID_RV10},
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 16f48e7864..f98e2971f8 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -39,6 +39,7 @@
> #include "riff.h"
> #include "version.h"
> #include "vorbiscomment.h"
> +#include "vvc.h"
> #include "wv.h"
>
> #include "libavutil/avstring.h"
> @@ -1141,6 +1142,9 @@ static int
> mkv_assemble_native_codecprivate(AVFormatContext *s, AVIOContext *dyn
> case AV_CODEC_ID_HEVC:
> return ff_isom_write_hvcc(dyn_cp, extradata,
> extradata_size, 0, s);
> + case AV_CODEC_ID_VVC:
> + return ff_isom_write_vvcc(dyn_cp, extradata,
> + extradata_size, 0);
> case AV_CODEC_ID_ALAC:
> if (extradata_size < 36) {
> av_log(s, AV_LOG_ERROR,
> @@ -3441,8 +3445,10 @@ static int mkv_init(struct AVFormatContext *s)
> break;
> case AV_CODEC_ID_H264:
> case AV_CODEC_ID_HEVC:
> - if ((par->codec_id == AV_CODEC_ID_H264 && par->extradata_size
> > 0 ||
> - par->codec_id == AV_CODEC_ID_HEVC && par->extradata_size
> > 6) &&
> + case AV_CODEC_ID_VVC:
> + if (((par->codec_id == AV_CODEC_ID_H264 &&
> par->extradata_size > 0) ||
> + (par->codec_id == AV_CODEC_ID_HEVC &&
> par->extradata_size > 6) ||
> + (par->codec_id == AV_CODEC_ID_VVC &&
> par->extradata_size > 6)) &&
>
Need >= 6?
According to
https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/vvc.c#L886, 6 is
a valid size.
Perhaps HEVC has a similar issue as well.
> (AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata)
> == 1))
> track->reformat = mkv_reformat_h2645;
> break;
> --
> 2.47.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-devel
mailing list