ffmpeg - 解码/编码 mp4 视频时丢弃 P 帧
问题描述
我正在使用 ffmpeg(libAV 库)+ libx264 编码器解码/编码相同的 mp4(视频/mp4)文件。例如,原始视频文件包含 182 帧:
[libx264 @ 0x7fb4a843ce00] frame I:2 Avg QP:17.95 size: 13834
[libx264 @ 0x7fb4a843ce00] frame P:180 Avg QP:19.90 size: 6297
但在followig解码/编码之后,我得到的文件包含181帧:
[libx264 @ 0x7fb4ac421dc0] frame I:2 Avg QP:17.93 size: 13627
[libx264 @ 0x7fb4ac421dc0] frame P:179 Avg QP:19.77 size: 5946
我已经尝试更改 AVCodecContext gop_size/max_b_frames/priv_data (profile, preset, tune, x264opts) 并且我也阅读了这些帖子并试图解决我的问题:
从 MP4 压缩到 MP4 (libx264) 时 ffpmeg 丢弃最后一帧
ffmpeg/libx264 C API:从短 MP4 末尾丢弃的帧
UPD:如果我设置帧速率和时基 = 26/1 和 1/26 及更多 - 帧不会丢失。
UPD2:已解决!
//in function avformat_open_input() add AVDictionary *options:
av_dict_set(&options, "r", "25", 0);
av_dict_set(&options, "ignore_editlist", "1", 0);
我期望使用所有帧解码/编码视频(不更改参数)。
解决方案
推荐阅读
- php - 如何根据位置调用 PHP 中的函数?
- scala - 如何设置配置文件环境?
- python - 如何使用 selenium python 抓取多级下拉列表 [依赖选择]
- ios - 在Objective-C的实现文件中的setter方法中去除特殊字符的NSString
- forms - Vue Netlify 表单成功提交但未显示在 netlify 网站中
- javascript - 如何从字符串中解构默认值
- javascript - 如何优化搜索算法
- sql-server - 需要对存储过程中的临时表进行更新查询
- android - progressDIalog.setCancelable(false) 不工作,触摸关闭
- eclipse - 你好世界,带有德语变音符号和其他不寻常的字符 ä ö ü ß @  ♫ Ꞧ € ᴀ ꟽ ㍻