简体   繁体   English

FFmpeg 填充滤波器计算错误宽度

[英]FFmpeg pad filter calculating wrong width

I'm using我在用着

ffmpeg.exe -i in.jpg -filter_complex "[0:v]pad=iw:ih+10:0:0" out.jpg

to add a padding of 10px at the bottom of images and videos.在图像和视频的底部添加10px的填充。 In most cases it works as expected but with some the width is off by 1px resulting in failure with error:在大多数情况下,它按预期工作,但有些宽度偏离1px ,导致失败并出现错误:

[Parsed_pad_0 @ 000002ba70617c40] Input area 0:0:623:640 not within the padded area 0:0:622:650 or zero-sized
[Parsed_pad_0 @ 000002ba70617c40] Failed to configure input pad on Parsed_pad_0
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0

you can see that the width of the input area is 623 and the padded area width is 622 but this should not be the case since we are using iw to set the width of the padding.您可以看到输入区域的宽度为623 ,填充区域的宽度为622 ,但事实并非如此,因为我们使用iw来设置填充的宽度。

Here is a sample image that fails.这是一个失败的示例图像。

示例图像

it turns out you can not pad subsampled pixel formats at odd boundries.事实证明,您不能在奇数边界填充二次采样像素格式。 the workaroud is to make the boundary even by using解决方法是使用

ffmpeg.exe -i in.jpg -filter_complex "[0:v]pad=ceil(iw/2)*2:ceil((ih+10)/2)*2:0:0" out.jpg

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ffmpeg 寻求计算错误的字节范围? - ffmpeg seek calculating wrong byte range? FFmpeg复杂过滤器和-vf填充图像并将其缩放为视频 - FFmpeg complex filter and -vf to pad and scale images to video ffmpeg:用于 GIF 输入/输出的透明背景垫过滤器? - ffmpeg: pad filter with transparent background for GIF input/output? ffmpeg:在过滤器Parsed_pa​​d_5上找不到未标记输入板0的匹配流 - ffmpeg: Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_pad_5 神秘的“ffmpeg”+ Python 错误:“无法找到匹配的 stream 用于过滤器 Parsed_crop_1 上的未标记输入焊盘 0” - Cryptic `ffmpeg` + Python error: `Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_crop_1` FFMPEG 错误代码:“在过滤器 Parsed_scale_10 上找不到未标记的输入焊盘 0 的匹配流”; [complex_filter], [-loop 1], [overlay] - FFMPEG Error Code: “Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_scale_10”; [complex_filter], [-loop 1], [overlay] ffmpeg中没有这样的过滤器 - No such filter in ffmpeg 如何使用 PHP-FFMpeg 设置 pad? - How to set pad with PHP-FFMpeg? FFMPEG,按奇数个像素调整视频大小并填充视频? - FFMPEG, resize and pad a video by and odd number of pixels? FFMpeg drawtext宽度? - FFMpeg drawtext width?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM