[FFmpeg-devel] I-frame problems with H.264

Rusty Waters rusty0829
Mon May 4 18:36:07 CEST 2009


Hi All,

I have written from my work email, and it always add a "proprietary" message, so I am going to write from my personal email. I have set the skip_frame flag to AVDISCARD_NONKEY,
and it works like a charm for MPEG-4 to display only I-frames. When I do this for H.264 it does nothing. I am using the 0.5 release version of fmpeg dated 3/10/09.

It seems to me the code in mpeg12.c has a chance to work as it looks like:
??????????????? /* Skip B-frames if we are in a hurry. */
??????????????? if(avctx->hurry_up && s2->pict_type==FF_B_TYPE) break;
???????????????
 if(? (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==FF_B_TYPE)
??????????????????? ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=FF_I_TYPE)
??????????????????? || avctx->skip_frame >= AVDISCARD_ALL)
??????????????????? break;
??????????????? /* Skip everything if we are in a hurry>=5. */
??????????????? if(avctx->hurry_up>=5) break;

The code in h264.c seems to me that it cannot ever work, as it looks
 like:
??????????? if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5
?????????????? && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
?????????????? && (avctx->skip_frame < AVDISCARD_BIDIR? || hx->slice_type_nos!=FF_B_TYPE)
?????????????? && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
?????????????? && avctx->skip_frame < AVDISCARD_ALL){
??????????????? if(avctx->hwaccel)
 {
??????????????????? if (avctx->hwaccel->decode_slice(avctx, &buf[buf_index - consumed], consumed) < 0)
??????????????????????? return -1;
??????????????? }else
??????????????? if(CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU){
??????????????????? static const uint8_t start_code[] = {0x00, 0x00, 0x01};
???????????????????
 ff_vdpau_add_data_chunk(s, start_code, sizeof(start_code));
??????????????????? ff_vdpau_add_data_chunk(s, &buf[buf_index - consumed], consumed );
??????????????? }else
??????????????????? context_count++;

My main point is that in the working examples the conditions are OR'd in. In the non-working h.264 the conditions are AND'd in. How can all these be true? Only ONE AVDISCARD_ flag can be set at a time.
Any ideas would be greatly appreciated.

Thanks, Rusty Waters




      



More information about the ffmpeg-devel mailing list