Opened 7 years ago

Closed 7 years ago

#6068 closed defect (fixed)

-allow_raw_vfw 1 creates invalid Matroska

Reported by: dave rice Owned by:
Priority: minor Component: avformat
Version: git-master Keywords: mkv regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description (last modified by dave rice)

Summary of the bug:

using -allow_raw_vfw creates a Matroska track with two CodecID Elements, when >1 CodecID within a track is invalid.

How to reproduce:

Writing rawvideo into Matroska fails with a suggestion to use -allow_raw_vfw 1.

ffmpeg -f lavfi -i testsrc -vframes 1 -c:v rawvideo -y mkv.mkv
ffmpeg version git-2016-12-28-49abd5d Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-49abd5d --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-chromaprint --enable-ffplay --enable-libcaca --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtesseract --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 70.100 / 57. 70.100
  libavformat    57. 61.100 / 57. 61.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Output #0, matroska, to 'mkv.mkv':
  Metadata:
    encoder         : Lavf57.61.100
    Stream #0:0: Video: rawvideo, rgb24, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.70.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[matroska @ 0x7ff222004800] Raw RGB is not supported Natively in Matroska, you can use AVI or NUT or
If you would like to store it anyway using VFW mode, enable allow_raw_vfw (-allow_raw_vfw 1)
av_interleaved_write_frame(): Invalid argument
Error writing trailer of mkv.mkv: Invalid argumentframe=    1 fps=0.0 q=-0.0 Lsize=       0kB time=00:00:00.00 bitrate=3096.0kbits/s speed=0.885x    
video:225kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Adding -allow_raw_vfw 1 as suggested:

ffmpeg -f lavfi -i testsrc -vframes 1 -c:v rawvideo -allow_raw_vfw 1 -y mkv.mkv
ffmpeg version git-2016-12-28-49abd5d Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-49abd5d --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-chromaprint --enable-ffplay --enable-libcaca --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtesseract --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 70.100 / 57. 70.100
  libavformat    57. 61.100 / 57. 61.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Output #0, matroska, to 'mkv.mkv':
  Metadata:
    encoder         : Lavf57.61.100
    Stream #0:0: Video: rawvideo, rgb24, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.70.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[matroska @ 0x7ffb92006000] codec rawvideo is not supported by this format
frame=    1 fps=0.0 q=-0.0 Lsize=     226kB time=00:00:00.00 bitrate=1849664.0kbits/s speed=0.621x    
video:225kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.350694%

Assess with mkvalidator:
mkvalidator mkv.mkv

ERR202: Unique element 'CodecID' in TrackEntry at 393 found more than once at 446
ERR202: Unique element 'CodecID' in TrackEntry at 393 found more than once at 446
....... file created with Lavf57.61.100 / Lavf57.61.100

Change History (4)

comment:1 by dave rice, 7 years ago

Description: modified (diff)

comment:2 by Carl Eugen Hoyos, 7 years ago

Keywords: mkv added; matroska removed

comment:3 by Carl Eugen Hoyos, 7 years ago

Keywords: regression added
Priority: normalminor
Reproduced by developer: set
Status: newopen

Patch sent.

The two CodecID elements are a regression since 7d60baa8 but rawvideo in mkv is not well supported anyway, see for example ticket #3263.

Last edited 7 years ago by Carl Eugen Hoyos (previous) (diff)

comment:4 by Carl Eugen Hoyos, 7 years ago

Resolution: fixed
Status: openclosed

Should be fixed in c723108e25551cfdb0b1e7e52df6d084ea0348b9, thank you for the report!

Note: See TracTickets for help on using tickets.