【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.




  • 2019-12-01 08:00:16

    PHP中的HTTP_HOST和SERVER_NAME有什么区别

    多域名指向同一个php服务器,用nginx做代理,获取SERVER_NAME都是第一个域名,这就尴尬了,至今不明白咋回事,最后用HTTP_HOST解决都,这个暂时倒是准确。

  • 2019-12-01 08:04:30

    laravel多路由配置,也可以做根据域名都动态路由

    在用laravel 框架开发大型应用的时候,由于 laravel 默认是只有一个路由文件,如果把项目所有模块的路由放在一个路由文件下,那么该路由文件就显得很臃肿,以至于后期难以维护,解决方案是根据不同模块配置不同路由文件。

  • 2019-12-03 15:50:00

    html5 audio stop功能

    html5并没有提供停止功能,我们需要通过其他方式来实现这个问题,下面我们来看下神仙般的操作。