通过java GET错误执行mp4box cmd

通过java GET错误执行mp4box cmd,java,cmd,ffmpeg,execute,Java,Cmd,Ffmpeg,Execute,很抱歉,当我标记ffmpeg时,因为我无法标记MP4Box。但我也有问题,无法通过Java代码执行ffmpeg。 我在家看书,但找不到我的问题 我在cmd中测试了命令,还可以: MP4Box-仪表盘10000-仪表盘配置文件激活-段名称输出-seg-rap -bs开关无输入。mp4 但当我通过java代码执行cmd时,我得到错误: 错误-仅找到一个输入文件作为参数,请检查用法 下面是我的代码,有什么问题吗 package com.uit.reformatvideo; import java.i

很抱歉,当我标记ffmpeg时,因为我无法标记MP4Box。但我也有问题,无法通过Java代码执行ffmpeg。 我在家看书,但找不到我的问题

我在cmd中测试了命令,还可以:

MP4Box-仪表盘10000-仪表盘配置文件激活-段名称输出-seg-rap -bs开关无输入。mp4

但当我通过java代码执行cmd时,我得到错误:

错误-仅找到一个输入文件作为参数,请检查用法

下面是我的代码,有什么问题吗

package com.uit.reformatvideo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Logger;

public class ExecuteComandToFormatVideo {

    public final static String LINK_MP4BOX = "C:/MP4Box/Tools/MP4Box.exe";
    public final static String CREATE_MPD_ECLIPSE = "mp4box -dash 10000 -frag 1000 -rap -bs-switching no";
    public final static String CREATE_MPD_IE = "MP4Box -dash 10000 -dash-profile live -segment-name output-seg -rap -bs-switching no";
    private static final Logger log = Logger.getLogger(ExecuteComandToFormatVideo.class.getName());


    public static void main(String[] args) throws IOException, InterruptedException {
          String s = null;

            try {

            // run the Unix "ps -ef" command
                // using the Runtime exec method:
                String lsCmd[] = new String [2];
                lsCmd[0] = LINK_MP4BOX;
                lsCmd[1] = "MP4Box -dash 10000 -dash-profile live -segment-name output-seg -rap -bs-switching no input.mp4";
                Process p = Runtime.getRuntime().exec(lsCmd);
                p.waitFor();
                BufferedReader stdInput = new BufferedReader(new
                     InputStreamReader(p.getInputStream()));

                BufferedReader stdError = new BufferedReader(new
                     InputStreamReader(p.getErrorStream()));

                // read the output from the command
                System.out.println("Here is the standard output of the command:\n");
                while ((s = stdInput.readLine()) != null) {
                    System.out.println(s);
                }

                // read any errors from the attempted command
                System.out.println("Here is the standard error of the command (if any):\n");
                while ((s = stdError.readLine()) != null) {
                    System.out.println(s);
                }

                System.exit(0);
            }
            catch (IOException e) {
                System.out.println("exception happened - here's what I know: ");
                e.printStackTrace();
                System.exit(-1);
            }
    }

}
下面是我的发言:

以下是命令的标准输出:

下面是命令的标准错误(如果有):错误-只有一个 找到作为参数的输入文件,请检查用法


对不起,因为我的英语不好。我创建了一个bat文件,其中包含命令CMD,然后使用
Runtime.getRuntime().exec(url+name+“.bat”)
执行bat文件。这是我的解决方案。
我的bat文件:

cd C:/MP4Box/Tools/
MP4Box
MP4Box -dash 10000 -dash-profile live -segment-name output-seg -rap -bs-switching no "C:\Users\ducth\Desktop\New folder (2)\SharingVideo\src\main\webapp\resources\video\output.mp4"

我已通过批处理文件解决了我的问题。因为您找到了解决方案,我们鼓励您提供答案。感谢LordNeckBeard:)