Opened 8 years ago

Last modified 8 years ago

#5548 open defect

FFV1 encoder creates invalid stream with -level 3 if width or height is between 1 and 3

Reported by: Jérôme Martinez Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: FFV1
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:
FFV1 encoder creates an invalid stream if width or height is 1 or 2.
technical description: is such scenario, num_v_slices has a value of 2 so slice_y should be maximum 1, but slices have slice_y = 2 everywhere (instead of = 0 or 1).

How to reproduce:

>ffmpeg -y -f lavfi -i testsrc -t 1 -filter:v scale="353:1" -vcodec ffv1 -level 3 353x1.mkv
ffmpeg version N-79630-g9ac154d Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 22.101 / 55. 22.101
  libavcodec     57. 38.100 / 57. 38.100
  libavformat    57. 34.103 / 57. 34.103
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 44.100 /  6. 44.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.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 fps, 25 tbr, 25 tbn
[matroska @ 0000000000f8e8e0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, matroska, to '353x1.mkv':
  Metadata:
    encoder         : Lavf57.34.103
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), bgr0, 353x1 [SAR 4:1059 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 1k tbn
    Metadata:
      encoder         : Lavc57.38.100 ffv1
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> ffv1 (native))
Press [q] to stop, [?] for help
frame=   25 fps=0.0 q=-0.0 Lsize=      15kB time=00:00:00.96 bitrate= 130.4kbits/s speed=44.7x
video:14kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 7.009154%

>ffmpeg -i 353x1.mkv fake.mp4
ffmpeg version N-79630-g9ac154d Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 22.101 / 55. 22.101
  libavcodec     57. 38.100 / 57. 38.100
  libavformat    57. 34.103 / 57. 34.103
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 44.100 /  6. 44.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[ffv1 @ 00000000025245e0] slice count invalid
[matroska,webm @ 00000000001d6e60] Failed to open codec in av_find_stream_info
[ffv1 @ 00000000025245e0] slice count invalid
Input #0, matroska,webm, from '353x1.mkv':
  Metadata:
    ENCODER         : Lavf57.34.103
  Duration: 00:00:01.00, start: 0.000000, bitrate: 125 kb/s
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), none, 353x1, SAR 1:255 DAR 353:255, 25 fps, 25 tbr, 1k tbn (default)
    Metadata:
      ENCODER         : Lavc57.38.100 ffv1
      DURATION        : 00:00:01.000000000
[buffer @ 00000000025179e0] Unable to parse option value "-1" as pixel format
    Last message repeated 1 times
[buffer @ 00000000025179e0] Error setting option pix_fmt to value -1.
[graph 0 input from stream 0:0 @ 0000000002517500] Error applying options to the filter.
Error opening filters!

Same if you invert width and height.

Change History (2)

comment:1 by Carl Eugen Hoyos, 8 years ago

Reproduced by developer: set
Status: newopen
Summary: FFV1 encoder creates invalid stream if width or height is 1 or 2FFV1 encoder creates invalid stream with -level 3 if width or height is 1 or 2
Version: unspecifiedgit-master

comment:2 by Jérôme Martinez, 8 years ago

Summary: FFV1 encoder creates invalid stream with -level 3 if width or height is 1 or 2FFV1 encoder creates invalid stream with -level 3 if width or height is between 1 and 3

I slightly change the report:

  • with width or height of 1, there is no valid slice so there is an error from FFmpeg during decode
  • with width or height of 2 or 3, the last slice (horizontal or vertical) is invalid so discarded and the first slice is the only one decoded.

with:

  • ffmpeg -y -f lavfi -i "color=c=white" -t 10 -filter:v scale="3:3" -vcodec ffv1 -level 3 3x3.mkv then playback in e.g. VLC it is yellow on the top left and black right and bottom.
  • ffmpeg -y -f lavfi -i "color=c=white" -t 10 -filter:v scale="4:4" -vcodec ffv1 -level 3 4x4.mkv then playback in e.g. VLC it is white everywhere.
Note: See TracTickets for help on using tickets.