[FFmpeg-trac] #6609(ffmpeg:new): SamplingRateBox should be used if the value is greater than INT16_MAX
FFmpeg
trac at avcodec.org
Wed Aug 23 17:23:23 EEST 2017
#6609: SamplingRateBox should be used if the value is greater than INT16_MAX
-------------------------------------+-------------------------------------
Reporter: fbeaufort | Owner:
Type: defect | Status: new
Priority: normal | Component: ffmpeg
Version: unspecified | Resolution:
Keywords: flac, | Blocked By:
isobmff, mp4 | Reproduced by developer: 0
Blocking: |
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Changes (by jyavenard):
* keywords: mov => flac, isobmff, mp4
* component: avformat => ffmpeg
Comment:
As present, ffmpeg if MODE_MOV is set, and a sampling rate greater thant
UINT16_MAX, can generate a .mov with SoundDescription that would be using
a 64 bits float for sampling rate.
For a mp4 (as defined in ISO 14496-12 12.2.3.2), it should be using a
AudioSampleEntryV1 defined as follow:
{{{
class AudioSampleEntryV1(codingname) extends SampleEntry (codingname){
unsigned int(16) entry_version; // must be 1,
// and must be in an stsd with
version ==1
const unsigned int(16)[3] reserved = 0;
template unsigned int(16) channelcount; // must be correct
template unsigned int(16) samplesize = 16;
unsigned int(16) pre_defined = 0;
const unsigned int(16) reserved = 0 ;
template unsigned int(32) samplerate = 1<<16;
// optional boxes follow
SamplingRateBox();
ChannelLayout();
// we permit any number of DownMix or DRC boxes:
DownMixInstructions() [];
DRCCoefficientsBasic() [];
DRCInstructionsBasic() [];
DRCCoefficientsUniDRC() [];
DRCInstructionsUniDRC() [];
Box (); // further boxes as needed
}
}}}
The samplerate would then be 65536 and there would be a SamplingRateBox
{{{
aligned(8) class SamplingRateBox extends FullBox(‘srat’) {
unsigned int(32) sampling_rate;
}
}}}
FFmpeg when generating a mp4 and if the sampling rate is greater than
65535, always write 0 as the sampling rate.
see
https://github.com/FFmpeg/FFmpeg/blame/5f4e555dc7caea343838e9f6f218525bb80216bf/libavformat/movenc.c#L974
Expected:
It should instead use a AudioSampleEntryV1 and a SamplingRateBox (srat)
For related bug, I've lodged gecko's bug 1393045
(https://bugzilla.mozilla.org/show_bug.cgi?id=1393045) and bug 1393039
(https://bugzilla.mozilla.org/show_bug.cgi?id=1393039)
--
Ticket URL: <https://trac.ffmpeg.org/ticket/6609#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list