python - 将填充颜色添加到 none 或 alpha 0,在使用 ffmpeg-python 时返回渲染视频中的绿色背景
问题描述
我正在使用 ffmpeg-python(用 python 编写的 ffmpeg 的包装器)下面是提到的示例代码。
inp.filter_multi_output('split')[k]
.filter_('rotate', a=rotation, fillcolor='#00FF0000', ow=f"rotw({rotation})", oh=f"roth({rotation})")
.filter_('scale', width=(i['width'] * Factors().factors['w_factor']), height=(i['height'] * Factors().factors['h_factor'])).filter('setsar', '1/1')
.setpts(f"PTS-STARTPTS+{i['showtime']}/TB")
解决方案
inp.filter_multi_output('split')[k]
.filter_('scale', width=(i['width'] * Factors().factors['w_factor']), height=(i['height'] * Factors().factors['h_factor'])).filter('setsar', '1/1')
.filter_('rotate', a=rotation, fillcolor='#00FF0000', ow=f"rotw({rotation})", oh=f"roth({rotation})")
.setpts(f"PTS-STARTPTS+{i['showtime']}/TB")
只需在旋转之前应用缩放,问题就会得到解决。
推荐阅读
- azure - 在 Azure 上托管 ClickOnce 的问题
- macros - notepad++ 如何将两个宏分配给同一个键?
- flutter - 更改特定行中 listView 中的图标
- kotlin - 如何启动接收器,获取“lateinit 属性 notificationManager 尚未初始化”
- php - 如何使用 PHP 强制下载 PDF 文件?
- python - 如何等待第二个下拉列表基于第一个在 Python 中使用 Selenium 加载
- python - BOW(Bag Of Words)和TextBlob之间的区别
- javascript - 如何访问chart.js自定义工具提示界面中的类变量
- python - 序列化 json 对象内的自定义对象
- java - 创建 Java 类以接收 JSON 对象