@@ -1056,7 +1056,6 @@ static void do_subtitle_out(OutputFile *of,
else
pkt.pts += av_rescale_q(sub->end_display_time, (AVRational){ 1, 1000 }, ost->mux_timebase);
}
- pkt.flags |= AV_PKT_FLAG_KEY;
pkt.dts = pkt.pts;
output_packet(of, &pkt, ost, 0);
}
@@ -189,6 +189,8 @@ struct AVStreamInternal {
*/
int need_context_update;
+ int is_intra_only;
+
FFFrac *priv_pts;
};
@@ -357,6 +357,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (desc && desc->props & AV_CODEC_PROP_REORDER)
st->internal->reorder = 1;
+ st->internal->is_intra_only = ff_is_intra_only(par->codec_id);
+
if (of->codec_tag) {
if ( par->codec_tag
&& par->codec_id == AV_CODEC_ID_RAWVIDEO
@@ -773,6 +775,7 @@ static int check_packet(AVFormatContext *s, AVPacket *pkt)
static int prepare_input_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret;
+ AVStream *st = s->streams[pkt->stream_index];
ret = check_packet(s, pkt);
if (ret < 0)
@@ -781,7 +784,6 @@ static int prepare_input_packet(AVFormatContext *s, AVPacket *pkt)
#if !FF_API_COMPUTE_PKT_FIELDS2 || !FF_API_LAVF_AVCTX
/* sanitize the timestamps */
if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
- AVStream *st = s->streams[pkt->stream_index];
/* when there is no reordering (so dts is equal to pts), but
* only one of them is set, set the other as well */
@@ -818,6 +820,9 @@ static int prepare_input_packet(AVFormatContext *s, AVPacket *pkt)
}
}
#endif
+ /* update flags */
+ if (st->internal->is_intra_only)
+ pkt->flags |= AV_PKT_FLAG_KEY;
return 0;
}
@@ -256,7 +256,6 @@ static void mux_frames(int n, int c)
pkt.dts = pkt.pts = audio_dts;
pkt.stream_index = 1;
pkt.duration = audio_duration;
- pkt.flags |= AV_PKT_FLAG_KEY;
audio_dts += audio_duration;
} else {
if (frames == end_frames)