如何在android中使用ffmpeg commnad输入和输出文件路径?

时间:2016-05-27 11:38:57

标签: android video ffmpeg

我想在android app.i中使用ffmpeg命令使用此库以ffmpeg开头。

http://writingminds.github.io/ffmpeg-android-java/

我开发了一个演示应用程序并运行命令

ffmpeg -version

此命令也提供准确的输出。但是当我给出任何带有名字的文件路径时,我的命令总是失败,我正在使用:

            String cmd[] = new String[]{"ffmpeg", "-i", "/storage/emulated/0/Videos/dheere.mp4", "-c:v", "libx264", "/storage/emulated/0/Videos/dheere2.3gp"};
            execute(cmd);




  private void execute(String cmd[]) {


    try {
        // to execute "ffmpeg -version" command you just need to pass "-version"
        FFMpegApp.getFfmpeg().execute(cmd, new ExecuteBinaryResponseHandler() {

            @Override
            public void onStart() {
                Log.e("gc", "Command Started");
            }

            @Override
            public void onProgress(String message) {
                Log.e("gc", "onProgress" + message);
            }

            @Override
            public void onFailure(String message) {
                Log.e("gc", "onFailure command" + message);
            }

            @Override
            public void onSuccess(String message) {
                Log.e("gc", "onSuccess command" + message);
            }


            @Override
            public void onFinish() {
                Log.e("gc", "onFinish command");
            }
        });
    } catch (FFmpegCommandAlreadyRunningException e) {
        // Handle if FFmpeg is already running
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

请给我任何建议如何在android中使用命令? 提前谢谢。

1 个答案:

答案 0 :(得分:0)

import requests
from xml.etree import ElementTree

response = requests.get('http://api.worldbank.org/v2/country/GBR/indicator/NY.GDP.MKTP.KD.ZG')

tree = ElementTree.fromstring(response.content)

print(tree)