[Libav-user] newbie question: what is the appropriate/best way to obtain frame_rate from a video and how to control it when decoding video?

Yingzhou Zhang zhangjsj at gmail.com
Tue Dec 20 02:11:59 CET 2011


Thanks for your reply.By "control frame rate" I meant,say,the video file
itself is 25fps, and I wanna play the video with the speed of 10frame/s.

Cheers

2011/12/20 Michael Chisholm <chisholm at mitre.org>

> I've struggled myself with this.  There are a lot more framerate-related
> fields than that lying around.  The ones I know of (in ffmpeg 0.6.3) are
> (stream=AVStream, cc=AVCodecContext):
>
> stream->time_base
> stream->r_frame_rate
> stream->avg_frame_rate
> cc->time_base
> cc->ticks_per_frame
>
> (you'd think you could maybe derive framerate from the last)  I am no
> expert, but my guess is that not all containers contain a framerate field
> somewhere for tools to read.  So libav* tries to estimate one from timing
> information.  E.g. in my app I can read from a udp multicast network
> stream, and even for the same stream, each time I run the app, it shows a
> slightly different framerate (as shown by dump_format). Maybe because it
> sees a different subsequence of timestamps, or the relative distribution in
> time of those timestamps might be slightly different, ... I don't know.  In
> my app, I settled on stream->avg_frame_rate for my purposes.
>
> As far as controlling it, I'm not sure what you mean... did you just want
> to decode at the frame rate of the stream, or somehow manipulate the the
> video to change its framerate?
>
> Andy
>
>
> On 12/19/2011 1:25 AM, Yingzhou Zhang wrote:
>
>> hey there.
>>
>> I have googled a little bit,found 2 way
>> 1:AVFormatContext->streams->**time_base.num/den?
>> 2:AVCodecContext->  streams->r_frame_rate?
>>
>> However the output of the 2 ways are not the same??
>>
>> Could you tell me what is the exact way to get frame_rate and how to
>> control it when decoding video?
>>
>> Thanks a lot
>>
>>
>>
>> ______________________________**_________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/**listinfo/libav-user<http://ffmpeg.org/mailman/listinfo/libav-user>
>>
>
> ______________________________**_________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/**listinfo/libav-user<http://ffmpeg.org/mailman/listinfo/libav-user>
>



-- 

---------------------
Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111220/c4d47d33/attachment.html>


More information about the Libav-user mailing list