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

Ivan Kalvachev ikalvachev at gmail.com
Thu Jun 16 19:41:15 CEST 2011


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-bink-audio-playback-outside-of-FFmpeg.patch
Type: application/octet-stream
Size: 2629 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110616/30505400/attachment.obj>


More information about the ffmpeg-devel mailing list