Fix bitrate value used for video transcoding (#5183)

* Fix bitrate value used for video transcoding:

It should be 1000 times what it is now. The video size estimation was wrong since the retrieved duration value was in milliseconds, not seconds.

* Use `Duration` as the result type for `getDuration`
This commit is contained in:
Jorge Martin Espinosa 2025-08-18 23:12:11 +02:00 committed by GitHub
parent 90ad9616c0
commit 85b0f11ab6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 8 deletions

View file

@ -38,7 +38,7 @@ class VideoCompressorHelper(
val pixelsPerFrame = outputSize.width * outputSize.height
// Apparently, 0.1 bits per pixel is a sweet spot for video compression
val bitsPerPixel = 0.1f
return (pixelsPerFrame * bitsPerPixel * frameRate).toLong() / 1000
return (pixelsPerFrame * bitsPerPixel * frameRate).toLong()
}
}