[FFmpeg-devel] [PATCH 1/4] libavformat/movenc: add dnxhr compatibility for apple players

Mark Reid mindmark at gmail.com
Tue Jul 19 06:39:49 EEST 2016


On Mon, Jul 18, 2016 at 6:27 PM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Mon, Jul 18, 2016 at 05:39:46PM -0700, Mark Reid wrote:
>> On Jul 18, 2016 5:11 PM, "Michael Niedermayer" <michael at niedermayer.cc>
>> wrote:
>> >
>> > On Mon, Jul 18, 2016 at 04:37:49PM -0700, Mark Reid wrote:
>> > > On Sun, Jul 17, 2016 at 4:35 AM, Michael Niedermayer
>> > > <michael at niedermayer.cc> wrote:
>> > > > On Sat, Jul 16, 2016 at 07:37:36PM -0700, Mark Reid wrote:
>> > > >> ---
>> > > >>  libavcodec/dnxhddec.c |  3 +++
>> > > >>  libavformat/movenc.c  | 19 ++++++++++++++-----
>> > > >>  2 files changed, 17 insertions(+), 5 deletions(-)
>> > > >
>> > > > this should be split
>> > > > a single patch changing both libs is a bit suspicous API wise
>> > > >
>> > > >
>> > > >>
>> > > >> diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
>> > > >> index 5b60326..4c6f708 100644
>> > > >> --- a/libavcodec/dnxhddec.c
>> > > >> +++ b/libavcodec/dnxhddec.c
>> > > >> @@ -204,6 +204,9 @@ static int dnxhd_decode_header(DNXHDContext
>> *ctx, AVFrame *frame,
>> > > >>      }
>> > > >>
>> > > >>      cid = AV_RB32(buf + 0x28);
>> > > >> +    if (cid >= 1270 && cid <= 1274)
>> > > >> +        ctx->avctx->codec_tag = MKTAG('A','V','d','h');
>> > > >
>> > > > codec_tag is documented as:
>> > > > * - decoding: Set by user, will be converted to uppercase by
>> libavcodec during init.
>> > > >
>> > > > this sets it in the decoder by libavcodec though
>> > > >
>> > >
>> > > okay, in that case I'll have to remove the same thing from the encoder
>> patch.
>> > > I saw some other codecs doing it so I assumed it was okay.
>> >
>> > several encoders set codec_tag, and the docs are a bit unclear about
>> > that ...
>> > * - encoding: Set by user, if not then the default based on codec_id will
>> be used.
>> >
>> > but i think no decoder sets it
>>
>> The issue I'm attempting to solve here is that there are two tags for the
>> same codec_id
>>
>> AVdn for dnxhd
>> AVdh for dnxhr (Note the H instead of N)
>>
>> av_codec_get_tag always returns the first tag because of the order in
>> isom.c ff_codec_movvideo_tags
>
> how hard is it to find out which it is from AVPacket.data ?
> if its easy then the mov muxer (is this the only that needs it?)
> could just check that to find which it is
> theres quite some existing code in ff_mov_write_packet() and
> functions called from it which analyze packets to satisfy the mov/mp4
> specs
>
> but thats just a random idea,
> dont listen to me if you have a cleaner/simpler/better solution
> maybe the profile can be used and is always set ...
>

If the dnxhd profile patch gets approved, I was simply going to use
the profile to set track->tag to the correct tag.

A issue is was having with that is av_dump_format will still print the
wrong tag. It prints AVFormatContext.codec_tag via avcodec_string in
libavcodec/utils.c:3154. But maybe I'm just getting carried away...

>
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Complexity theory is the science of finding the exact solution to an
> approximation. Benchmarking OTOH is finding an approximation of the exact
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list