use of com.bixly.pastevid.screencap.components.progressbar.FFMpegProgressBarListener in project screenbird by adamhub.
the class FileUtilTest method testExtractMpgClip.
/**
* Test of extractMpgClip method, of class FileUtil.
*/
@Test
public void testExtractMpgClip() {
System.out.println("extractMpgClip");
assert SAMPLE_MPG.exists() : "Please provide a sample MPG vidoe for testing";
assert FFMPEG_BIN.exists() : "FFMpeg is needed for this test";
assert FileUtil.getVideoDuration(SAMPLE_MPG.getAbsolutePath()) > 5 : "Please provide a MPG video file longer than 5 seconds";
File source = SAMPLE_MPG;
File target = generateTempFile("mpg");
int offset = 0;
int duration = 5;
FFMpegProgressBarListener ffmpegListener = null;
FileUtil.extractMpgClip(source, target, offset, duration, ffmpegListener);
assertTrue(Math.abs(FileUtil.getVideoDuration(target.getAbsolutePath()) - duration) < 2);
}
use of com.bixly.pastevid.screencap.components.progressbar.FFMpegProgressBarListener in project screenbird by adamhub.
the class FileUtilTest method testEncodeVideoMp4.
/**
* Test of encodeVideoMp4 method, of class FileUtil.
*/
@Test
public void testEncodeVideoMp4() throws Exception {
System.out.println("encodeVideoMp4");
assert SAMPLE_MOV.exists() : "Please provide a sample MOV vidoe for testing";
assert SAMPLE_WAV.exists() : "Please provide a sample WAV vidoe for testing";
assert FFMPEG_BIN.exists() : "FFMpeg is needed for this test";
String filePath = SAMPLE_MOV.getAbsolutePath();
long offset = 0L;
Integer bitrate = 1040000;
FFMpegProgressBarListener ffmpegListener = null;
String result = FileUtil.encodeVideoMp4(filePath, offset, bitrate, ffmpegListener);
Integer sampleDuration = FileUtil.getVideoDuration(SAMPLE_MOV.getAbsolutePath());
Integer resultDuration = FileUtil.getVideoDuration(result);
assertTrue(Math.abs(sampleDuration - resultDuration) < 2);
}
use of com.bixly.pastevid.screencap.components.progressbar.FFMpegProgressBarListener in project screenbird by adamhub.
the class FileUtilTest method testConvertMpgToMp4.
/**
* Test of convertMpgToMp4 method, of class FileUtil.
*/
@Test
public void testConvertMpgToMp4() {
System.out.println("convertMpgToMp4");
assert SAMPLE_MPG2.exists() : "Please provide a sample MPG vidoe for testing";
assert HANBRAKE_BIN.exists() : "Handbrake is needed for this test";
File source = SAMPLE_MPG2;
FFMpegProgressBarListener ffmpegListener = null;
FileUtil.convertMpgToMp4(source, ffmpegListener);
Integer sampleDuration = FileUtil.getVideoDuration(SAMPLE_MPG2.getAbsolutePath());
Integer resultDuration = FileUtil.getVideoDuration(SAMPLE_MP4.getAbsolutePath());
assert Math.abs(sampleDuration - resultDuration) < 10 : "Expected: < 10; Sample: " + sampleDuration + " Result: " + resultDuration;
}
use of com.bixly.pastevid.screencap.components.progressbar.FFMpegProgressBarListener in project screenbird by adamhub.
the class FileUtilTest method testCompressVideo.
/**
* Test of compressVideo method, of class FileUtil.
*/
@Ignore
public void testCompressVideo() {
System.out.println("compressVideo");
assert SAMPLE_MOV.exists() : "Please provide a sample MOV vidoe for testing";
assert SAMPLE_WAV.exists() : "Please provide a sample WAV vidoe for testing";
assert FFMPEG_BIN.exists() : "FFMpeg is needed for this test";
assert MediaUtil.osIsWindows() : "This test only works on Window, Linux is untested, MAC OS X does not work";
String filePath = SAMPLE_MOV.getAbsolutePath();
long offset = 0L;
Integer bitrate = 1040000;
FFMpegProgressBarListener ffmpegListener = null;
FileUtil.compressVideo(SAMPLE_MOV, SAMPLE_MP4, SAMPLE_WAV, bitrate, ffmpegListener);
Integer sampleDuration = FileUtil.getVideoDuration(SAMPLE_MOV.getAbsolutePath());
Integer resultDuration = FileUtil.getVideoDuration(SAMPLE_MP4.getAbsolutePath());
assertTrue(Math.abs(sampleDuration - resultDuration) < 10);
}
use of com.bixly.pastevid.screencap.components.progressbar.FFMpegProgressBarListener in project screenbird by adamhub.
the class FileUtilTest method testEncodeVideoAvi.
/**
* Test of encodeVideoAvi method, of class FileUtil.
*/
@Test
public void testEncodeVideoAvi() throws Exception {
System.out.println("encodeVideoAvi");
assert SAMPLE_MOV.exists() : "Please provide a sample MOV vidoe for testing";
assert SAMPLE_WAV.exists() : "Please provide a sample WAV vidoe for testing";
assert FFMPEG_BIN.exists() : "FFMpeg is needed for this test";
String filePath = SAMPLE_MOV.getAbsolutePath();
long offset = 0L;
Integer bitrate = 1040000;
FFMpegProgressBarListener ffmpegListener = null;
String result = FileUtil.encodeVideoAvi(filePath, offset, bitrate, ffmpegListener);
Integer sampleDuration = FileUtil.getVideoDuration(SAMPLE_MOV.getAbsolutePath());
Integer resultDuration = FileUtil.getVideoDuration(result);
assertTrue(Math.abs(sampleDuration - resultDuration) < 2);
}
Aggregations