FFMpeg元数据问题


0

每当我运行ffmpeg -i filename它返回这样的东西:

  Metadata:
major_brand     : mp42
minor_version   : 0
compatible_brands: isommp42
creation_time   : 2010-07-16 18:33:45
Duration: 00:00:24.00, start: 0.000000, bitrate: 2443 kb/s
Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s
Metadata:
  creation_time   : 2010-07-16 18:33:45
  handler_name    : Mainconcept MP4 Sound Media Handler
Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 2311 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc
Metadata:
  creation_time   : 2010-07-16 18:33:46
  handler_name    : Mainconcept MP4 Video Media Handler

除非我使用以下命令从java运行它:

ProcessBuilder pb = new ProcessBuilder(execS);
    pb.redirectErrorStream(true);
    try{
        Process p = pb.start();

        BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
        String bs = "";
        while(br.readLine() != null){
            bs += br.readLine();
            bs += "\n";
        }
        return bs;
    }catch(IOException e){
        e.printStackTrace();
    }

它给了我这个:

      built on Jun 17 2013 23:20:06 with gcc 4.6 (GCC)
  Metadata:
    minor_version   : 0
    creation_time   : 2010-07-16 18:33:45
    Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s
      creation_time   : 2010-07-16 18:33:45
    Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 2311 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc
      creation_time   : 2010-07-16 18:33:46
At least one output file must be specified

谁能告诉我我做错了什么?

Answers:


1

您没有为程序提供正确的命令行选项。

ProcessBuilder 获取字符串列表,因此您需要将它们拆分:

new ProcessBuilder("ffmpeg", "-i", "filename");

execS是一个String [],包含:“ffmpeg”,“ - i”,“filename”。
AUser 2013年

0

尝试创建一个新线程并同时处理Process的错误流; p.getErrorStream()

FFMPEG将大量数据发送到错误流; 并且通过不处理它,错误InputStream缓冲区填满那里,然后挂起FFMPEG进程直到它的读取。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.