如何更改libav解码帧率?
有没有办法改变libav解码帧率? libav 结构中有几个变量负责获取帧速率,但据我所知,这些变量仅用于读取目的(在解码模式下)。其中有:
AVStream.duration
AVStream.nb_frames
AVStream.r_frame_rate
AVStream.time_base
前两者告诉我帧数,后两者告诉我帧率。但似乎我不能只是设置它们,否则可能不会产生适当的效果。
有什么建议吗?
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 purposes 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解正确,您需要解码视频的帧速率低于编码的帧速率。最好的解决方案是在解码帧数据包之前以您需要的速率跳过帧数据包(在调用 avcodec_decode_video2() 之前)。从未尝试过,但应该可以。这将节省用于解码不需要的帧的不必要的 CPU 消耗。
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.