Search in sources :

Example 16 with Time

use of org.fagu.fmv.utils.time.Time in project fmv by f-agu.

the class FFHelperTestCase method testMixAudio.

/**
 * @throws Exception
 */
@Test
public void testMixAudio() throws Exception {
    movieMetadatasSupplier = fileName -> {
        MockMovieMetadatas builder = MockMovieMetadatas.builder();
        if ("left.mp4".equals(fileName)) {
            builder.audio();
            builder.video();
            return builder.build();
        }
        if ("w.mp3".equals(fileName)) {
            builder.audio();
            return builder.build();
        }
        throw new RuntimeException(fileName);
    };
    FFHelper.mixAudio(new File("left.mp4"), new File("w.mp3"), new File("out.mp4"), new Time(0, 0, 13.5));
    assertCmd("-i left.mp4 -ss 00:00:13.500 -i w.mp3 -filter_complex \"[1][0] amix=duration=shortest:inputs=2 [ami_a]\" -map [ami_a] -map 0:v -codec:v copy -y out.mp4");
}
Also used : Time(org.fagu.fmv.utils.time.Time) File(java.io.File) Test(org.junit.Test)

Aggregations

Time (org.fagu.fmv.utils.time.Time)16 Duration (org.fagu.fmv.utils.time.Duration)7 InputProcessor (org.fagu.fmv.ffmpeg.operation.InputProcessor)5 FilterComplex (org.fagu.fmv.ffmpeg.filter.FilterComplex)4 AudioGenerator (org.fagu.fmv.ffmpeg.filter.impl.AudioGenerator)4 MixAudioDuration (org.fagu.fmv.ffmpeg.filter.impl.AudioMix.MixAudioDuration)4 Blend (org.fagu.fmv.ffmpeg.filter.impl.Blend)4 Concat (org.fagu.fmv.ffmpeg.filter.impl.Concat)4 Format (org.fagu.fmv.ffmpeg.filter.impl.Format)4 NullSourceVideo (org.fagu.fmv.ffmpeg.filter.impl.NullSourceVideo)4 SetSAR (org.fagu.fmv.ffmpeg.filter.impl.SetSAR)4 VideoStream (org.fagu.fmv.ffmpeg.metadatas.VideoStream)4 PixelFormat (org.fagu.fmv.ffmpeg.utils.PixelFormat)4 File (java.io.File)3 FFMPEGExecutorBuilder (org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder)3 Test (org.junit.Test)3 OutputProcessor (org.fagu.fmv.ffmpeg.operation.OutputProcessor)2 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1