Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#252 closed defect (fixed)

Muxing rawvideo in matroska is unsupported, but does not warn

Reported by: Kenney Westerhof Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mkv rawvideo pix_fmt
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

The error:

[buffer @ 00000000003F8E80] Invalid pixel format string '-1'
Error opening filters!

I am converting an mkv file with a V_UNCOMPRESSED or -vcodec rawvideo
video stream to any other stream, let's say .avi.

First create the .mkv with rawvideo using any (short) valid video file,
such as an avi:

$ ffmpeg -i goodfile.avi -vcodec rawvideo test.mkv
[See output 1 below]

Next, I convert the mkv, which doesn't play ofcourse, back to
avi:

$ ffmpeg -i test.mkv test.avi
[See output 2 below]

The first step is just for you guys to be able to test this.
I need to be able to pipe uncompressed frames with a timecode
to ffmpeg.exe commandline, and mkv seems one of the only formats
that allows this, as the rest either doesn't have VFR or uncompressed frames. And no, I cannot use the libs.

Here is output 1, no problems here:

ffmpeg version git-N-30155-g01a73d6, Copyright (c) 2000-2011 the FFmpeg developers
  built on May 23 2011 03:47:41 with gcc 4.5.3
  configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib --pkg-config=pkg-config
  libavutil    51.  2. 1 / 51.  2. 1
  libavcodec   53.  6. 0 / 53.  6. 0
  libavformat  53.  2. 0 / 53.  2. 0
  libavdevice  53.  0. 0 / 53.  0. 0
  libavfilter   2. 10. 0 /  2. 10. 0
  libswscale    0. 14. 0 /  0. 14. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[avi @ 000000000033A0C0] non-interleaved AVI
Input #0, avi, from 'goodfile.avi':
  Duration: 00:00:02.54, start: 0.000000, bitrate: 298619 kb/s
    Stream #0.0: Video: rawvideo, bgr24, 960x540, 24 tbr, 24 tbn, 24 tbc
[buffer @ 000000000033CD60] w:960 h:540 pixfmt:bgr24 tb:1/1000000 sar:0/1 sws_param:
Output #0, matroska, to 'test.mkv':
  Metadata:
    encoder         : Lavf53.2.0
    Stream #0.0: Video: rawvideo, bgr24, 960x540, q=2-31, 200 kb/s, 1k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=   60 fps=  0 q=0.0 size=   91112kB time=2.40 bitrate=310996.0kbits/s    
frame=   61 fps=  0 q=0.0 Lsize=   92647kB time=2.44 bitrate=311049.8kbits/s    

video:92644kB audio:0kB global headers:0kB muxing overhead 0.003153%

And here is output 2, the problem:

ffmpeg version git-N-30155-g01a73d6, Copyright (c) 2000-2011 the FFmpeg developers
  built on May 23 2011 03:47:41 with gcc 4.5.3
  configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib --pkg-config=pkg-config
  libavutil    51.  2. 1 / 51.  2. 1
  libavcodec   53.  6. 0 / 53.  6. 0
  libavformat  53.  2. 0 / 53.  2. 0
  libavdevice  53.  0. 0 / 53.  0. 0
  libavfilter   2. 10. 0 /  2. 10. 0
  libswscale    0. 14. 0 /  0. 14. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[matroska,webm @ 00000000003F9F20] Estimating duration from bitrate, this may be inaccurate
Input #0, matroska,webm, from 'test.mkv':
  Metadata:
    ENCODER         : Lavf53.2.0
  Duration: 00:00:02.44, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: rawvideo, 960x540, PAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 25 tbc (default)
[buffer @ 00000000003F8E80] Invalid pixel format string '-1'
Error opening filters!

Now, I realize that there is nowhere in the file stored what the pixel format is. Even when I specify -pix_fmt rgb24 I get this error.

Also, according to the specs ( http://www.matroska.org/technical/specs/index.html ) there is a ColourSpace field that might be used
but is not written.

Btw if there is a workaround to this by specifying internal filters like -vf buffer or something in the mean time (I tried..), I'd appreciate it;)

Attachments (5)

test.mkv.gz (395.2 KB ) - added by Kenney Westerhof 14 years ago.
gives the invalid pixel format string error; gunzip first (as it is rawvideo i gzipped it)
test2.mkv.gz (15.7 KB ) - added by Kenney Westerhof 14 years ago.
this file is 64x64 and does not give the invalid pix fmt error but says 'cannot find codec parameters'
good.avi (70.2 KB ) - added by Kenney Westerhof 14 years ago.
ffmpeg -i good.avi -vcodec rawvideo test.mkv
good2.avi (9.9 KB ) - added by Kenney Westerhof 14 years ago.
ffmpeg -i good2.avi -vcodec rawvideo test2.mkv
patchmatroskaraw.diff (751 bytes ) - added by Carl Eugen Hoyos 14 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Carl Eugen Hoyos, 14 years ago

Reproduced by developer: set
Status: newopen
Summary: matroska/rawvideo decoding gives invalid pixel format string -1 @ bufferMuxing rawvideo in matroska is unsupported, but does not warn
Version: gitgit-master

If you believe that FFmpeg fails to read a valid mkv rawvideo file, please upload a short sample.
(Demuxing works fine for me.)

by Kenney Westerhof, 14 years ago

Attachment: test.mkv.gz added

gives the invalid pixel format string error; gunzip first (as it is rawvideo i gzipped it)

by Kenney Westerhof, 14 years ago

Attachment: test2.mkv.gz added

this file is 64x64 and does not give the invalid pix fmt error but says 'cannot find codec parameters'

by Kenney Westerhof, 14 years ago

Attachment: good.avi added

ffmpeg -i good.avi -vcodec rawvideo test.mkv

by Kenney Westerhof, 14 years ago

Attachment: good2.avi added

ffmpeg -i good2.avi -vcodec rawvideo test2.mkv

by Carl Eugen Hoyos, 14 years ago

Attachment: patchmatroskaraw.diff added

comment:2 by Carl Eugen Hoyos, 14 years ago

Attached patch seems necessary to me, but is unfortunately insufficient.

comment:3 by Aurélien Jacobs, 14 years ago

Should be fixed now (commit 7ebaa967a2c5b038023409179ca3c56f5b4f4ed3).
Why do you say that your patch is insufficient ?
It is pretty much the same as what I committed, and it works fine for me, with both good.avi and good2.avi...

comment:4 by Aurélien Jacobs, 14 years ago

Resolution: fixed
Status: openclosed

comment:5 by Carl Eugen Hoyos, 12 years ago

Keywords: mkv added; matroska removed
Note: See TracTickets for help on using tickets.