Videos: Limit transcoding bitrate to 50M #703

This commit is contained in:
Michael Mayer 2021-02-15 15:48:45 +01:00
parent 50101cffdc
commit 0c1bdbfac6
2 changed files with 4 additions and 2 deletions

View file

@ -313,6 +313,8 @@ func (c *Convert) AvcBitrate(f *MediaFile) string {
if bitrate <= 0 {
return "8M"
} else if bitrate >= 50 {
return "50M"
}
return fmt.Sprintf("%dM", bitrate)

View file

@ -297,7 +297,7 @@ func TestConvert_AvcBitrate(t *testing.T) {
assert.Equal(t, "32M", convert.AvcBitrate(mf))
})
t.Run("133M", func(t *testing.T) {
t.Run("50M", func(t *testing.T) {
fileName := filepath.Join(conf.ExamplesPath(), "gopher-video.mp4")
assert.Truef(t, fs.FileExists(fileName), "input file does not exist: %s", fileName)
@ -311,6 +311,6 @@ func TestConvert_AvcBitrate(t *testing.T) {
mf.width = 4096
mf.height = 2160
assert.Equal(t, "133M", convert.AvcBitrate(mf))
assert.Equal(t, "50M", convert.AvcBitrate(mf))
})
}