[FFmpeg-devel] [PATCH 1/2] avformat/mov: parse sdtp atom and set the pkt disposable flag accordingly

Matthieu Bouron matthieu.bouron at gmail.com
Fri Sep 27 18:45:23 EEST 2019


On Fri, Sep 27, 2019 at 04:14:33PM +0100, Derek Buitenhuis wrote:
> On 27/09/2019 15:37, Matthieu Bouron wrote:
> > Allows the creation of the sdtp atom while remuxing MP4 to MP4. This
> > atom is required by Apple devices (iPhone, Apple TV) in order to accept
> > 2160p medias.
> 
> Can you point to a document about this (for informational purposes)?

For the MP4 container, tt is part of ISO/IEC14496-12 but it looks like it
is not public.

It is also described here for the QT container:
https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-SW46

The specification differs in wording and presentation between the two, but
the final encoded values of each flags are the same.

For both specs the flags are stored in 1 byte.

For sample_is_depended_on in QT, you have to use:

kQTSampleDependency_NoOtherSampleDependsOnThisSample = 1<<3,
kQTSampleDependency_OtherSamplesDependOnThisSample   = 1<<2,

In MP4, the spec describe the following layout for the flags:

      unsigned int(2) reserved = 0;  unsigned   int(2)
      sample_depends_on;             unsigned   int(2)
      sample_is_depended_on;         unsigned   int(2)
      sample_has_redundancy;         unsigned   int(2)

And values for sample_is_depended_on:

      0: the dependency of other samples on this sample is unknown
      1: other samples depend on this one (not disposable)
      2: no other sample depends on this one (disposable)
      3: reserved

NOTE: we already support the sdtp atom in movenc.c.

> 
> Is this valid for both QTFF and ISOBMFF?
> 
> >  static void mov_update_dts_shift(MOVStreamContext *sc, int duration)
> >  {
> >      if (duration < 0) {
> > @@ -6767,6 +6801,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
> >  { MKTAG('s','t','s','z'), mov_read_stsz }, /* sample size */
> >  { MKTAG('s','t','t','s'), mov_read_stts },
> >  { MKTAG('s','t','z','2'), mov_read_stsz }, /* compact sample size */
> > +{ MKTAG('s','d','t','p'), mov_read_sdtp }, /* independant and disposable samples */
> 
> Spelling mistake.

Fixed locally.

Thanks.

-- 
Matthieu B.


More information about the ffmpeg-devel mailing list