[FFmpeg-devel] [PATCH] avformat/movenc: allow writing out channel count in MP4 and 3GP

Jan Ekström jeebjp at gmail.com
Tue Feb 14 21:27:36 EET 2023


On Thu, Feb 9, 2023 at 9:24 PM Jan Ekström <jeebjp at gmail.com> wrote:
>
> On Thu, Feb 9, 2023 at 12:08 PM Martin Storsjö <martin at martin.st> wrote:
> >
> > This looks reasonable to me. I didn't follow the references in the commit
> > message, but it sounds plausible and probably correct to me.
> >
>
> For the record, due to dumb ISO/IEC rule changes regarding how
> specifications need to be authorized to be free after 2015, it's
> relatively hard to verify the 14496-12 part.
>
> The last version of 14496-12 that was freely available (2015) defined
> channelcount in AudioSampleEntry as follows:
>
> template unsigned int(16) channelcount = 2;
>
> Meanwhile the latest 2022 edition defines the related structure(s) as follows:
>
> class AudioSampleEntry(codingname) extends SampleEntry (codingname) {
>    const unsigned int(32)[2] reserved = 0;
>    unsigned int(16) channelcount;
>    template unsigned int(16) samplesize = 16;
>    unsigned int(16) pre_defined = 0;
>    const unsigned int(16) reserved = 0 ;
>    template unsigned int(32) samplerate = { default samplerate of media} << 16;
>    // optional boxes follow
>    Box ();      // further boxes as needed
>    ChannelLayout();
>    DownMixInstructions() [];
>    DRCCoefficientsBasic() [];
>    DRCInstructionsBasic() [];
>    DRCCoefficientsUniDRC() [];
>    DRCInstructionsUniDRC() [];
>    // we permit only one DRC Extension box:
>    UniDrcConfigExtension();
>    // optional boxes follow
>    SamplingRateBox();
>    ChannelLayout();
> }
>
> aligned(8) class SamplingRateBox extends FullBox('srat') {
>    unsigned int(32) sampling_rate;
> }
>
> class AudioSampleEntryV1(codingname) extends SampleEntry (codingname) {
>    unsigned int(16) entry_version;   // shall be 1,
>                      // and shall be in an stsd with version ==1
>    const unsigned int(16)[3] reserved = 0;
>    template unsigned int(16) channelcount;   // shall 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();
>    Box ();      // further boxes as needed
>    ChannelLayout();
>    DownMixInstructions() [];
>    DRCCoefficientsBasic() [];
>    DRCInstructionsBasic() [];
>    DRCCoefficientsUniDRC() [];
>    DRCInstructionsUniDRC() [];
>    // we permit only one DRC Extension box:
>    UniDrcConfigExtension();
>    // optional boxes follow
>    ChannelLayout();
> }

Applied to master as 02ddfeadbee52c1ad8c023a93594a8cb957e11db .

Jan


More information about the ffmpeg-devel mailing list