Alex, thanks for your reply. I'm not sure what you mean by "color conversion or 
filtering".  You're referring to something like sws_scale? This is basically my 
read/decode loop for seeking-- 

// for each frame from the keyframe to the frame you want: 
do {
   av_read_frame(pFormatCtx, &packet);
   if(packet.stream_index==videoStream)  {
       avcodec_decode_video2(pCodecCtx, captureFrame, &gotPicture, &packet);
   }
   av_free_packet(&packet);
} while (! gotPicture);

There's no color conversion or filtering in there, right?

-Jaymie


On Jun 1, 2011, at 4:01 PM, Alex Cohn wrote:

> I am afraid you are out of luck there. You can use AVSEEK_FLAG_ANY
> only if you are not interested in the decoded results. For example,
> this way you can extract some metadata, or start read process to reach
> the next I-frame.
> 
> There are some optimizations to consider for approach (1), though. For
> example, make sure you request no color conversion or filtering for
> the frames that you do not need.
> 
> Alex
> 
> On Wed, Jun 1, 2011 at 9:15 PM, Jaymie Strecker <[email protected]> wrote:
>> If you want to seek to an arbitrary frame in a video with interframes, what 
>> are your options?
>> 
>> As I understand it, you should be able to:
>> (1) seek to the previous keyframe and then enter a read/decode loop until 
>> you reach the frame you want, or
>> (2) pass AVSEEK_FLAG_ANY to the seek function (av_seek_frame or 
>> avformat_seek_file).
>> 
>> Does (2) work? I've tried it with both seek functions, and with various 
>> configurations of avcodec_flush_buffers (flush before seeking, after 
>> seeking, or not at all) -- but, at best, it results in frames with 
>> artifacts. If it makes a difference, I'm working with H.264 videos.
>> 
>> So, right now I'm using (1) but the read/decode loop is slow. Is there a 
>> faster way to seek?
>> 
>> -Jaymie
>> _______________________________________________
>> Libav-user mailing list
>> [email protected]
>> http://ffmpeg.org/mailman/listinfo/libav-user
>> 
> _______________________________________________
> Libav-user mailing list
> [email protected]
> http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to