gpt4 book ai didi

image - ffmpeg调整大小维护方面 - 未找到过滤器

转载 作者:行者123 更新时间:2023-12-04 23:28:09 24 4
gpt4 key购买 nike

我正在尝试创建保持原始外观的图像缩略图,但如果尺寸太远,则对其进行裁剪。
找到一个可能的代码片段 here

ffmpeg -i Einstein_500_459.jpg -vf scale="'if(gt(a,320/240),320,-1)':'if(gt(a,320/240),-1,240)'" Einstein_320x240_fit.png

但无法让 ffmpeg 执行它。因为它在终端中产生错误:
ffmpeg -i Einstein_500_459.jpg -vf scale="'if(gt(a,320/240),320,-1)':'if(gt(a,320/240),-1,240)'" Einstein_320x240_fit.png
ffmpeg version 0.10.12-7:0.10.12-1~precise1 Copyright (c) 2000-2014 the FFmpeg developers
built on Apr 26 2014 09:49:36 with gcc 4.6.3
configuration: --arch=amd64 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~precise1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
libavutil 51. 35.100 / 51. 35.100
libavcodec 53. 61.100 / 53. 61.100
libavformat 53. 32.100 / 53. 32.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 61.100 / 2. 61.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 6.100 / 0. 6.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, image2, from 'Einstein_500_459.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj444p, 500x459 [SAR 300:300 DAR 500:459], 25 tbr, 25 tbn, 25 tbc
Incompatible pixel format 'yuvj444p' for codec 'png', auto-selecting format 'rgb24'
[buffer @ 0x236d720] w:500 h:459 pixfmt:yuvj444p tb:1/1000000 sar:300/300 sws_param:
[scale @ 0x235d5e0] [Eval @ 0x7fffcb68f270] Missing ')' or too many args in 'if(gt(a,320/240),320,-1)'
[scale @ 0x235d5e0] [Eval @ 0x7fffcb68f270] Missing ')' or too many args in 'if(gt(a,320/240),-1,240)'
Error when evaluating the expression 'if(gt(a,320/240),-1,240)'.
Maybe the expression for out_w:'if(gt(a,320/240),320,-1)' or for out_h:'if(gt(a,320/240),-1,240)' is self-referencing.
Error opening filters!

转义单引号后
ffmpeg -i Einstein_500_459.jpg -vf scale="\'if(gt(a,320/240),320,-1)\':\'if(gt(a,320/240),-1,240)\'" Einstein_320x240_fit.png

它会产生错误
ffmpeg -i Einstein_500_459.jpg -vf scale="\'if(gt(a,320/240),320,-1)\':\'if(gt(a,320/240),-1,240)\'" Einstein_320x240_fit.png
ffmpeg version 0.10.12-7:0.10.12-1~precise1 Copyright (c) 2000-2014 the FFmpeg developers
built on Apr 26 2014 09:49:36 with gcc 4.6.3
configuration: --arch=amd64 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~precise1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
libavutil 51. 35.100 / 51. 35.100
libavcodec 53. 61.100 / 53. 61.100
libavformat 53. 32.100 / 53. 32.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 61.100 / 2. 61.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 6.100 / 0. 6.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, image2, from 'Einstein_500_459.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj444p, 500x459 [SAR 300:300 DAR 500:459], 25 tbr, 25 tbn, 25 tbc
Incompatible pixel format 'yuvj444p' for codec 'png', auto-selecting format 'rgb24'
[buffer @ 0x1897720] w:500 h:459 pixfmt:yuvj444p tb:1/1000000 sar:300/300 sws_param:
No such filter: '320/240)'
Error opening filters!

这只是一个语法问题吗?还是我的 ffmpeg 遗漏了什么?或者是什么?
这是 ubuntu 12.04,我相信它是 ffmpeg 的完整安装,而不是 libav 默认的东西。任何帮助表示赞赏。

最佳答案

解决方案是为遇到此问题的其他人安装最新的 ffmpeg。

ffmpeg -i Einstein_500_459.jpg -vf scale="'if(gt(a,320/240),320,-1)':'if(gt(a,320/240),-1,240)'" Einstein_320x240_fit.png

此代码在 ubuntu 12.04 上没有问题 - ffmpeg 版本:2.8.3

有一个脚本可以在 ubuntu 12.04 或 14.04 HERE 上编译最新的 ffmpeg

关于image - ffmpeg调整大小维护方面 - 未找到过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34057359/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com