>-----Original Message-----
>From: [email protected]
[mailto:[email protected]] On Behalf Of Jeremy Culver
>Sent: Thursday, May 07, 2009 1:49 PM
>To: Libav* user questions and discussions
>Subject: Re: [libav-user] How do I decode only I-Frames in H.264 in
ffmpeg?
>
>On Thu, May 7, 2009 at 9:35 AM, Rusty Waters <[email protected]>
wrote:
>> Hi All,
>>
>> I am able to easily to decode only I-frames in MEPG-2 with
avctx->skip_frame = AVDISCARD_NONKEY. When I use this flag for decoding
H.264, all frames are decoded.
>> Does anybody know what flags I have to set for H.264 to decode only
>> I-frames. Is this feature broken in H.264?
>>
>> Thanks, Rusty
>>
>>
>>
>
>
> _______________________________________________
> libav-user mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>
>
>How about something like
>
>AVPacket pkt;
>av_init_packet ( &pkt );
>while ( av_read_frame(fmt_ctx, &pkt) >=0 ) {
> if ( decode_keyonly && (pkt.flags & PKT_FLAG_KEY) == 0 )
> continue;
>
> // proceed with avcodec_decode_video
> // ...
>}
>
>
>
>
>
>J.
Thanks very much for writing. I appreciate it. Your solution looks like
a good one, except that my application uses it's own memory
allocation/buffering,
and doesn't use av_read_frame, so pkt.flags won't be set.
For example my call to avcodec_decode_video is:
unsigned char* outputBuffer = (unsigned
char*)obg.Map();
// Did we get a video frame?
int decodedBytes =
_pDecoder->DecodeFrame(videoBuffer,videoBufferSize,outputBuffer,outputBu
fferSize);
........
Where _pDecoder->DecodeFrame is:
int DecoderFFmpeg::DecodeFrame(const unsigned char* pFrameBuffer, const
unsigned int length, unsigned char *pDecodedFrameBuf, unsigned int
DecodedBufSize)
{
if ( (NULL == pFrameBuffer) || (NULL == pDecodedFrameBuf) ||
(length < 1) || (false == _pCtx->bOpened) )
return -1;
int gotPicture = 0;
avcodec_decode_video( _pCtx->pCodecCtx,
_pCtx->pFrame,
&gotPicture,
(unsigned char*)pFrameBuffer,
length);
.............
This is why I was relying on the internal flag of the decoder to get me
what I wanted . When I get a solution to this, I will be glad to put it
back on the
Libav-user site.
Thanks again, Rusty
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
- ------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this transmission is
legally privileged and confidential, intended only for the use of the
individual(s) or entities named above. This email and any files transmitted
with it are the property of Pelco. If the reader of this message is not the
intended recipient, or an employee or agent responsible for delivering this
message to the intended recipient, you are hereby notified that any review,
disclosure, copying, distribution, retention, or any action taken or omitted to
be taken in reliance on it is prohibited and may be unlawful. If you receive
this communication in error, please notify us immediately by telephone call to
+1-559-292-1981 or forward the e-mail to [email protected] and then
permanently delete the e-mail and destroy all soft and hard copies of the
message and any attachments. Thank you for your cooperation.
- ------------------------------------------------------------------------------
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user