How to change libav decoding framerate?
Is there any way to change libav decoding frame rate? There are several variables in libav structures responsible for getting frame rate but as I know these all are for reading purpose开发者_JAVA百科s only (in decoding mode). Among them are:
AVStream.duration
AVStream.nb_frames
AVStream.r_frame_rate
AVStream.time_base
The former two tell me the number of frames, and the latter two tell me the frame rate. But it seems that I can't just set them or it won't probably cause proper effect.
Any suggestions?
If I understand right, you need the decoded video at a lower framerate than it was encoded. The best solution would be to skip the frame packets before decoding them, at the rate you need (before calling avcodec_decode_video2()). Never tried it, but it should work. This will save unnecesary CPU spent for decoding frames you do not need.
精彩评论