height not divisible by 2
height not divisible by 2
h.264 - FFMPEG (libx264) "height not divisible by 2" - Stack Overflow https://stackoverflow.com/questions/20847674/ffmpeg-libx264-height-not-divisible-by-2
After playing around with this a bit, I think I've answered my own question. Here is the solution in case anyone else runs into a similar issue... I had to add the below argument to the command:
-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2"
Command:
ffmpeg -r 24 -i frame_%05d.jpg -vcodec libx264 -y -an video.mp4 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2"
Basically, .h264 needs even dimensions so this filter will:
- Divide the original height and width by 2
- Round it down to the nearest pixel
- Multiply it by 2 again, thus making it an even number
尺寸调整为不大于的最小偶数
from PIL import Image f = 'my.jpg'
mid_icon = Image.open(f)
h, w = mid_icon.height, mid_icon.width
h, w = int(h / 2) * 2, int(w / 2) * 2
mid_icon = mid_icon.resize((w, h), Image.ANTIALIAS)
mid_icon.save(f)
from PIL import Image def img_to_floor_even(f):
try:
fo = Image.open(f)
w, h = fo.width, fo.height
w_, h_ = int(w / 2) * 2, int(h / 2) * 2
if (w, h) != (w_, h):
fo = fo.resize((w_, h_), Image.ANTIALIAS)
fo.save(f)
except Exception as e:
print(e)
# log
height not divisible by 2的更多相关文章
- ffmpeg按比例缩放--"width / height not divisible by 2" 解决方法
最近在处理视频的时候,有这么一个需求 如果视频的分辨率宽度大于960的话,就把宽度设为960,而高度按其比例进行缩放 如果视频的分辨率高度大于540的话,就把高度设为540,而宽度按其比例进行缩放 之 ...
- # [libx264 @ 00000275eb57fec0] height not divisible by 2 (520x325)
# [libx264 @ 00000275eb57fec0] height not divisible by 2 (520x325)
- ffmpeg基本功能使用
任务描述:由给定图像序列合成 24fps 视频 方案一 直接对图像进行操作,适用于图像名比较规范且默认即为所需顺序 ffmpeg -f image2 -i ./images_crop_%d.png - ...
- ffmpeg入门篇-滤镜的基本使用
转发自白狼栈:查看原文 滤镜 什么是滤镜?百度百科介绍说"滤镜主要是用来实现图像的各种特殊效果......". 我们最早在ffmpeg是如何转码的一文中了解过滤镜,来回顾下当时的转 ...
- ffmpeg细节整理记录
ffmpeg细节整理记录 1.-vcodec.-code:v.-c:v ffmpeg的官方文档 -vcodec 是 -code:v 别名. -vcodec codec (output) Set the ...
- [PyData] 03 - Data Representation
Ref: http://blog.csdn.net/u013534498/article/details/51399035 如何在Python中实现这五类强大的概率分布 考虑下在mgrid上画二维概率 ...
- H5 canvas的 width、height 与style中宽高的区别
Canvas 的width height属性 1.当使用width height属性时,显示正常不会被拉伸:如下 <canvas id="mycanvas" width=&q ...
- height:100% 布局
常常会碰到需要填满整个浏览器,并且自适应高度的需求.首先肯定会想到给容器设定height:100%,但是会没有效果.原因是body没有高度,所以百分比无法生效. 解决方案:给html,body,标签都 ...
- 页面width与height使用百分比来划分不起作用解决办法--记录六
有时候你写 <div style="width:80%;height:100%;border:1px solid red"></div> <div s ...
随机推荐
- Python机器学习——Agglomerative层次聚类
层次聚类(hierarchical clustering)可在不同层次上对数据集进行划分,形成树状的聚类结构.AggregativeClustering是一种常用的层次聚类算法. 其原理是:最初将 ...
- Web项目ConcurrentModificationException异常
后台SSH在做Session删除的时候,遇到了ConcurrentModificationException异常. 参考资料:http://blog.csdn.net/idesvo/article/d ...
- mysql explain的使用
一.explain返回各列的含义: 1.table:显示这一行的数据是关于那张表的 2.type:重要的列,显示连接使用了何种类型,从最好到最差的连接类型为const.eq_reg.ref.range ...
- Kvm:通过 libvirt 远程管理虚拟机
1.通过qemu+ssh方式 2.通过qemu+tcp方式 主控端需要安装相关工具包: #yum groupinstall "Virtualization" #yum instal ...
- PHP:验证邮箱合法性
文章来源:http://www.cnblogs.com/hello-tl/p/7592304.html /** * [verifyPhone description] 效验邮箱号合法性 * @para ...
- json pickle shelve hashlib collections time
import json # Json模块提供了四个功能:dumps.dump.loads.load dic = {'k1':'v1','k2':'v2','k3':'v3'} str_dic = js ...
- UVA 140 Bandwidth (dfs 剪枝 映射)
题意: 给定一个n个结点的图G和一个结点的排列, 定义结点i的带宽b(i)为i和相邻结点在排列中的最远距离, 所有b(i)的最大值就是这个图的带宽, 给定G, 求让带宽最小的结点排列. 给定的图 n ...
- java实现扫二维码登录功能
哈哈哈 http://blog.sina.com.cn/s/blog_7f416edf0102vb8h.html http://blog.sina.com.cn/s/blog_7f416edf0102 ...
- 如何抓取崩溃的log日志
4.手机录屏工具的推荐 Andriod:录屏大师,易录屏等等. iOS:AirPlayer,iTools. 5.如何抓取崩溃的log日志? android闪退获取日志方法: 1.下载adb工具包 2. ...
- 07-js数组
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...