FFmpeg的比例错误错误 [英] FFmpeg scaling error

查看:346
本文介绍了FFmpeg的比例错误错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想转换视频Android上使用 FFmpeg的Andr​​oid的Java库
我的方法需要输入和输出文件pathes和输出文件(如640×480)的dimentions。视频应该适合作物这些界限。随着视频可能是横向或纵向我旁边PARAMS:

I'm trying to convert video on Android using FFmpeg Android Java library My method takes input and output file pathes and dimentions of output file (for instance 640x480). Video should fit crop these bounds. As video might be in landscape or portrait orientation I'm next params:

String.format("-i %s \"scale='if(gt(a,1),-1,%d)':'if(gt(1,a),%d,-1)'\" %s", in, h, w, out);

请参见这篇文章

C $ C>输入文件的长宽比(W / H)。

according to official doc a is aspect ration (w/h) of input file.

因此​​,一个> 1 GT(A,1)指宽度> h后,视频的景观,以及1> GT(1, )表示H>W¯¯所以视频画像。

So a > 1 gt(a,1) means w > h so video is landscape, and 1 > a gt(1,a) means h > w so video is portrait.

但我发现了一个错误:

Unable to find a suitable output format for "scale='if(gt(a,1),-1,480)':'if(gt(1,a),640,-1'"
'"scale='if(gt(a,1),-1,480)':'if(gt(1,a),640,-1'" : Invalid argument

我是什么做错了吗?
谢谢你。

What am I doing wrong ? Thanks.

推荐答案

您规模过滤器之前需要-vf。它分析尺度滤波器的输出文件。所以:

You need -vf before the scale filter. It parses the scale filter as an output file. So:

-i %s -vf \"scale='if(gt(a,1),-1,%d)':'if(gt(1,a),%d,-1)'\" %s

这篇关于FFmpeg的比例错误错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆