Opened 9 years ago

Closed 4 years ago

#4827 closed defect (fixed)

Many warnings shown when decoding j2k

Reported by: Carl Eugen Hoyos Owned by:
Priority: minor Component: avcodec
Version: git-master Keywords: j2k
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

http://thread.gmane.org/gmane.comp.video.ffmpeg.user/58666
A user uploaded a j2k sequence that decodes fine with current FFmpeg afaict, but many warnings are shown for every frame.

$ ffmpeg -i frm_000127.j2c out.png
ffmpeg version N-74835-gbd6610c Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[jpeg2000 @ 0x26de900] End mismatch 1
    Last message repeated 4 times
[jpeg2000 @ 0x26de900] End mismatch 2
    Last message repeated 1 times
[jpeg2000 @ 0x26de900] End mismatch 1
    Last message repeated 28 times
[jpeg2000 @ 0x26de900] End mismatch 2
[jpeg2000 @ 0x26de900] End mismatch 1
    Last message repeated 19 times
Input #0, j2k_pipe, from 'frm_000127.j2c':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: jpeg2000 (JPEG 2000 digital cinema 2K), xyz12le, 2048x858, 25 tbr, 25 tbn, 25 tbc
Output #0, image2, to 'out.png':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: png, rgb48be, 2048x858, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.60.100 png
Stream mapping:
  Stream #0:0 -> #0:0 (jpeg2000 (native) -> png (native))
Press [q] to stop, [?] for help
[jpeg2000 @ 0x2976ec0] End mismatch 1
    Last message repeated 4 times
[jpeg2000 @ 0x2976ec0] End mismatch 2
    Last message repeated 1 times
[jpeg2000 @ 0x2976ec0] End mismatch 1
    Last message repeated 28 times
[jpeg2000 @ 0x2976ec0] End mismatch 2
[jpeg2000 @ 0x2976ec0] End mismatch 1
    Last message repeated 19 times
frame=    1 fps=1.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
video:5354kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Attachments (1)

frm_000127.j2c (224.9 KB ) - added by Carl Eugen Hoyos 9 years ago.

Download all attachments as: .zip

Change History (6)

by Carl Eugen Hoyos, 9 years ago

Attachment: frm_000127.j2c added

comment:1 by Carl Eugen Hoyos, 9 years ago

Priority: minornormal
Summary: Many warnings shown when decoding j2kMany warnings and artefacts shown when decoding j2k

I originally thought that the artefacts on the left border are intended, they are definitely wrong.

comment:2 by Carl Eugen Hoyos, 9 years ago

Priority: normalminor
Summary: Many warnings and artefacts shown when decoding j2kMany warnings shown when decoding j2k

The artefacts are produced by the colourspace conversion as can be shown for example with the following command line, the output shows no artefacts:

$ ffmpeg -i frm_000127.j2c -vcodec libopenjpeg out.j2k
ffmpeg version N-74866-g0cdba4a Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --enable-libopenjpeg
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[jpeg2000 @ 0x2107960] End mismatch 1
    Last message repeated 4 times
[jpeg2000 @ 0x2107960] End mismatch 2
    Last message repeated 1 times
[jpeg2000 @ 0x2107960] End mismatch 1
    Last message repeated 28 times
[jpeg2000 @ 0x2107960] End mismatch 2
[jpeg2000 @ 0x2107960] End mismatch 1
    Last message repeated 19 times
Input #0, j2k_pipe, from 'frm_000127.j2c':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: jpeg2000 (JPEG 2000 digital cinema 2K), xyz12le, 2048x858, 25 tbr, 25 tbn, 25 tbc
Output #0, image2, to 'out.j2k':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: jpeg2000 (libopenjpeg), xyz12le, 2048x858, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.60.100 libopenjpeg
Stream mapping:
  Stream #0:0 -> #0:0 (jpeg2000 (native) -> jpeg2000 (libopenjpeg))
Press [q] to stop, [?] for help
[jpeg2000 @ 0xd645ac0] End mismatch 1
    Last message repeated 4 times
[jpeg2000 @ 0xd645ac0] End mismatch 2
    Last message repeated 1 times
[jpeg2000 @ 0xd645ac0] End mismatch 1
    Last message repeated 28 times
[jpeg2000 @ 0xd645ac0] End mismatch 2
[jpeg2000 @ 0xd645ac0] End mismatch 1
    Last message repeated 19 times
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
video:1639kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

I created ticket #4829 for the libswscale issue.

comment:3 by kieranjol, 6 years ago

This issue is still present in git master:

./ffmpeg -i frm_000127.j2c  -f null -
ffmpeg version N-92502-gd290bb0c54 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: 
  libavutil      56. 23.101 / 56. 23.101
  libavcodec     58. 39.100 / 58. 39.100
  libavformat    58. 22.100 / 58. 22.100
  libavdevice    58.  6.100 / 58.  6.100
  libavfilter     7. 46.100 /  7. 46.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
[jpeg2000 @ 0x7f94b9809000] End mismatch 1
    Last message repeated 4 times
[jpeg2000 @ 0x7f94b9809000] End mismatch 2
    Last message repeated 1 times
[jpeg2000 @ 0x7f94b9809000] End mismatch 1
    Last message repeated 28 times
[jpeg2000 @ 0x7f94b9809000] End mismatch 2
[jpeg2000 @ 0x7f94b9809000] End mismatch 1
    Last message repeated 19 times
Input #0, j2k_pipe, from 'frm_000127.j2c':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: jpeg2000 (JPEG 2000 digital cinema 2K), xyz12le, 2048x858, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (jpeg2000 (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
[jpeg2000 @ 0x7f94ba823200] End mismatch 1
    Last message repeated 4 times
[jpeg2000 @ 0x7f94ba823200] End mismatch 2
    Last message repeated 1 times
[jpeg2000 @ 0x7f94ba823200] End mismatch 1
    Last message repeated 28 times
[jpeg2000 @ 0x7f94ba823200] End mismatch 2
[jpeg2000 @ 0x7f94ba823200] End mismatch 1
    Last message repeated 19 times
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf58.22.100
    Stream #0:0: Video: wrapped_avframe, xyz12le, 2048x858, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.39.100 wrapped_avframe
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.127x    
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

comment:4 by Balling, 4 years ago

Status: newopen

https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200723171111.11312-1-gautamramk@gmail.com/

Fixed by ff5b9ece4290d245ba3bbf110d90f3f432dda3cc in native decoder, but I wanna explore it more with libopenjpeg decoder. The issue with libopenjpeg is this pull request https://github.com/uclouvain/openjpeg/pull/1200

Without RSIZ marker libopenjpeg sees it as rgb48le(12 bpc) just like with mxf wrong RSIZ equivalent marker, see here https://patchwork.ffmpeg.org/project/ffmpeg/patch/CAH6sF9_T2T5Em4MRrQYk=S+7QWvMPAWnSSYnxEf4mcFeB3rFLw@mail.gmail.com/ and here https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200913224218.60972-1-remiachard@gmail.com/

And obviously -pix_fmt xyz12le uses auto_scaler_0 in swscaler which is apparently sh*t. (The same happens with ffplay -v debug frm_000127.j2c, swscaler is also here.) Now, there are other problems. Like with ffmpeg -i frm_000127.j2c -c:v jpeg2000 -pred 1 -pix_fmt xyz12 frm.j2k it creates yuv444p16le file that is actually rgb48le and is also very broken in both picture and warnings. -pix_fmt rgb24 in place shows many warnings, no -pix_fmt also produces broken picture with yuv444p16le... No -pred 1 or -pix_fmt rgb48 or -pix_fmt yuv444p16le breaks decoding with

[jpeg2000 @ 000001bf53610540] Block length 0 or lengthinc 255 is too large, left 254


-c:v libopenjpeg does it all good (except for swscaler BS). Nuts. No swsacler is only in -pix_fmt xyz12 but the libopenjpeg encoder does not insert RSIZ, LOL, so wasted!

Last edited 4 years ago by Balling (previous) (diff)

comment:5 by Carl Eugen Hoyos, 4 years ago

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