mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avformat/movenc: use more fall-back values for average bit rate fields
If the average bit rate cannot be calculated, such as in the case of streamed fragmented mp4, utilize various available parameters in priority order. Tests are updated where the esds or btrt or ISML manifest boxes' output changes.
This commit is contained in:
parent
3838e8fc21
commit
308882d9f2
@ -648,6 +648,23 @@ static struct mpeg4_bit_rate_values calculate_mpeg4_bit_rates(MOVTrack *track)
|
||||
struct mpeg4_bit_rate_values bit_rates = { 0 };
|
||||
|
||||
bit_rates.avg_bit_rate = compute_avg_bitrate(track);
|
||||
if (!bit_rates.avg_bit_rate) {
|
||||
// if the average bit rate cannot be calculated at this point, such as
|
||||
// in the case of fragmented MP4, utilize the following values as
|
||||
// fall-back in priority order:
|
||||
//
|
||||
// 1. average bit rate property
|
||||
// 2. bit rate (usually average over the whole clip)
|
||||
// 3. maximum bit rate property
|
||||
|
||||
if (props && props->avg_bitrate) {
|
||||
bit_rates.avg_bit_rate = props->avg_bitrate;
|
||||
} else if (track->par->bit_rate) {
|
||||
bit_rates.avg_bit_rate = track->par->bit_rate;
|
||||
} else if (props && props->max_bitrate) {
|
||||
bit_rates.avg_bit_rate = props->max_bitrate;
|
||||
}
|
||||
}
|
||||
|
||||
// (FIXME should be max rate in any 1 sec window)
|
||||
bit_rates.max_bit_rate = FFMAX(track->par->bit_rate,
|
||||
|
@ -1,9 +1,9 @@
|
||||
4c6bc5ac805a76bbbd886a69d2e61554 *tests/data/lavf/lavf.ismv
|
||||
48fb8d7a5d19bd60f3a49ccf4b7d6593 *tests/data/lavf/lavf.ismv
|
||||
313169 tests/data/lavf/lavf.ismv
|
||||
tests/data/lavf/lavf.ismv CRC=0x9d9a638a
|
||||
18678627921460328ea3fed238d0d57d *tests/data/lavf/lavf.ismv
|
||||
d19cd8e310a2e94fe0a0d11c5dc29217 *tests/data/lavf/lavf.ismv
|
||||
322075 tests/data/lavf/lavf.ismv
|
||||
tests/data/lavf/lavf.ismv CRC=0xe8130120
|
||||
b9a858caf55b1eff2273e746e9f72dc4 *tests/data/lavf/lavf.ismv
|
||||
3b6023766845b51b075aed474c00f73c *tests/data/lavf/lavf.ismv
|
||||
312546 tests/data/lavf/lavf.ismv
|
||||
tests/data/lavf/lavf.ismv CRC=0x9d9a638a
|
||||
|
Loading…
Reference in New Issue
Block a user