旋转的FFMPEG过滤视频

时间:2017-08-31 13:49:20

标签: android video ffmpeg rotation

经过大量的努力,我终于做了我想要的,即现在使用ffmpeg 保存过滤器现在我正在使用FFMPEG的Vintage过滤器命令行,以便为它添加Vintage过滤器。但是存在一个问题,问题是输出顺时针旋转90度这不是我想要的。

我已经使用了FFMPEG文档中的这个命令,并且老式过滤器应用程序工作正常。

String complexCommand[] = {"-y", "-i", stringBuilder.toString(), "-strict", "experimental", "-vf", "curves=vintage",
            "-s", "640x480", "-r", "30", "-aspect", "4:3", "-ab",
            "48000","-ac", "2", "-ar", "22050", "-b:a", "2097k", "-vcodec", "mpeg4", savingPath};

我已经阅读过如何通过此链接进行轮换:Video Rotation using FFMPEG

现在我尝试过将文件从文档中 -vf 后逆时针旋转90度转置= 2

1.这就是我所做的:

String complexCommand[] = {"-y", "-i", stringBuilder.toString(), "-strict", "experimental", "-vf", "transpose=2", "curves=vintage",
            "-s", "640x480", "-r", "30", "-aspect", "4:3", "-ab",
            "48000","-ac", "2", "-ar", "22050", "-b:a", "2097k", "-vcodec", "mpeg4", savingPath};

但我在logcat中遇到了这个问题,即

[NULL @ 0xaaab0c00] Unable to find a suitable output format for 'curves=vintage' curves=vintage: Invalid argument

2。我也这样做是为了得到理想的结果:

String complexCommand[] = {"-y", "-i", stringBuilder.toString(), "-strict", "experimental", "-vf", "transpose=2",
        "-s", "640x480", "-r", "30", "-aspect", "4:3", "-ab",
        "48000","-ac", "2", "-ar", "22050", "-b:a", "2097k", "-vcodec", "mpeg4", savingPath};

现在从上面看,结果很好,没有任何过滤器

第3。我也尝试过这也是我最后一次尝试这样做的事:

String complexCommand[] = {"-y", "-i", stringBuilder.toString(), "-strict", "experimental", "-vf", "curves=vintage", "-vf", "transpose=2",
        "-s", "640x480", "-r", "30", "-aspect", "4:3", "-ab",
        "48000","-ac", "2", "-ar", "22050", "-b:a", "2097k", "-vcodec", "mpeg4", savingPath};

以下是我更改的内容:“ - vf”,“curves = vintage”,“ - vf”,“transpose = 2”

但结果与第二个相同,只有旋转的视频,没有应用于视频的fiters。

我需要结果,因为我已经到达目的地但问题就在那里,我需要将结果作为带有旋转形式的过滤视频,并且必须仅在字符串中实现。< / p>

我认为在 -vf 之前字符串存在一些问题,因为视频在-vf之前被旋转,当我应用转置时,正确的结果出现了。任何建议都将不胜感激。

EDITS

我也试过在命令之间使用&amp;&amp; 以获得结果,但我在logcat中收到此错误:

E/MediaMetadataRetrieverJNI: getFrameAtTime: videoFrame is a NULL pointer

我所做的是:

String complexCommand[] = {"-y", "-i", stringBuilder.toString(), "-strict", "experimental", "-vf", "curves=vintage",
            "&&", "-vf", "transpose=2", "-s", "720x720", "-r", "30", "-aspect", "4:3", "-ab",
            "48000","-ac", "2", "-ar", "22050", "-b:v", "2097k", "-vcodec", "mpeg4", savingPath};

0 个答案:

没有答案