[FFmpeg-devel] [PATCH v6 1/2] lavf/isom: support for demuxing and remuxing of MPEG-H 3D Audio in MP4

James Almer jamrial at gmail.com
Wed Dec 11 20:15:25 EET 2019


On 12/11/2019 7:15 AM, Tsuchiya, Yuki (SHES) wrote:
> Hello James,
> 
> ´╗┐On 2019/12/10 22:30, "James Almer" <jamrial at gmail.com> wrote:
> 
>     >> diff --git a/libavformat/utils.c b/libavformat/utils.c
>     >> index 8196442dd1..70f9e23d8c 100644
>     >> --- a/libavformat/utils.c
>     >> +++ b/libavformat/utils.c
>     >> @@ -1021,7 +1021,8 @@ static int is_intra_only(enum AVCodecID id)
>     >>      const AVCodecDescriptor *d = avcodec_descriptor_get(id);
>     >>      if (!d)
>     >>          return 0;
>     >> -    if (d->type == AVMEDIA_TYPE_VIDEO && !(d->props & AV_CODEC_PROP_INTRA_ONLY))
>     >> +    if ((d->type == AVMEDIA_TYPE_VIDEO && !(d->props & AV_CODEC_PROP_INTRA_ONLY)) ||
>     >> +        id == AV_CODEC_ID_MPEGH_3D_AUDIO)
>     
>     >Instead of changing generic code like this to prevent all MPEG-H 3D
>     >Audio packets from being tagged as key, you should add a custom function
>     >much like the VC1 and the TrueHD ones called at the end of
>     >ff_mov_write_packet() to set the MOV_SYNC_SAMPLE flag and increase the
>     >track->has_keyframes counter where corresponds.
> 
> If the modification in the is_intra_only() is removed, all demuxed frames will be tagged as key frame.
> This means that all single frames got from av_read_frame() will be key frame so it is difficult to start decoding from actual key frame.
> I think this modification or something like other method for keeping key frame information from stss box is required.
> Do you have any idea?

I see now, this is during demuxing. I was thinking about muxing.
I can reproduce what you mean with TrueHD which has sync frames every
128 or so frames. Despite the mp4 and matroska files having the sync
frames correctly marked, lavf tags every frame as key.

A general approach at fixing this issue would be to change
is_intra_only() to not just look at video codecs but also audio codecs,
and updating all the audio entries in libavcodec/codec_desc.c that are
not currently set as AV_CODEC_PROP_INTRA_ONLY and require it.


More information about the ffmpeg-devel mailing list