Opened 12 years ago

Closed 11 years ago

Last modified 2 years ago

#2070 closed enhancement (fixed)

Handling Multichannel BINK

Reported by: Dennis Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: bink
Cc: mirh Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
I have a BINK video that has three audio streams. I believe this is because it is used in a surround sound environment. I would like to purpose a change to the way FFmpeg handles these types of files. In this case, they should all be mixed together to produce the correct audio output. Currently, on a two channel system, it is missing a lot of the audio.

Additionally, as a work around, I tried the "amerge" filter but it does not allow for this type of conversion because the file has more then two audio streams.

FFmpeg & FFplay should be considered here.

How to reproduce:

ffmpeg -i "flashpoint_load.bik"
ffmpeg version N-48228-gceee440 Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec 27 2012 02:02:43 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --e
nable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --e
nable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwben
c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib
  libavutil      52. 12.100 / 52. 12.100
  libavcodec     54. 81.100 / 54. 81.100
  libavformat    54. 50.102 / 54. 50.102
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 30.101 /  3. 30.101
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, bink, from 'flashpoint_load.bik':
  Duration: 00:00:43.77, start: 0.000000, bitrate: 6393 kb/s
    Stream #0:0: Video: binkvideo (BIKi / 0x694B4942), yuv420p, 1280x720, 30 tbr
, 30 tbn, 30 tbc
    Stream #0:1: Audio: binkaudio_dct, 48000 Hz, stereo, fltp
    Stream #0:2: Audio: binkaudio_dct, 48000 Hz, mono, fltp
    Stream #0:3: Audio: binkaudio_dct, 48000 Hz, stereo, fltp
At least one output file must be specified

Change History (13)

comment:2 by Carl Eugen Hoyos, 12 years ago

I may misunderstand your issue but the following works as expected here:
$ ffmpeg -i flashpoint_load.bik -filter_complex amerge=inputs=3 out.wav

comment:3 by Dennis, 12 years ago

Your command works, thanks.
I was actualy thinking that these are handled wrong since, in this sample at least, all the channels are supposed to be mixed to produce the correct output. I may be wrong here though. Feel free to close if you want since I have a work around now.

Also, the "amerge" option is not avaliable in FFplay.

comment:4 by Elon Musk, 12 years ago

Resolution: invalid
Status: newclosed

comment:5 by Carl Eugen Hoyos, 12 years ago

Could you elaborate on why this is an invalid ticket?
Imo, the demuxer should set some metadata that the amerge filter has to be inserted for correct output, just as for tickets #162 and #1484.
Or are there bink samples with multiple audio streams that should be interpreted differently? Could this be signaled in the stream?

comment:6 by Carl Eugen Hoyos, 12 years ago

Component: undeterminedavformat
Keywords: bink added
Priority: normalwish
Resolution: invalid
Status: closedreopened
Type: defectenhancement
Version: unspecifiedgit-master

I believe this can be improved.

comment:7 by Elon Musk, 12 years ago

How? Other issues you mentioned have nothing in common with this one.

I do not see your logic behind adding hacks.

Last edited 12 years ago by Elon Musk (previous) (diff)

comment:8 by Carl Eugen Hoyos, 12 years ago

I believe that similarly to ticket #1764 the channel layout setting can be improved.
The improved setting could then be used by applications.

comment:9 by pross, 11 years ago

Resolution: invalid
Status: reopenedclosed

This is unfortunately a bug/feature of the Bink file format.

There is no information in the .BIK file describing which audio stream maps to which speaker. The mapping is done manually by the game programmer, and varies from game to game.

Quote: "For 5.1 or 7.1 audio, you simply mix multiple stereo or mono input files into different Bink tracks IDs, one at a time. These separate input files are called "stems" in video editing software. Once you have mixed all the input files into Bink audio tracks, just tell your programmers the layout of the Bink tracks (like, track ID 0 is front left-right, etc). The programmer then directs the Bink audio tracks to the proper speaker at runtime." -- http://www.radgametools.com/binkhmab.htm

You need to direct your grievances to RAD Game Tools, Inc.

comment:10 by Carl Eugen Hoyos, 11 years ago

So there are files with two (or more) audio streams that should not be mixed?

comment:11 by pross, 11 years ago

Yes. Here is an example. Audio stream [0x0] is the music track. The remaining audio streams give voice over in a different languages ([0x1] is English, [0x2] is French, ...).

Input #0, bink, from '01_Caribbean_devils_revenge.bk2':
  Duration: 00:00:37.87, start: 0.000000, bitrate: 6743 kb/s
    Stream #0:0[0x0]: Video: none (KB2g / 0x6732424B), 1280x720, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0:1[0x0]: Audio: binkaudio_dct, 48000 Hz, stereo, fltp
    Stream #0:2[0x1]: Audio: binkaudio_dct, 48000 Hz, mono, fltp
    Stream #0:3[0x4]: Audio: binkaudio_dct, 48000 Hz, mono, fltp
    Stream #0:4[0x5]: Audio: binkaudio_dct, 48000 Hz, mono, fltp
    Stream #0:5[0x6]: Audio: binkaudio_dct, 48000 Hz, mono, fltp
    Stream #0:6[0x7]: Audio: binkaudio_dct, 48000 Hz, mono, fltp
    Stream #0:7[0x8]: Audio: binkaudio_dct, 48000 Hz, mono, fltp
    Stream #0:8[0x9]: Audio: binkaudio_dct, 48000 Hz, mono, fltp
    Stream #0:9[0xa]: Audio: binkaudio_dct, 48000 Hz, mono, fltp

comment:12 by mirh, 3 years ago

Cc: mirh added
Version 0, edited 3 years ago by mirh (next)

comment:13 by mirh, 2 years ago

Resolution: invalidfixed
Note: See TracTickets for help on using tickets.