【FFMPEG】"width / height not divisible by 2" 解决方法

2019-01-26 23:46:08

解决方法一:计算出宽高大小


出现该错误的原因是在于:视频的宽度必须是32的倍数,高度必须是2的倍数


解决方法:


if (screen_width % 32 != 0)

{

screen_width = screen_width / 32 * 32;

}

 

if (screen_height % 2 != 0)

{

screen_height = screen_height / 2 * 2;

}


解决方法二:  scale="854:-2"    https://ffmpeg.org/

Instead of

'scale=-2:min(1080\,ih)'

use

'scale=-2:min(1080\,if(mod(ih\,2)\,ih-1\,ih))'

It will check if ih is divisible by 2, and if not, it will decrease it by 1.




  • 2021-01-16 09:31:14

    Xcode两种引入图片的方法

    如果是纯代码,图片名需要手动添加@2x,@3x等倍数标识,且需要指明后缀.png,.jpg;IB添加图片的话只需要指明后缀就好,不用添加倍数标识。

  • 2021-01-16 09:39:32

    iOS 更改状态栏、导航栏颜色,电池颜色

    注意事项,两种方法设置View controller-based status bar appearance 的值不一样,并且如果你的plist里面没有View controller-based status bar appearance,你需要新建一个。然后就可以成功了。

  • 2021-01-16 09:45:19

    tabbar的titlePositionAdjustment设置文字距离

    指定相应的数据去偏移一个位置,向右或者向下为正值,向左或者向上为负值,不过首先你得有一个相对位置的坐标。而tabbarItem文字的坐标是底部为x轴,y轴则是tabbarItem的centerX;

  • 2021-01-16 09:49:13

    Cocoapods如何查看项目中引入库的版本号

    项目中已经安装过Cocoapods,并生成了Podfile.lock文件。 打开终端,cd命令切换到项目中的Podfile.lock文件目录下,执行命令:cat Podfile.lock 即可。也可以用文本方式打开 Podfile.lock 文件。示例如下: