Opened 7 years ago

Closed 4 years ago

#5919 closed defect (fixed)

jpeg2000: wrong pixel format selected for "digital cinema" file

Reported by: ami_stuff Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: j2k
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

decodes correctly with "-vcodec libopenjpeg" (rgb48le)

C:\>ffmpeg -i C:\digital_cinema.jpx out.bmp
ffmpeg version N-81755-g267da70 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.5.0 (GCC) 20100414 (Fedora MinGW 4.5.0-1.fc14)
  configuration: --prefix=/var/www/users/research/ffmpeg/snapshots/build --arch=
x86 --target-os=mingw32 --cross-prefix=i686-pc-mingw32- --cc='ccache i686-pc-min
gw32-gcc' --enable-pthreads --enable-memalign-hack --enable-runtime-cpudetect --
enable-cross-compile --enable-static --disable-shared --extra-libs='-lws2_32 -lw
inmm -lpthread' --extra-cflags='--static -I/var/www/users/research/ffmpeg/snapsh
ots/build/include' --extra-ldflags='-static -L/var/www/users/research/ffmpeg/sna
pshots/build/lib' --enable-bzlib --enable-zlib --enable-gpl --enable-version3 --
enable-nonfree --enable-libx264 --enable-libspeex --enable-libtheora --enable-li
bvorbis --enable-libfaac --enable-libxvid --enable-libopencore-amrnb --enable-li
bopencore-amrwb --enable-libmp3lame --enable-libfreetype --enable-libvpx --disab
le-decoder=libvpx
  libavutil      55. 30.100 / 55. 30.100
  libavcodec     57. 58.100 / 57. 58.100
  libavformat    57. 50.100 / 57. 50.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 63.100 /  6. 63.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, j2k_pipe, from 'C:\digital_cinema.jpx':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: jpeg2000 (JPEG 2000 digital cinema 2K), xyz12le, 999x749
, 25 tbr, 25 tbn, 25 tbc
Output #0, image2, to 'out.bmp':
  Metadata:
    encoder         : Lavf57.50.100
    Stream #0:0: Video: bmp, bgr24, 999x749, q=2-31, 200 kb/s, 25 fps, 25 tbn, 2
5 tbc
    Metadata:
      encoder         : Lavc57.58.100 bmp
Stream mapping:
  Stream #0:0 -> #0:0 (jpeg2000 (native) -> bmp (native))
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.171x

video:2194kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: unknown

Attachments (1)

digital_cinema.jpx (437.7 KB ) - added by ami_stuff 7 years ago.

Download all attachments as: .zip

Change History (13)

by ami_stuff, 7 years ago

Attachment: digital_cinema.jpx added

comment:1 by Carl Eugen Hoyos, 7 years ago

Component: undeterminedavcodec
Keywords: j2k added
Version: unspecifiedgit-master

How did you create the file?
Kakadu incorrectly decodes the first frame of fate-suite/jpeg2000/chiens_dcinema2K.mxf, so I don't know if this is a valid ticket.

in reply to:  1 comment:2 by ami_stuff, 7 years ago

Replying to cehoyos:

How did you create the file?

I exported the file from Photoshop.

Kakadu incorrectly decodes the first frame of fate-suite/jpeg2000/chiens_dcinema2K.mxf, so I don't know if this is a valid ticket.

I have kdu_show 7.3.3 installed here and it decodes two frames extraced from "chiens_dcinema2K.mxf" correctly:

ffmpeg -i chiens_dcinema2K.mxf -vcodec copy out%2d.jp2

comment:3 by ami_stuff, 7 years ago

C:\>ffmpeg -i C:\chiens_dcinema2K.mxf ffmpeg.avi
ffmpeg version N-78758-g5156578 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --
enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-lib
x265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-d
ecklink --enable-zlib
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 27.100 / 57. 27.100
  libavformat    57. 26.100 / 57. 26.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 37.100 /  6. 37.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[mxf @ 038de6c0] "OPAtom" with 2 ECs - assuming OP1a
Input #0, mxf, from 'C:\chiens_dcinema2K.mxf':
  Metadata:
    uid             : ea516693-e842-4d69-b01c-84b6f2ee8a4b
    generation_uid  : ccbcd572-3b44-4a43-913d-249256b19954
    company_name    : OpenDCP
    product_name    : OpenDCP
    product_version : 0.27.1
    product_uid     : 43059a1d-0432-4101-b83f-736815acf31d
    modification_date: 2013-03-25 13:53:33
    application_platform: unix
    material_package_umid: 0x060A2B340101010501010F20130000007259AF48B9B347E79BC
082E465113970
    material_package_name: AS-DCP Material Package
    timecode        : 00:00:00:00
  Duration: 00:00:00.08, start: 0.000000, bitrate: 111391 kb/s
    Stream #0:0: Video: jpeg2000 (JPEG 2000 digital cinema 2K), xyz12le, 1920x10
80, SAR 1:1 DAR 16:9, 24 tbr, 24 tbn, 24 tbc
    Metadata:
      file_package_umid: 0x060A2B340101010501010F2013000000F3994551329046849FBF6
EAFC69573F6
      file_package_name: File Package: SMPTE 429-4 frame wrapping of JPEG 2000 c
odestreams
Output #0, avi, to 'ffmpeg.avi':
  Metadata:
    uid             : ea516693-e842-4d69-b01c-84b6f2ee8a4b
    generation_uid  : ccbcd572-3b44-4a43-913d-249256b19954
    company_name    : OpenDCP
    product_name    : OpenDCP
    product_version : 0.27.1
    product_uid     : 43059a1d-0432-4101-b83f-736815acf31d
    modification_date: 2013-03-25 13:53:33
    application_platform: unix
    material_package_umid: 0x060A2B340101010501010F20130000007259AF48B9B347E79BC
082E465113970
    material_package_name: AS-DCP Material Package
    ISMP            : 00:00:00:00
    ISFT            : Lavf57.26.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080 [SAR 1:1 D
AR 16:9], q=2-31, 200 kb/s, 24 fps, 24 tbn, 24 tbc
    Metadata:
      file_package_umid: 0x060A2B340101010501010F2013000000F3994551329046849FBF6
EAFC69573F6
      file_package_name: File Package: SMPTE 429-4 frame wrapping of JPEG 2000 c
odestreams
      encoder         : Lavc57.27.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (jpeg2000 (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
frame=    2 fps=0.0 q=2.0 size=     142kB time=00:00:00.08 bitrate=13926.8kbits/
frame=    2 fps=0.0 q=2.0 Lsize=     142kB time=00:00:00.08 bitrate=13930.6kbits
/s speed=0.119x
video:136kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing o
verhead: 4.186561%
C:\>ffmpeg -vcodec libopenjpeg -i C:\chiens_dcinema2K.mxf libopenjpeg.avi
ffmpeg version N-78758-g5156578 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --
enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-lib
x265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-d
ecklink --enable-zlib
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 27.100 / 57. 27.100
  libavformat    57. 26.100 / 57. 26.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 37.100 /  6. 37.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[mxf @ 038de840] "OPAtom" with 2 ECs - assuming OP1a
Input #0, mxf, from 'C:\chiens_dcinema2K.mxf':
  Metadata:
    uid             : ea516693-e842-4d69-b01c-84b6f2ee8a4b
    generation_uid  : ccbcd572-3b44-4a43-913d-249256b19954
    company_name    : OpenDCP
    product_name    : OpenDCP
    product_version : 0.27.1
    product_uid     : 43059a1d-0432-4101-b83f-736815acf31d
    modification_date: 2013-03-25 13:53:33
    application_platform: unix
    material_package_umid: 0x060A2B340101010501010F20130000007259AF48B9B347E79BC
082E465113970
    material_package_name: AS-DCP Material Package
    timecode        : 00:00:00:00
  Duration: 00:00:00.08, start: 0.000000, bitrate: 111391 kb/s
    Stream #0:0: Video: jpeg2000, rgb48le(12 bpc), 1920x1080, SAR 1:1 DAR 16:9,
24 tbr, 24 tbn, 24 tbc
    Metadata:
      file_package_umid: 0x060A2B340101010501010F2013000000F3994551329046849FBF6
EAFC69573F6
      file_package_name: File Package: SMPTE 429-4 frame wrapping of JPEG 2000 c
odestreams
Output #0, avi, to 'libopenjpeg.avi':
  Metadata:
    uid             : ea516693-e842-4d69-b01c-84b6f2ee8a4b
    generation_uid  : ccbcd572-3b44-4a43-913d-249256b19954
    company_name    : OpenDCP
    product_name    : OpenDCP
    product_version : 0.27.1
    product_uid     : 43059a1d-0432-4101-b83f-736815acf31d
    modification_date: 2013-03-25 13:53:33
    application_platform: unix
    material_package_umid: 0x060A2B340101010501010F20130000007259AF48B9B347E79BC
082E465113970
    material_package_name: AS-DCP Material Package
    ISMP            : 00:00:00:00
    ISFT            : Lavf57.26.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080 [SAR 1:1 D
AR 16:9], q=2-31, 200 kb/s, 24 fps, 24 tbn, 24 tbc
    Metadata:
      file_package_umid: 0x060A2B340101010501010F2013000000F3994551329046849FBF6
EAFC69573F6
      file_package_name: File Package: SMPTE 429-4 frame wrapping of JPEG 2000 c
odestreams
      encoder         : Lavc57.27.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (jpeg2000 (libopenjpeg) -> mpeg4 (native))
Press [q] to stop, [?] for help
frame=    2 fps=0.0 q=2.0 size=     144kB time=00:00:00.08 bitrate=14114.4kbits/
frame=    2 fps=0.0 q=2.0 Lsize=     144kB time=00:00:00.08 bitrate=14118.2kbits
/s speed=0.109x
video:138kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing o
verhead: 4.129376%

comment:4 by Carl Eugen Hoyos, 7 years ago

I tested the following with kdu_render 7.6:

$ ffmpeg -i fate-suite/jpeg2000/chiens_dcinema2K.mxf -vcodec copy -f rawvideo -vframes 1 out.jp2
$ kdu_render -i out.jp2 -o out.jpg

Using FFplay to look at both files, out.jp2 show a brown dog, green background (leaves) with brown trunks and several red elements on the laptop screen. The file produced with Kakadu, out.jpg, shows a grey background, grey laptop screen and a very light brown dog, nearly no colour.
What does Photoshop do with the exported frame from chiens_dcinema2K.mxf?

in reply to:  3 comment:5 by Carl Eugen Hoyos, 7 years ago

Replying to ami_stuff:

C:\>ffmpeg -vcodec libopenjpeg -i C:\chiens_dcinema2K.mxf libopenjpeg.avi

This is a known bug: We do not support DCinema files (like chiens_dcinema2K.mxf) with -vcodec libopenjpeg.

in reply to:  4 ; comment:6 by ami_stuff, 7 years ago

Replying to cehoyos:

What does Photoshop do with the exported frame from chiens_dcinema2K.mxf?

It decodes it the same way like libopenjpeg/kakadu (less colors).

This is a known bug: We do not support DCinema files (like chiens_dcinema2K.mxf) with -vcodec libopenjpeg.

Ok, I didn't know about that.

Last edited 7 years ago by ami_stuff (previous) (diff)

in reply to:  6 ; comment:7 by Carl Eugen Hoyos, 7 years ago

Replying to ami_stuff:

Replying to cehoyos:

What does Photoshop do with the exported frame from chiens_dcinema2K.mxf?

Nothing, I commented how I created "digital_cinema.jpx" file - I exported it from Photoshop with enabled "Digital Cinema" option.

You mean Photoshop neither reads the file you attached here nor a frame exported from chiens_dcinema2K.mxf?

in reply to:  7 comment:8 by ami_stuff, 7 years ago

Replying to cehoyos:

Replying to ami_stuff:

Replying to cehoyos:

What does Photoshop do with the exported frame from chiens_dcinema2K.mxf?

Nothing, I commented how I created "digital_cinema.jpx" file - I exported it from Photoshop with enabled "Digital Cinema" option.

You mean Photoshop neither reads the file you attached here nor a frame exported from chiens_dcinema2K.mxf?

I misread your question before - photoshop decodes the files (mine and extracted from mxf) with less colors just like libopenjpeg and kakadu.

comment:9 by Carl Eugen Hoyos, 7 years ago

Even if the colourspace is detected correctly by FFmpeg, it is a bug that the following doesn't work:

$ ffmpeg -pix_fmt rgb48 -i digital_cinema.jpx out.png

comment:10 by Elon Musk, 7 years ago

How you think that can work at all?

comment:11 by Carl Eugen Hoyos, 7 years ago

The syntax works with the libopenjpeg decoder so I think it is reasonable that it also works for the native decoder, more so as we now know samples exist that need it.

comment:12 by Carl Eugen Hoyos, 4 years ago

Resolution: fixed
Status: newclosed

The pix_fmt can be forced since cbe3f1b1fbc0e0bd2c265f1d9b78e29ac185f17b, I don't think another fix is possible.

Note: See TracTickets for help on using tickets.