Skip to content

Commit

Permalink
libhb: do not pass the source frame pict_type and duration to libavco…
Browse files Browse the repository at this point in the history
…dec encoders. Fix #5530, regression introduced in 395676a.

(cherry picked from commit f3d793a)
  • Loading branch information
galad87 committed Nov 30, 2023
1 parent 8b340d9 commit a582ab0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libhb/encavcodec.c
Expand Up @@ -1068,6 +1068,7 @@ static void Encode( hb_work_object_t *w, hb_buffer_t **buf_in,
// This will consume the hb_buffer_t and make it NULL
hb_video_buffer_to_avframe(&frame, buf_in);
frame.pts = pv->frameno_in++;
frame.duration = 0;

// For constant quality, setting the quality in AVCodecContext
// doesn't do the trick. It must be set in the AVFrame.
Expand All @@ -1076,7 +1077,12 @@ static void Encode( hb_work_object_t *w, hb_buffer_t **buf_in,
if (key_frame)
{
frame.pict_type = AV_PICTURE_TYPE_I;
frame.flags |= AV_FRAME_FLAG_KEY;
frame.flags = AV_FRAME_FLAG_KEY;
}
else
{
frame.pict_type = AV_PICTURE_TYPE_NONE;
frame.flags = 0;
}

// Encode
Expand Down

0 comments on commit a582ab0

Please sign in to comment.