在java spring boot中连接/连接多个视频文件

fjnneemd  于 2021-07-03  发布在  Java
关注(0)|答案(0)|浏览(322)

我正在尝试用java连接/连接多个文件,到目前为止,我所遵循的过程是这样的( https://github.com/bramp/ffmpeg-cli-wrapper )一切正常,但在这个过程中,有几行我听不懂。
我遵循的代码:

FFmpeg ffmpeg = new FFmpeg("/path/to/ffmpeg");
FFprobe ffprobe = new FFprobe("/path/to/ffprobe");

FFmpegBuilder builder = new FFmpegBuilder()

  .setInput("input.mp4")     // Filename, or a FFmpegProbeResult
  .addInput("input2.mp4")    // <--------------------------------  Second file that I added
  .overrideOutputFiles(true) // Override the output if it exists

  .addOutput("output.mp4")   // Filename for the destination
    .setFormat("mp4")        // Format is inferred from filename, or can be set
    .setTargetSize(250_000)  // Aim for a 250KB file

    .disableSubtitle()       // No subtiles

    .setAudioChannels(1)         // Mono audio
    .setAudioCodec("aac")        // using the aac codec
    .setAudioSampleRate(48_000)  // at 48KHz
    .setAudioBitRate(32768)      // at 32 kbit/s

    .setVideoCodec("libx264")     // Video using x264
    .setVideoFrameRate(24, 1)     // at 24 frames per second
    .setVideoResolution(640, 480) // at 640x480 resolution

    .setStrict(FFmpegBuilder.Strict.EXPERIMENTAL) // Allow FFmpeg to use experimental specs
    .done();

FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);

// Run a one-pass encode
executor.createJob(builder).run();

// Or run a two-pass encode (which is better quality at the cost of being slower)
executor.createTwoPassJob(builder).run();

以下是抛出错误的行:

FFmpeg ffmpeg = new FFmpeg("/path/to/ffmpeg");
FFprobe ffprobe = new FFprobe("/path/to/ffprobe");

在这些行中,我提供了一条这样的路径,

FFmpeg ffmpeg = new FFmpeg("D:/");
FFprobe ffprobe = new FFprobe("D:/");

这会导致一个错误

java.io.IOException: CreateProcess error=5

我相信 ffmpeg/path/to/ffmpeg 以及 ffprobe/path/to/ffprobe 是文件,不是目录,这就是它抛出执行权限错误的原因,但是当我查看存储库(上面给出的链接)时,我无法在给定的链接中找到这个特定的文件。
有几个名为 ffmpeg.java 以及 ffprobe.java ,但是当我尝试在代码中使用它们时,我得到了相同的错误,所以我想知道这些路径中应该包含哪些文件

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题