Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#3269 closed defect (wontfix)

Can't remux BIK to MKV

Reported by: Vika Apelsinova Owned by:
Priority: normal Component: avformat
Version: unspecified Keywords: bink mkv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

There are 2 problems:
FFMPEG can't remux BIK with audio to MKV.
FFMPEG can remux BIK without audio to MKV, but produces unplayable output (FFPlay don't want to play MKV output).

ffmpeg -v 9 -loglevel 99 -i input.bik

ffmpeg version N-59532-gadc09a3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan  3 2014 22:07:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 59.100 / 52. 59.100
  libavcodec     55. 47.100 / 55. 47.100
  libavformat    55. 22.102 / 55. 22.102
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.103 /  4.  0.103
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument
'9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level)
with argument '99'.
Reading option '-i' ... matched as input file with argument 'input.bik'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file input.bik.
Successfully parsed a group of options.
Opening an input file: input.bik.
[bink @ 0000000002856a80] Format bink probed with size=2048 and score=100
[bink @ 0000000002856a80] Before avformat_find_stream_info() pos: 732 bytes read
:32768 seeks:0
[bink @ 0000000002856a80] All info found
[bink @ 0000000002856a80] After avformat_find_stream_info() pos: 2784 bytes read
:32768 seeks:0 frames:2
Input #0, bink, from 'input.bik':
  Duration: 00:00:06.72, start: 0.000000, bitrate: 2527 kb/s
    Stream #0:0[0x0], 1, 1/25: Video: binkvideo (BIKi / 0x694B4942), yuv420p, 64
0x480, 1/25, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1[0x0], 1, 1/44100: Audio: binkaudio_dct, 44100 Hz, stereo, fltp
Successfully opened the file.
At least one output file must be specified
[AVIOContext @ 0000000002857020] Statistics: 32768 bytes read, 0 seeks

ffmpeg -i input.bik -c copy output.mkv

ffmpeg version N-59532-gadc09a3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan  3 2014 22:07:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 59.100 / 52. 59.100
  libavcodec     55. 47.100 / 55. 47.100
  libavformat    55. 22.102 / 55. 22.102
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.103 /  4.  0.103
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, bink, from 'input.bik':
  Duration: 00:00:06.72, start: 0.000000, bitrate: 2527 kb/s
    Stream #0:0[0x0]: Video: binkvideo (BIKi / 0x694B4942), yuv420p, 640x480, 25
 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1[0x0]: Audio: binkaudio_dct, 44100 Hz, stereo, fltp
[matroska @ 0000000004ec00a0] No wav codec tag found for codec binkaudio_dct
Output #0, matroska, to 'output.mkv':
  Metadata:
    encoder         : Lavf55.22.102
    Stream #0:0: Video: binkvideo (BIKi / 0x694B4942), yuv420p, 640x480, q=2-31,
 25 fps, 1k tbn, 25 tbc
    Stream #0:1: Audio: binkaudio_dct, 44100 Hz, stereo
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Error
number -22 occurred

ffplay -i output.mkv

ffplay version N-59532-gadc09a3 Copyright (c) 2003-2014 the FFmpeg developers
  built on Jan  3 2014 22:07:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 59.100 / 52. 59.100
  libavcodec     55. 47.100 / 55. 47.100
  libavformat    55. 22.102 / 55. 22.102
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.103 /  4.  0.103
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
output.mkv: End of fileq=    0KB vq=    0KB sq=    0B f=0/0

ffmpeg -v 9 -loglevel 99 -i output.mkv

ffmpeg version N-59532-gadc09a3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan  3 2014 22:07:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 59.100 / 52. 59.100
  libavcodec     55. 47.100 / 55. 47.100
  libavformat    55. 22.102 / 55. 22.102
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.103 /  4.  0.103
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument
'9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level)
with argument '99'.
Reading option '-i' ... matched as input file with argument 'output.mkv'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file output.mkv.
Successfully parsed a group of options.
Opening an input file: output.mkv.
[matroska,webm @ 0000000002886a80] Format matroska,webm probed with size=2048 an
d score=100
[AVIOContext @ 0000000002887020] Statistics: 554 bytes read, 0 seeks
output.mkv: End of file

ffmpeg -i input.bik -vcodec copy -an output-noaudio.mkv

ffmpeg version N-59532-gadc09a3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan  3 2014 22:07:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 59.100 / 52. 59.100
  libavcodec     55. 47.100 / 55. 47.100
  libavformat    55. 22.102 / 55. 22.102
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.103 /  4.  0.103
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, bink, from 'input.bik':
  Duration: 00:00:06.72, start: 0.000000, bitrate: 2527 kb/s
    Stream #0:0[0x0]: Video: binkvideo (BIKi / 0x694B4942), yuv420p, 640x480, 25
 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1[0x0]: Audio: binkaudio_dct, 44100 Hz, stereo, fltp
Output #0, matroska, to 'output-noaudio.mkv':
  Metadata:
    encoder         : Lavf55.22.102
    Stream #0:0: Video: binkvideo (BIKi / 0x694B4942), yuv420p, 640x480, q=2-31,
 25 fps, 1k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  168 fps=0.0 q=-1.0 Lsize=    2051kB time=00:00:06.72 bitrate=2499.9kbits
/s
video:2044kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.319265%

ffplay -i output-noaudio.mkv

ffplay version N-59532-gadc09a3 Copyright (c) 2003-2014 the FFmpeg developers
  built on Jan  3 2014 22:07:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 59.100 / 52. 59.100
  libavcodec     55. 47.100 / 55. 47.100
  libavformat    55. 22.102 / 55. 22.102
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.103 /  4.  0.103
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
[matroska,webm @ 0000000000346a40] Unknown/unsupported AVCodecID V_MS/VFW/FOURCC
.
[matroska,webm @ 0000000000346a40] Could not find codec parameters for stream 0
(Video: none (BIKi / 0x694B4942), 640x480): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
output-noaudio.mkv: could not find codec parameters

ffmpeg -v 9 -loglevel 99 -i output-noaudio.mkv

ffmpeg version N-59532-gadc09a3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan  3 2014 22:07:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 59.100 / 52. 59.100
  libavcodec     55. 47.100 / 55. 47.100
  libavformat    55. 22.102 / 55. 22.102
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.103 /  4.  0.103
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument
'9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level)
with argument '99'.
Reading option '-i' ... matched as input file with argument 'output-noaudio.mkv'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file output-noaudio.mkv.
Successfully parsed a group of options.
Opening an input file: output-noaudio.mkv.
[matroska,webm @ 0000000002896ae0] Format matroska,webm probed with size=2048 an
d score=100
[matroska,webm @ 0000000002896ae0] Unknown/unsupported AVCodecID V_MS/VFW/FOURCC
.
st:0 removing common factor 1000000 from timebase
[matroska,webm @ 0000000002896ae0] Before avformat_find_stream_info() pos: 565 b
ytes read:32768 seeks:0
[matroska,webm @ 0000000002896ae0] parser not found for codec none, packets or t
imes may be invalid.
    Last message repeated 1 times
[matroska,webm @ 0000000002896ae0] max_analyze_duration 5000000 reached at 50000
00 microseconds
[matroska,webm @ 0000000002896ae0] Could not find codec parameters for stream 0
(Video: none (BIKi / 0x694B4942), 640x480, 1/1000): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[matroska,webm @ 0000000002896ae0] After avformat_find_stream_info() pos: 149831
1 bytes read:1508281 seeks:0 frames:125
output-noaudio.mkv: could not find codec parameters
[AVIOContext @ 00000000028970c0] Statistics: 1508281 bytes read, 0 seeks

Change History (13)

comment:1 Changed 6 years ago by pross

  • Reproduced by developer set

The Bink video and audio codecs are specific to the Bink container.

No other container supports the Bink codecs. So while you can create an MKV or AVI file containing BIKi compressed video, no other player will know how to play it back.

[matroska,webm @ 0000000002896ae0] Could not find codec parameters for stream 0
(Video: none (BIKi / 0x694B4942), 640x480, 1/1000): unknown codec

FFmpeg gives an error when you try to copy Bink audio into an unsuitable container. I think it should give similar error for the video.

comment:2 Changed 6 years ago by Vika Apelsinova

FFmpeg gives an error when you try to copy Bink audio into an unsuitable container.

Matroska can not be unsuitable container by definition.

Matroska is designed as universal multimedia container.

From Matroska description: Matroska is extensible, open source, open standard multimedia container. Matroska can support any codec that is around. That doesn't mean softwares should support all of them.

Keywords: "extensible" and "any codec".

"V_MS/VFW/FOURCC / BIKi" is right CodecID?

FFMPEG supports Bink codec and Matroska container separately, but does not support Bink codec in Matroska container.

If FFMPEG (FFPlay) will be able support Bink codec in Matroska container, other players based on FFMPEG will support (will be able to play) it too.

comment:3 Changed 6 years ago by cehoyos

  • Component changed from undetermined to avformat
  • Keywords bink mkv added
  • Reproduced by developer unset
  • Resolution set to invalid
  • Status changed from new to closed

As explained, please forward your request to the Matroska maintainers, it is important that FFmpeg does not mux files that neither conform to any specifications nor can be played by any other software.

comment:4 Changed 6 years ago by pross

Just on

"V_MS/VFW/FOURCC / BIKi" is right CodecID?

BIKi is the just the tag found in the Bink container.

For Matroska to support Bink properly two things are needed:

  1. Matroska codec tags for the Bink audio and video variants.
  1. Agreement on the extradata format.

comment:5 Changed 6 years ago by Vika Apelsinova

  • Resolution invalid deleted
  • Status changed from closed to reopened

it is important that FFmpeg does not mux files that neither conform to any specifications nor can be played by any other software.

MPlayer and other players based on MPlayer like SMPlayer, UMPlayer, KMPlayer, etc. (GUI front-ends for each of the operating systems on which MPlayer runs) plays it successfully.

please forward your request to the Matroska maintainers

Moritz Bunkus a.k.a. mosu wrote:

we don't add CodecIDs for each and every codec out there, especially
not for fringe formats like game video codecs. Simply mux in AVI/VfW
compatibility mode (CodecID V_MS/VFW/FOURCC) and put the usual
BITMAPINFOHEADER into CodecPrivate. That's the way most video codecs
including MPEG-4 part 2 or VC1 are muxed.

comment:6 Changed 6 years ago by cehoyos

  • Resolution set to wontfix
  • Status changed from reopened to closed

Unfortunately, there is no FourCC for Bink, so this will be impossible to implement if I understand mosu correctly.

comment:7 follow-up: Changed 6 years ago by Vika Apelsinova

Unfortunately, there is no FourCC for Bink

http://fourcc.org/bink/

comment:8 in reply to: ↑ 7 Changed 6 years ago by cehoyos

Replying to Vika Apelsinova:

Unfortunately, there is no FourCC for Bink

http://fourcc.org/bink/

The first sentence of http://wiki.multimedia.cx/index.php?title=Bink_Video seems to imply that this cannot be correct.

comment:9 Changed 6 years ago by richardpl

Ask matroska people not us.

comment:10 follow-up: Changed 6 years ago by Vika Apelsinova

Commit f5f6e59495a34db0f11ceb4c33b119888698562c does not solve the problem. It only adds warning and only for Matroska container.
The problem reproduces for other containers (not only for Matroska) e.g. AVI. I can remux BIK to AVI and FFMPEG don't show any warnings. MPlayer can play AVI Bink files, and FFPlay can't.
The problem is FFMPEG (FFPlay) can't decode its own output.
And I think the problem reproduces for other codecs (not only for Bink).
Why MPlayer can decode FFMPEG's output and FFMPEG can't decode its own output?

comment:11 in reply to: ↑ 10 Changed 6 years ago by cehoyos

Replying to Vika Apelsinova:

Why MPlayer can decode FFMPEG's output and FFMPEG can't decode its own output?

MPlayer is less strict / has a simpler method to determine codecs.

comment:12 follow-up: Changed 6 years ago by Vika Apelsinova

Unfortunately, there is no FourCC for Bink​

http://fourcc.org/bink/

I mean that there are officially registered FourCCs for Bink: BINK, BIKb, BIKd, BIKf, BIKg, BIKh, BIKi.


if I understand mosu correctly.

You don't need a new CodecID for that. That's what I'm trying to tell you.

Use V_MS/VFW/FOURCC as the CodecID. Then create a BITMAPINFOHEADER
structure same as in an AVI file, use 'BINK' as the FourCC in it, and
put that structure into CodecPrivate.

That's all there is to it.
> Use V_MS/VFW/FOURCC as the CodecID.

< You mean as Video CodecID? BIK files can contain multiple streams
(one video stream compressed by Bink video codec and multiple audio streams
compressed by Bink audio codec). What should we use as Audio CodecID for
audio streams? Is there equivalent of the V_MS/VFW/FOURCC for audio
streams?

> No, there isn't something like that for audio. You can chose
an arbitrary CodecID (e.g. A_BINK) and define your own format for CodecPrivate.
Then put that stuff into Matroska.

Commit f5f6e59495a34db0f11ceb4c33b119888698562c does not solve the problem. It only adds warning and only for Matroska container.
The problem reproduces for other containers (not only for Matroska) e.g. AVI. I can remux BIK to AVI and FFMPEG don't show any warnings.

I mean that we need warnings for other containers (not only for Matroska).

comment:13 in reply to: ↑ 12 Changed 6 years ago by cehoyos

Replying to Vika Apelsinova:

Unfortunately, there is no FourCC for Bink​

http://fourcc.org/bink/

I mean that there are officially registered FourCCs for Bink: BINK, BIKb, BIKd, BIKf, BIKg, BIKh, BIKi.

Where are they registered?

The problem reproduces for other containers (not only for Matroska) e.g. AVI. I can remux BIK to AVI and FFMPEG don't show any warnings.

avi is a general purpose container and in the end the user is responsible what he puts into it.

I mean that we need warnings for other containers (not only for Matroska).

I am not 100% sure this is needed but please send a patch for discussion.

Note: See TracTickets for help on using tickets.