Opened 13 years ago

Closed 13 years ago

#962 closed defect (fixed)

Bink - ffmpeg is unable to decode some small files with only one frame

Reported by: bgk Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: bink
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

When trying to transcode Bink movies to a serie of PNG images, some small (less than 500 bytes) won't decode.
ffmpeg fails with the error "Error while decoding stream #0:0", see the attached log for the full output.

There are a dozen of such files in the game "Myst III Exile". They play fine in game.

Attachments (2)

ffmpeg-20120131-173344.log (6.6 KB ) - added by bgk 13 years ago.
bink-24px.patch (524 bytes ) - added by bgk 13 years ago.

Download all attachments as: .zip

Change History (12)

by bgk, 13 years ago

Attachment: ffmpeg-20120131-173344.log added

comment:1 by Elon Musk, 13 years ago

If you want this issue to get fixed anytime soon you will need provide sample(s).

comment:2 by bgk, 13 years ago

Sample NACH-19248.bik uploaded on upload.ffmpeg.org.

comment:3 by Carl Eugen Hoyos, 13 years ago

Keywords: bink added
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master
$ ffmpeg -i NACH-19248.bik out.avi
ffmpeg version N-37413-g0a3a69e Copyright (c) 2000-2012 the FFmpeg developers
  built on Feb  1 2012 00:22:53 with gcc 4.5.3
  configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc --enable-libopenjpeg
  libavutil      51. 36.100 / 51. 36.100
  libavcodec     54.  0.102 / 54.  0.102
  libavformat    54.  0.100 / 54.  0.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 60.100 /  2. 60.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
Input #0, bink, from 'NACH-19248.bik':
  Duration: 00:00:00.06, start: 0.000000, bitrate: 44 kb/s
    Stream #0:0: Video: binkvideo (BIKi / 0x694B4942), yuva420p, 24x48, 15 tbr, 15 tbn, 15 tbc
Incompatible pixel format 'yuva420p' for codec 'mpeg4', auto-selecting format 'yuv420p'
[buffer @ 0x13f46e0] w:24 h:48 pixfmt:yuva420p tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x13f4ae0] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'out'
[scale @ 0x13f5380] w:24 h:48 fmt:yuva420p -> w:24 h:48 fmt:yuv420p flags:0x4
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf54.0.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 24x48, q=2-31, 200 kb/s, 15 tbn, 15 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (binkvideo -> mpeg4)
Press [q] to stop, [?] for help
Error while decoding stream #0:0
frame=    0 fps=  0 q=0.0 Lsize=       6kB time=00:00:00.00 bitrate=   0.0kbits/s
video:0kB audio:0kB global headers:0kB muxing overhead inf%
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

comment:4 by Elon Musk, 13 years ago

Please add link to sample(s).

comment:5 by bgk, 13 years ago

These samples (24x48) won't decode :
http://www.bouclet.fr/bink/NACH-19248.bik
http://www.bouclet.fr/bink/NACH-21248.bik

This sample is mostly the same, except 16x48, but decodes properly :
http://www.bouclet.fr/bink/NACH-23248.bik

All these sample only have one frame with an alpha channel.
Please tell me if you need more samples.

comment:6 by bgk, 13 years ago

After a bit more testing, the source of the bug is narrowed down to the width of the movie being 24px.
It seems unrealated to the number of frames, since I found a sample that won't decode and has 10 frames (24x53).
Maybe something is wrong in init_lengths?

by bgk, 13 years ago

Attachment: bink-24px.patch added

comment:7 by bgk, 13 years ago

The attached patch "bink-24px.patch" fixes the bug, and does not seem to break anything. However it is total guesswork. Can someone with some bink experience take a look at it?

comment:8 by Michael Niedermayer, 13 years ago

Do you have bink files with other widths ?
it would be interresting to test a few that fall close to the values at which the len changes to make sure this is right.
I dont have any bink spec and http://wiki.multimedia.cx is not very complete. Maybe kostya/peter/mike know more but it shouldnt be hard to get this right by just testing a few widths

comment:9 by bgk, 13 years ago

Actually, I'm working on a rewrite of the engine behind Myst III Exile. A similar fix has been applied to our Bink decoder a few days ago (https://github.com/residualvm/residualvm/commit/096e4af64a20757661dcab85ff5c23b80c633540). The game uses dozens of widths in the range 8-640px. So far no regression has been noticed.

comment:10 by Carl Eugen Hoyos, 13 years ago

Resolution: fixed
Status: openclosed

Patch applied, thank you for the report and the analysis!

Note: See TracTickets for help on using tickets.