Add test on calculateOptimalBitrate
This commit is contained in:
parent
e075529adb
commit
1db2830d44
1 changed files with 12 additions and 0 deletions
|
|
@ -64,4 +64,16 @@ class VideoCompressorHelperTest {
|
||||||
outputSize = helper.getOutputSize(inputSize)
|
outputSize = helper.getOutputSize(inputSize)
|
||||||
assertThat(outputSize).isEqualTo(Size(480, 640))
|
assertThat(outputSize).isEqualTo(Size(480, 640))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test calculateOptimalBitrate`() {
|
||||||
|
val helper = VideoCompressorHelper(maxSize = 720)
|
||||||
|
val inputSize = Size(1920, 1080)
|
||||||
|
var bitrate = helper.calculateOptimalBitrate(inputSize, frameRate = 30)
|
||||||
|
// Output size will be 720x405, so bitrate = 720*405*0.1*30 = 874800
|
||||||
|
assertThat(bitrate).isEqualTo(874800L)
|
||||||
|
// Half frame rate, half bitrate
|
||||||
|
bitrate = helper.calculateOptimalBitrate(inputSize, frameRate = 15)
|
||||||
|
assertThat(bitrate).isEqualTo(437400L)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue