Use variable bitrate mode when transcoding to ensure compatibility with old devices (#5223)
* Use variable bitrate mode when transcoding This should be compatible with more devices that may lack the needed codecs to properly encode using constant bitrate mode (CBR). * Fix video output size (again)
This commit is contained in:
parent
2535b08004
commit
fa755e5b75
3 changed files with 11 additions and 12 deletions
|
|
@ -27,7 +27,11 @@ class VideoCompressorHelper(
|
|||
fun getOutputSize(inputSize: Size): Size {
|
||||
val resultMajor = min(inputSize.major(), maxSize)
|
||||
val aspectRatio = inputSize.major().toFloat() / inputSize.minor().toFloat()
|
||||
return Size(resultMajor, (resultMajor / aspectRatio).roundToInt())
|
||||
return if (inputSize.width >= inputSize.height) {
|
||||
Size(resultMajor, (resultMajor / aspectRatio).roundToInt())
|
||||
} else {
|
||||
Size((resultMajor / aspectRatio).roundToInt(), resultMajor)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue