[FFmpeg-devel] [PATCH] Incorrect aspect ratio in MPEG2 essence
Michael Niedermayer
michaelni at gmx.at
Tue Dec 9 16:01:26 CET 2014
On Tue, Dec 09, 2014 at 10:21:01AM +0100, Erik Johansson wrote:
> On Thu, Dec 4, 2014 at 5:27 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> >
> > On Thu, Dec 04, 2014 at 01:11:08PM +0100, Erik Johansson wrote:
> > > Hi,
> > >
> > > Setting setting sample_aspect_ratio in AVContext does not produce the
> > > expected aspect index value in the MPEG2 sequence header.
> > >
> > > Problem seems to be around line 263 in mpeg12enc.c. Setting the
> > > sample_aspect_ratio to 16/9 leads the current error minimization
> > > routine to determine that
> > >
> > > error -= (1LL<<32)*(221/100)*(1080/1920)
> > >
> > > is smaller than
> > >
> > > error -= (1LL<<32)*(16/9)*(1080/1920)
> > >
> > > thus picking aspect index value 4 rather than 3.
> > >
> > > Proposed fix in attached patch.
> >
> > how can this bug be reproduced ?
> >
>
> The problem was detected by a client using 'Baton', file based QC
> software from Interra Systems.
>
> In summary, we create the MPEG2 essence as follows:
>
> m_avcodec = avcodec_find_encoder(CODEC_ID_MPEG2VIDEO)
> m_avcontext = avcodec_alloc_context3(m_avcodec)
> m_avcontext->sample_aspect_ratio = (AVRational){16,9}
This is incorrect you mixup sample and display aspect
> m_avcontext->width = 1920
> m_avcontext->width = 1080
there is probably a typo in there
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is what and why we do it that matters, not just one of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141209/56ac64b9/attachment.asc>
More information about the ffmpeg-devel
mailing list