Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Evgeny Pavlov <lucenticus@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH] libavcodec/amfenc: Fix issue with missing headers in AV1 encoder
Date: Wed, 12 Jul 2023 14:23:13 +0200
Message-ID: <CADnG-DTviGnR7Omm1S0=ikXCcnVzR9M6nW95qRikrdCeDdAufA@mail.gmail.com> (raw)

This commit fixes issue with missing SPS/PPS headers in video

encoded by AMF AV1 encoder.

Missing headers leads to broken seek in MPV video player.

Default value for property AV1_HEADER_INSERTION_MODE shouldn't be setup

to NONE (no headers insertion). We need to skip definition of this property,

because default value depends on USAGE property.



Signed-off-by: Evgeny Pavlov <lucenticus@gmail.com>

---

 libavcodec/amfenc_av1.c | 6 ++++--

 1 file changed, 4 insertions(+), 2 deletions(-)



diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c

index 30c0a9fad2..0a58a0808a 100644

--- a/libavcodec/amfenc_av1.c

+++ b/libavcodec/amfenc_av1.c

@@ -77,7 +77,7 @@ static const AVOption options[] = {

     { "qvbr_quality_level",     "Sets the QVBR quality
level",              OFFSET(qvbr_quality_level),
AV_OPT_TYPE_INT,   {.i64 = -1 }, -1, 51, VE },





-    { "header_insertion_mode",  "Set header insertion
mode",                OFFSET(header_insertion_mode),
AV_OPT_TYPE_INT,{.i64 = AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_NONE },
AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_NONE,
AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_KEY_FRAME_ALIGNED, VE,
"hdrmode" },

+    { "header_insertion_mode",  "Set header insertion
mode",                OFFSET(header_insertion_mode),
AV_OPT_TYPE_INT,{.i64 = -1 }, -1,
AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_KEY_FRAME_ALIGNED, VE,
"hdrmode" },

     { "none",                   "", 0, AV_OPT_TYPE_CONST, {.i64 =
AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_NONE              }, 0, 0, VE,
"hdrmode" },

     { "gop",                    "", 0, AV_OPT_TYPE_CONST, {.i64 =
AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_GOP_ALIGNED       }, 0, 0, VE,
"hdrmode" },

     { "frame",                  "", 0, AV_OPT_TYPE_CONST, {.i64 =
AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_KEY_FRAME_ALIGNED }, 0, 0, VE,
"hdrmode" },

@@ -220,7 +220,9 @@ FF_ENABLE_DEPRECATION_WARNINGS

     // Picture control properties

     AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder,
AMF_VIDEO_ENCODER_AV1_GOP_SIZE, avctx->gop_size);



-    AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder,
AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE, ctx->header_insertion_mode);

+    // Setup header insertion mode only if this option was defined
explicitly

+    if (ctx->header_insertion_mode != -1)

+        AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder,
AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE, ctx->header_insertion_mode);



     // Rate control

     // autodetect rate control method

-- 

2.39.1
_______________________________________________
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".

             reply	other threads:[~2023-07-12 12:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 12:23 Evgeny Pavlov [this message]
2023-07-12 13:35 Evgeny Pavlov
2023-10-31 17:46 ` Dmitrii Ovchinnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADnG-DTviGnR7Omm1S0=ikXCcnVzR9M6nW95qRikrdCeDdAufA@mail.gmail.com' \
    --to=lucenticus@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git