Opened 15 months ago

Closed 8 months ago

#10227 closed defect (fixed)

cscd: video with width not multiple of 4 fails to decode

Reported by: ami_stuff Owned by: Michael Niedermayer
Priority: normal Component: avcodec
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

"cscd_1_0_306_306_lzo.avi" file was encoded by the "CamStudio Lossless Codec 1.0"

"cscd_1_5_306_306_lzo.avi" file was encoded by the "CamStudio Lossless Codec 1.5"

camcodec.dll 1.5 is able to decode both of the files correctly.

FFmpeg fails to decode "cscd_1_0_306_306_lzo.avi" file.

What is a reason for this I don't know, but I guess that both files should decode correctly with FFmpeg's decoder just like they do with the original thing.

Also both of the files decodes to identical output when I export them to RAW in VirtualDub: File->Export->Raw video...

./ffmpeg -i cscd_1_0_306_306_lzo.avi -y out.avi
ffmpeg version N-109867-g5247dab6b1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: 
  libavutil      58.  1.100 / 58.  1.100
  libavcodec     60.  2.100 / 60.  2.100
  libavformat    60.  2.100 / 60.  2.100
  libavdevice    60.  0.100 / 60.  0.100
  libavfilter     9.  1.100 /  9.  1.100
  libswscale      7.  0.100 /  7.  0.100
  libswresample   4.  9.100 /  4.  9.100
Input #0, avi, from 'cscd_1_0_306_306_lzo.avi':
  Metadata:
    software        : Lavf60.2.100
  Duration: 00:00:00.21, start: 0.000000, bitrate: 43011 kb/s
  Stream #0:0: Video: cscd (CSCD / 0x44435343), bgr24, 306x306, 23.97 fps, 23.97 tbr, 23.97 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (cscd (camstudio) -> mpeg4 (native))
Press [q] to stop, [?] for help
[camstudio @ 0x560becc26b80] error during lzo decompression
Error while decoding stream #0:0: Invalid data found when processing input
[camstudio @ 0x560becc26b80] error during lzo decompression
Error while decoding stream #0:0: Invalid data found when processing input
[camstudio @ 0x560becc26b80] error during lzo decompression
Error while decoding stream #0:0: Invalid data found when processing input
[camstudio @ 0x560becc26b80] error during lzo decompression
Error while decoding stream #0:0: Invalid data found when processing input
[camstudio @ 0x560becc26b80] error during lzo decompression
Error while decoding stream #0:0: Invalid data found when processing input
Output #0, avi, to 'out.avi':
  Metadata:
    software        : Lavf60.2.100
    ISFT            : Lavf60.2.100
  Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 306x306, q=2-31, 200 kb/s, 23.97 fps, 23.97 tbn
    Metadata:
      encoder         : Lavc60.2.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbframe=    0 fps=0.0 q=0.0 Lsize=       6kB time=-577014:32:22.77 bitrate=N/A speed=N/A    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
Conversion failed!

Attachments (2)

cscd_1_0_306_306_lzo.avi (1.1 MB ) - added by ami_stuff 15 months ago.
cscd_1_5_306_306_lzo.avi (1.1 MB ) - added by ami_stuff 15 months ago.

Change History (8)

by ami_stuff, 15 months ago

Attachment: cscd_1_0_306_306_lzo.avi added

by ami_stuff, 15 months ago

Attachment: cscd_1_5_306_306_lzo.avi added

comment:1 by ami_stuff, 15 months ago

This is another regression somewhere between 20180614-29cddc9 and 20181029-32d021c:

C:\ffmpeg.exe -i cscd_1_0_306_306_lzo.avi -y out.avi
ffmpeg version N-91288-g29cddc99cd Copyright (c) 2000-2018 the FFmpeg developers

  built with gcc 7.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --e
nable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libblur
ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enab
le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-li
bvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --en
able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-
libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enabl
e-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enabl
e-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enab
le-dxva2 --enable-avisynth
  libavutil      56. 18.102 / 56. 18.102
  libavcodec     58. 20.102 / 58. 20.102
  libavformat    58. 17.100 / 58. 17.100
  libavdevice    58.  4.101 / 58.  4.101
  libavfilter     7. 25.100 /  7. 25.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
Input #0, avi, from 'cscd_1_0_306_306_lzo.avi':
  Metadata:
    encoder         : Lavf60.2.100
  Duration: 00:00:00.21, start: 0.000000, bitrate: 43011 kb/s
    Stream #0:0: Video: cscd (CSCD / 0x44435343), bgr24, 306x306, 23.97 fps, 23.
97 tbr, 23.97 tbn, 23.97 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (cscd (camstudio) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf58.17.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 306x306, q=2-31, 200
 kb/s, 23.97 fps, 23.97 tbn, 23.97 tbc
    Metadata:
      encoder         : Lavc58.20.102 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame=    5 fps=0.0 q=2.7 Lsize=      48kB time=00:00:00.20 bitrate=1896.5kbits/
s speed=3.34x
video:43kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing ov
erhead: 13.313474%
C:\ffmpeg.exe -i cscd_1_0_306_306_lzo.avi -y out.avi
ffmpeg version N-92308-g32d021cfa6 Copyright (c) 2000-2018 the FFmpeg developers

  built with gcc 8.2.1 (GCC) 20181017
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfi
g --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-lib
freetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amr
wb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --
enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-l
ibwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --
enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --en
able-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --en
able-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --e
nable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enab
le-avisynth
  libavutil      56. 21.100 / 56. 21.100
  libavcodec     58. 34.100 / 58. 34.100
  libavformat    58. 19.102 / 58. 19.102
  libavdevice    58.  4.106 / 58.  4.106
  libavfilter     7. 38.100 /  7. 38.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
Input #0, avi, from 'cscd_1_0_306_306_lzo.avi':
  Metadata:
    encoder         : Lavf60.2.100
  Duration: 00:00:00.21, start: 0.000000, bitrate: 43011 kb/s
    Stream #0:0: Video: cscd (CSCD / 0x44435343), bgr24, 306x306, 23.97 fps, 23.
97 tbr, 23.97 tbn, 23.97 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (cscd (camstudio) -> mpeg4 (native))
Press [q] to stop, [?] for help
[camstudio @ 03ec5700] error during lzo decompression
Error while decoding stream #0:0: Invalid data found when processing input
[camstudio @ 03ec5700] error during lzo decompression
Error while decoding stream #0:0: Invalid data found when processing input
[camstudio @ 03ec5700] error during lzo decompression
Error while decoding stream #0:0: Invalid data found when processing input
[camstudio @ 03ec5700] error during lzo decompression
Error while decoding stream #0:0: Invalid data found when processing input
[camstudio @ 03ec5700] error during lzo decompression
Error while decoding stream #0:0: Invalid data found when processing input
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf58.19.102
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 306x306, q=2-31, 200
 kb/s, 23.97 fps, 23.97 tbn, 23.97 tbc
    Metadata:
      encoder         : Lavc58.34.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame=    0 fps=0.0 q=0.0 Lsize=       6kB time=00:00:00.00 bitrate=N/A speed=
 0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing ove
rhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters i
f used)
Conversion failed!

comment:3 by Michael Niedermayer, 14 months ago

Component: undeterminedavcodec
Owner: set to Michael Niedermayer
Reproduced by developer: set
Status: newopen

Suggested fix: https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-March/307262.html
Tests with other width/height could be interressting as the equation is only based on that one sample.

comment:4 by ami_stuff, 14 months ago

I did some testing with various resolutions and yes, this patch fixes the problem, thanks!

But unfortunatelly while testing this codec in more detail I found another regression, this time in gzip decompression - ticket #10241.

comment:5 by Elon Musk, 11 months ago

What is status of this?

comment:6 by Elon Musk, 8 months ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.