[FFmpeg-devel] Fix bink audio playback outside of FFmpeg

Michael Niedermayer michaelni at gmx.at
Mon Jun 20 23:57:08 CEST 2011


On Thu, Jun 16, 2011 at 08:41:15PM +0300, Ivan Kalvachev wrote:
> On 6/16/11, Kostya <kostya.shishkov at gmail.com> wrote:
> > On Thu, Jun 16, 2011 at 04:22:15PM +0300, Ivan Kalvachev wrote:
> >> On 6/16/11, Kostya <kostya.shishkov at gmail.com> wrote:
> >> > On Thu, Jun 16, 2011 at 12:08:35PM +0300, Ivan Kalvachev wrote:
> >> >> The bink demuxer recognizes 2 separate audio codecs.
> >> >> However the demuxer sets same codec_tag for both of them.
> >> >> The tag is copied verbatim from the fileformat tag.
> >> >> FFmpeg works fine because the demuxer does set the
> >> >> correct distinctive codec_id for each of the audio codecs.
> >> >>
> >> >> Having same codec_tag for both audio codecs makes it
> >> >> impossible to distinguish them if player checks codec_tag
> >> >> before codecs_id.
> >> >>
> >> >> Do not set codec_tag thus force the player to rely on codec_id,
> >> >> just like in the bink video case.
> >> >> --
> >> >> The player in question is MPlayer. It does have a mechanism to
> >> >> override buggy codec_tags, but it's better to fix the bug at its
> >> >> source.
> >> >> I got this patch delayed coz I had to find some bink files to test it
> >> >> first.
> >> >>
> >> >> Michael, feel free to push.
> >> >
> >> > It was introduced for Bink-b variant of audio and probably will break
> >> > decoding
> >> > of it again. Samples for it are at
> >> > http://samples.multimedia.cx/game-formats/bink/bikb/
> >>
> >> None of these samples seems to contain audio.
> >> With or without the patch.
> >
> > The sample for it was in /incoming for a long time, called NWCLOGO.BIK, some
> > version of Heroes of Might and Magic III contained it (inside usual video
> > archive).
> >
> >> I did manage to find Peter's commit and mail, where he offers his own
> >> samples.
> >>
> >> Using codec_tag as sub-format specifier is wrong, as it is intended to
> >> be alias of codec_id. So either this info should be coded in separate
> >> set of codecs or to pass
> >> that info as artificially created extradata.
> >
> > Yes, putting the tag into extradata should be the right solution.
> 
> The proper patch is attached, it's description is:
> ====
> Fix bink audio playback outside of FFmpeg.
> 
> There are 2 known Bink audio codecs. Additionally they have
> a different flavor if they are found inside Bink-b "BIKb" file.
> In order to guess the correct flavor, the demuxer sets the audio
> codec_tag to be the same as the file format tag.
> This causes problem because same tag is used for both audio codecs.
> The hack works in FFmpeg because audio codecs are identified by their
> codec_id, but other players rely on standard behavior.
> 
> This fix removes the codec_tag hack and instead uses artificial
> extradata format to signal the codec flavor. This would also
> allow proper embedding of Bink audio in other containers.
> ====
> 
> Best Regards.

>  libavcodec/binkaudio.c |    3 ++-
>  libavformat/bink.c     |    4 +++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
> ff3b92de2badb89fa133ed19dba154054aba6f14  0001-Fix-bink-audio-playback-outside-of-FFmpeg.patch
> From 5d6efabf2415d79cbc105dcb2f0e51f98c6ea8ee Mon Sep 17 00:00:00 2001
> From: Ivan Kalvachev <ikalvachev at gmail.com>
> Date: Thu, 16 Jun 2011 19:35:33 +0300
> Subject: [PATCH] Fix bink audio playback outside of FFmpeg.
> 
> There are 2 known Bink audio codecs. Additionally they have
> a different flavor if they are found inside Bink-b "BIKb" file.
> In order to guess the correct flavor, the demuxer sets the audio
> codec_tag to be the same as the file format tag.
> This causes problem because same tag is used for both audio codecs.
> The hack works in FFmpeg because audio codecs are identified by their
> codec_id, but other players rely on standard behavior.
> 
> This fix removes the codec_tag hack and instead uses artificial
> extradata format to signal the codec flavor. This would also
> allow proper embedding of Bink audio in other containers.
> 
> Signed-off-by: Ivan Kalvachev <ikalvachev at gmail.com>
> ---
>  libavcodec/binkaudio.c |    3 ++-
>  libavformat/bink.c     |    4 +++-
>  2 files changed, 5 insertions(+), 2 deletions(-)

applied

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110620/eec6b250/attachment.asc>


More information about the ffmpeg-devel mailing list