• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ios - FFMPEG 将 .avi 转换为可播放的 iOS 电影 mp4

[复制链接]
菜鸟教程小白 发表于 2022-12-12 18:04:19 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我正在尝试将 h264 编码的baseline4.0 avi 文件转换为使用baseline3 编码的新h264 mpeg 文件。

由于baseline4.0,文件原始文件无法在任何iOS设备上播放(我认为?)

我在这里使用这个包装类 https://github.com/OpenWatch/FFmpegWrapper

但实际上我不知道如何设置基线。我可以转换为 mpeg4,但似乎每次都默认为baseline4.0。

我尝试在 AVCodecContext 上设置它

AVCodecContext *outputCodecContext = outputStream->codec;
outputCodecContext->level = 31;
outputCodecContext->profile = FF_PROFILE_H264_BASELINE;

但这没有任何效果。

也许任何人都有线索,或者有更好的 FFMPEGWrapper。

来自原始视频的规范: original video



Best Answer-推荐答案


首先看一下this网站了解哪些苹果设备支持什么:

  • Encode video using H.264 compression

    • H.264 Baseline 3.0: All devices
    • H.264 Baseline 3.1: iPhone 3G and later, and iPod touch 2nd generation and later.
    • H.264 Main profile 3.1: iPad (all versions), Apple TV 2 and later, and iPhone 4 and later.
    • H.264 Main Profile 4.0: Apple TV 3 and later, iPad 2 and later, and iPhone 4S and later.
    • H.264 High Profile 4.0: Apple TV 3 and later, iPad 2 and later, and iPhone 4S and later.
    • H.264 High Profile 4.1: iPad 2 and later and iPhone 4S and later.

每个配置文件末尾的数字不是配置文件的版本!它是一个级别。这意味着如果您想支持所有设备,您应该坚持使用 Baseline 配置文件和 Level 3.0。

我不知道这个包装器的东西,但是使用简单的 ffmpeg 你会使用这个选项:

-profile:v baseline -level 3.0

编辑:

抱歉,我没有注意到您已经设置了级别(可能以正确的方式)。但这里还有一个提示。注意 FFmpegWrapperinit 中对 av_register_all()avcodec_register_all() 的调用.会不会是先初始化wrapper再改AVCodecContext

关于ios - FFMPEG 将 .avi 转换为可播放的 iOS 电影 mp4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34675983/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap