Search in sources :

Example 1 with FFMpegProgressBarListener

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);
}
Also used : File(java.io.File) FFMpegProgressBarListener(com.bixly.pastevid.screencap.components.progressbar.FFMpegProgressBarListener) Test(org.junit.Test)

Example 2 with FFMpegProgressBarListener

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);
}
Also used : FFMpegProgressBarListener(com.bixly.pastevid.screencap.components.progressbar.FFMpegProgressBarListener) Test(org.junit.Test)

Example 3 with FFMpegProgressBarListener

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;
}
Also used : File(java.io.File) FFMpegProgressBarListener(com.bixly.pastevid.screencap.components.progressbar.FFMpegProgressBarListener) Test(org.junit.Test)

Example 4 with FFMpegProgressBarListener

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);
}
Also used : FFMpegProgressBarListener(com.bixly.pastevid.screencap.components.progressbar.FFMpegProgressBarListener) Ignore(org.junit.Ignore)

Example 5 with FFMpegProgressBarListener

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);
}
Also used : FFMpegProgressBarListener(com.bixly.pastevid.screencap.components.progressbar.FFMpegProgressBarListener) Test(org.junit.Test)

Aggregations

FFMpegProgressBarListener (com.bixly.pastevid.screencap.components.progressbar.FFMpegProgressBarListener)11 Test (org.junit.Test)9 File (java.io.File)5 DownloadThread (com.bixly.pastevid.download.DownloadThread)1 UnsupportedBitRateCompression (com.bixly.pastevid.recorders.UnsupportedBitRateCompression)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 MissingResourceException (java.util.MissingResourceException)1 LineUnavailableException (javax.sound.sampled.LineUnavailableException)1 JFrame (javax.swing.JFrame)1 JProgressBar (javax.swing.JProgressBar)1 Ignore (org.junit.Ignore)1