@@ -279,7 +279,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
{
H264MetadataContext *ctx = bsf->priv_data;
CodedBitstreamFragment *au = &ctx->access_unit;
- int err, i, j, has_sps;
+ int err, i, j, has_sps, has_keyframe = 0;
H264RawAUD aud;
err = ff_bsf_get_packet_ref(bsf, pkt);
@@ -359,11 +359,13 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
goto fail;
has_sps = 1;
}
+ if (au->units[i].type == H264_NAL_IDR_SLICE)
+ has_keyframe = 1;
}
// Only insert the SEI in access units containing SPSs, and also
// unconditionally in the first access unit we ever see.
- if (ctx->sei_user_data && (has_sps || !ctx->done_first_au)) {
+ if (ctx->sei_user_data && (has_sps || !ctx->done_first_au || has_keyframe)) {
H264RawSEIPayload payload = {
.payload_type = H264_SEI_TYPE_USER_DATA_UNREGISTERED,
};