当前位置: 首页>>代码示例>>Java>>正文


Java FFmpegProbeResult类代码示例

本文整理汇总了Java中net.bramp.ffmpeg.probe.FFmpegProbeResult的典型用法代码示例。如果您正苦于以下问题:Java FFmpegProbeResult类的具体用法?Java FFmpegProbeResult怎么用?Java FFmpegProbeResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FFmpegProbeResult类属于net.bramp.ffmpeg.probe包,在下文中一共展示了FFmpegProbeResult类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testTwoPass

import net.bramp.ffmpeg.probe.FFmpegProbeResult; //导入依赖的package包/类
@Test
public void testTwoPass() throws InterruptedException, ExecutionException, IOException {
  FFmpegProbeResult in = ffprobe.probe(Samples.big_buck_bunny_720p_1mb);
  assertFalse(in.hasError());

  FFmpegBuilder builder =
      new FFmpegBuilder()
          .setInput(in)
          .overrideOutputFiles(true)
          .addOutput(Samples.output_mp4)
          .setFormat("mp4")
          .disableAudio()
          .setVideoCodec("mpeg4")
          .setVideoFrameRate(FFmpeg.FPS_30)
          .setVideoResolution(320, 240)
          .setTargetSize(1024 * 1024)
          .done();

  FFmpegJob job = ffExecutor.createTwoPassJob(builder);
  runAndWait(job);

  assertEquals(FFmpegJob.State.FINISHED, job.getState());
}
 
开发者ID:bramp,项目名称:ffmpeg-cli-wrapper,代码行数:24,代码来源:FFmpegExecutorTest.java

示例2: build

import net.bramp.ffmpeg.probe.FFmpegProbeResult; //导入依赖的package包/类
/**
 * Builds the arguments
 *
 * @param parent The parent FFmpegBuilder
 * @param pass The particular pass. For one-pass this value will be zero, for multi-pass, it will
 *     be 1 for the first pass, 2 for the second, and so on.
 * @return The arguments
 */
@CheckReturnValue
@Override
protected List<String> build(FFmpegBuilder parent, int pass) {
  if (pass > 0) {
    checkArgument(
        targetSize != 0 || video_bit_rate != 0,
        "Target size, or video bitrate must be specified when using two-pass");
  }
  if (targetSize > 0) {
    checkState(parent.inputs.size() == 1, "Target size does not support multiple inputs");

    checkArgument(
        constantRateFactor == null, "Target size can not be used with constantRateFactor");

    String firstInput = parent.inputs.iterator().next();
    FFmpegProbeResult input = parent.inputProbes.get(firstInput);

    checkState(input != null, "Target size must be used with setInput(FFmpegProbeResult)");

    // TODO factor in start time and/or number of frames

    double durationInSeconds = input.format.duration;
    long totalBitRate =
        (long) Math.floor((targetSize * 8) / durationInSeconds) - pass_padding_bitrate;

    // TODO Calculate audioBitRate

    if (video_enabled && video_bit_rate == 0) {
      // Video (and possibly audio)
      long audioBitRate = audio_enabled ? audio_bit_rate : 0;
      video_bit_rate = totalBitRate - audioBitRate;
    } else if (audio_enabled && audio_bit_rate == 0) {
      // Just Audio
      audio_bit_rate = totalBitRate;
    }
  }

  return super.build(parent, pass);
}
 
开发者ID:bramp,项目名称:ffmpeg-cli-wrapper,代码行数:48,代码来源:FFmpegOutputBuilder.java

示例3: testProgress

import net.bramp.ffmpeg.probe.FFmpegProbeResult; //导入依赖的package包/类
@Test
public void testProgress() throws InterruptedException, ExecutionException, IOException {
  FFmpegProbeResult in = ffprobe.probe(Samples.big_buck_bunny_720p_1mb);

  assertFalse(in.hasError());

  FFmpegBuilder builder =
      new FFmpegBuilder()
          .readAtNativeFrameRate() // Slows the test down
          .setInput(in)
          .overrideOutputFiles(true)
          .addOutput(Samples.output_mp4)
          .done();

  RecordingProgressListener listener = new RecordingProgressListener();

  FFmpegJob job = ffExecutor.createJob(builder, listener);
  runAndWait(job);

  assertEquals(FFmpegJob.State.FINISHED, job.getState());

  List<Progress> progesses = listener.progesses;

  // Since the results of ffmpeg are not predictable, test for the bare minimum.
  assertThat(progesses, hasSize(greaterThanOrEqualTo(2)));
  assertThat(progesses.get(0).status, is(Progress.Status.CONTINUE));
  assertThat(progesses.get(progesses.size() - 1).status, is(Progress.Status.END));
}
 
开发者ID:bramp,项目名称:ffmpeg-cli-wrapper,代码行数:29,代码来源:FFmpegExecutorTest.java

示例4: testGetMediaInformation

import net.bramp.ffmpeg.probe.FFmpegProbeResult; //导入依赖的package包/类
@Test
public void testGetMediaInformation() throws IOException {
  FFmpegProbeResult probeResult = ffprobe.probe(Samples.big_buck_bunny_720p_1mb);

  FFmpegFormat format = probeResult.getFormat();
  String line1 =
      String.format(
          locale,
          "File: '%s' ; Format: '%s' ; Duration: %.3fs",
          format.filename,
          format.format_long_name,
          format.duration);

  FFmpegStream stream = probeResult.getStreams().get(0);
  String line2 =
      String.format(
          locale,
          "Codec: '%s' ; Width: %dpx ; Height: %dpx",
          stream.codec_long_name,
          stream.width,
          stream.height);

  assertThat(
      line1,
      is(
          "File: 'src/test/resources/net/bramp/ffmpeg/samples/big_buck_bunny_720p_1mb.mp4' ; Format: 'QuickTime / MOV' ; Duration: 5.312s"));
  assertThat(
      line2,
      is("Codec: 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10' ; Width: 1280px ; Height: 720px"));
}
 
开发者ID:bramp,项目名称:ffmpeg-cli-wrapper,代码行数:31,代码来源:ReadmeTest.java

示例5: testProbeStartPts

import net.bramp.ffmpeg.probe.FFmpegProbeResult; //导入依赖的package包/类
@Test
public void testProbeStartPts() throws IOException {
  FFmpegProbeResult info = ffprobe.probe(Samples.start_pts_test);
  assertFalse(info.hasError());

  // Check edge case with a time larger than an integer
  assertThat(info.getStreams().get(0).start_pts, is(8570867078L));
}
 
开发者ID:bramp,项目名称:ffmpeg-cli-wrapper,代码行数:9,代码来源:FFprobeTest.java

示例6: testProbeDivideByZero

import net.bramp.ffmpeg.probe.FFmpegProbeResult; //导入依赖的package包/类
@Test
public void testProbeDivideByZero() throws IOException {
  // https://github.com/bramp/ffmpeg-cli-wrapper/issues/10
  FFmpegProbeResult info = ffprobe.probe(Samples.divide_by_zero);
  assertFalse(info.hasError());

  assertThat(info.getStreams().get(1).codec_time_base, is(Fraction.ZERO));

  // System.out.println(FFmpegUtils.getGson().toJson(info));
}
 
开发者ID:bramp,项目名称:ffmpeg-cli-wrapper,代码行数:11,代码来源:FFprobeTest.java

示例7: probe

import net.bramp.ffmpeg.probe.FFmpegProbeResult; //导入依赖的package包/类
public FFmpegProbeResult probe(String mediaPath) throws IOException {
  return probe(mediaPath, null);
}
 
开发者ID:bramp,项目名称:ffmpeg-cli-wrapper,代码行数:4,代码来源:FFprobe.java

示例8: addInput

import net.bramp.ffmpeg.probe.FFmpegProbeResult; //导入依赖的package包/类
public FFmpegBuilder addInput(FFmpegProbeResult result) {
  checkNotNull(result);
  String filename = checkNotNull(result.format).filename;
  inputProbes.put(filename, result);
  return addInput(filename);
}
 
开发者ID:bramp,项目名称:ffmpeg-cli-wrapper,代码行数:7,代码来源:FFmpegBuilder.java

示例9: setInput

import net.bramp.ffmpeg.probe.FFmpegProbeResult; //导入依赖的package包/类
public FFmpegBuilder setInput(FFmpegProbeResult result) {
  clearInputs();
  return addInput(result);
}
 
开发者ID:bramp,项目名称:ffmpeg-cli-wrapper,代码行数:5,代码来源:FFmpegBuilder.java


注:本文中的net.bramp.ffmpeg.probe.FFmpegProbeResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。