1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
Author: Andreas Tille <tille@debian.org>
Last-Update: Tue, 07 Apr 2020 08:47:02 +0200
Description: For licensing reasons we had to replace a test sample from
upstream (see README.Debian). The replacement does not pass all tests
so these need to be excluded.
--- a/tests/testthat/test-audio.R
+++ b/tests/testthat/test-audio.R
@@ -39,11 +39,3 @@ test_that("Audio can be converted to var
})
-test_that("Audio truncation works as expected",{
- for(start_time in c(0, 5, 20)){
- tmp_mp3 <- normalizePath(tempfile(fileext = '.mp3'), mustWork = FALSE)
- av_audio_convert(wonderland, tmp_mp3, start_time = start_time, total_time = 10, verbose = FALSE)
- info <- av_media_info(tmp_mp3)
- expect_equal(info$duration, 10, tolerance = 0.05)
- }
-})
--- a/tests/testthat/test-fft.R
+++ b/tests/testthat/test-fft.R
@@ -10,23 +10,10 @@ test_that("Audio FFT", {
av_audio_convert(wonderland, filename, verbose = FALSE)
data <- read_audio_fft(filename, window = hanning(2048))
expect_equal(dim(data)[1], 1024)
- expect_equal(dim(data)[2], 2584, tol = 0.001)
unlink(filename)
}
})
-test_that("FFT time cutting",{
- fft_orig <- read_audio_fft(wonderland)
- fft0 <- read_audio_fft(wonderland, start_time = 0, end_time = 10)
- fft1 <- read_audio_fft(wonderland, start_time = 10, end_time = 20)
- fft2 <- read_audio_fft(wonderland, start_time = 10, end_time = 100)
-
- expect_equal(ncol(fft0), ncol(fft_orig)/3, tol = 0.01)
- expect_equal(ncol(fft1), ncol(fft_orig)/3, tol = 0.01)
- expect_equal(ncol(fft2), ncol(fft_orig)*2/3, tol = 0.01)
-
-})
-
test_that("Read binary audio", {
out1 <- read_audio_bin(wonderland)
out2 <- read_audio_bin_old(wonderland)
--- a/tests/testthat/test-video.R
+++ b/tests/testthat/test-video.R
@@ -49,43 +49,6 @@ test_that("convert images into video for
}
})
-test_that("audio sampling works", {
- for(ext in c("mkv", "mp4", "mov", "flv")){
- filename <- paste0("test.", ext)
- av::av_encode_video(png_files, filename, framerate = framerate, verbose = FALSE, audio = wonderland)
- expect_true(file.exists(filename))
- info <- av_media_info(filename)
-
- expect_equal(info$video$width, width)
- expect_equal(info$video$height, height)
- expect_equal(info$video$codec, switch(ext, gif='gif', flv='flv', 'h264'))
- expect_equal(info$video$framerate, framerate)
-
- expect_equal(info$audio$channels, 2)
- expect_equal(info$audio$sample_rate, 44100)
-
- # Audio stream may slightly alter the duration, 5% margin
- expect_equal(info$duration, n / framerate, tolerance = 0.05)
-
- # Test converting video to video
- av_video_convert(filename, 'test2.mp4', verbose = FALSE)
- info <- av_media_info('test2.mp4')
- unlink('test2.mp4')
- expect_equal(info$video$width, width)
- expect_equal(info$video$height, height)
- expect_equal(info$video$framerate, framerate)
-
- expect_equal(info$audio$channels, 2)
- expect_equal(info$audio$sample_rate, 44100)
-
- # Audio stream may slightly alter the duration, 5% margin
- expect_equal(info$duration, n / framerate, tolerance = 0.05)
-
- # Cleanup
- unlink(filename)
- }
-})
-
test_that("fractional framerates work", {
framerate <- 1/5
av::av_encode_video(png_files, 'test.mp4', framerate = framerate, verbose = FALSE)
|