Opened 9 years ago

Closed 9 years ago

#4689 closed defect (fixed)

jpeg2000: kakadu doesn't like ffmpeg-generated jp2 files

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

Description

irfanview also refuses to process them

C:\>ffmpeg -i test.bmp -vcodec jpeg2000 -strict -2 out.jp2
ffmpeg version N-73189-g7728d23 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (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-aacenc --enable-libvo-amrwbenc
 --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
ble-decklink --enable-zlib
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 45.100 / 56. 45.100
  libavformat    56. 38.102 / 56. 38.102
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 18.100 /  5. 18.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, bmp_pipe, from 'test.bmp':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: bmp, bgr24, 999x749, 25 tbr, 25 tbn, 25 tbc
File 'out.jp2' already exists. Overwrite ? [y/N] y
Output #0, image2, to 'out.jp2':
  Metadata:
    encoder         : Lavf56.38.102
    Stream #0:0: Video: jpeg2000, rgb24, 999x749, q=2-31, 200 kb/s, 25 fps, 25 t
bn, 25 tbc
    Metadata:
      encoder         : Lavc56.45.100 jpeg2000
Stream mapping:
  Stream #0:0 -> #0:0 (bmp (native) -> jpeg2000 (native))
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-1.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
video:881kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing o
verhead: unknown
C:\>kdu_render.exe -i out.jp2 -o out.bmp
Kakadu Core Error:
Code-stream must start with an SOC marker!
Error in Kakadu Region Compositor:
Unable to create imagery layer for direct rendering of image components from
codestream (index starting from 0) 0: codestream cannot be opened.

Attachments (6)

out.jp2 (881.4 KB ) - added by ami_stuff 9 years ago.
test.bmp (2.1 MB ) - added by ami_stuff 9 years ago.
lead.jp2 (704.9 KB ) - added by ami_stuff 9 years ago.
jasper.jp2 (103.6 KB ) - added by Carl Eugen Hoyos 9 years ago.
image_to_j2k.jp2 (103.6 KB ) - added by Carl Eugen Hoyos 9 years ago.
patchftyp.diff (500 bytes ) - added by Carl Eugen Hoyos 9 years ago.

Change History (16)

by ami_stuff, 9 years ago

Attachment: out.jp2 added

by ami_stuff, 9 years ago

Attachment: test.bmp added

comment:1 by Carl Eugen Hoyos, 9 years ago

Could you also test with -pred 1 (to activate the lossless mode)?

comment:2 by Carl Eugen Hoyos, 9 years ago

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

And with -format j2k.

comment:3 by ami_stuff, 9 years ago

  1. "-pred 1" alone doesn't change anything

but

  1. "-format j2k" file decodes correctly with kakadu/irfanview (with or without "-pred 1")
Last edited 9 years ago by ami_stuff (previous) (diff)

in reply to:  3 ; comment:4 by Carl Eugen Hoyos, 9 years ago

Replying to ami_stuff:

  1. "-format j2k" file decodes correctly with kakadu/irfanview (with or without "-pred 1")

Then I assume there is just a missing feature in kakadu: You could also test with jasper jp2 encoding or image_to_j2k jp2 encoding.

in reply to:  4 comment:5 by ami_stuff, 9 years ago

Replying to cehoyos:

Replying to ami_stuff:

  1. "-format j2k" file decodes correctly with kakadu/irfanview (with or without "-pred 1")

Then I assume there is just a missing feature in kakadu: You could also test with jasper jp2 encoding or image_to_j2k jp2 encoding.

I belive it's a bug in ffmpeg's code. Attached jp2 file decodes correctly with kakadu.

by ami_stuff, 9 years ago

Attachment: lead.jp2 added

by Carl Eugen Hoyos, 9 years ago

Attachment: jasper.jp2 added

by Carl Eugen Hoyos, 9 years ago

Attachment: image_to_j2k.jp2 added

comment:6 by Carl Eugen Hoyos, 9 years ago

Could be an issue with the length of the ftyp atom. Do the attached samples also work?

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

Replying to cehoyos:

Could be an issue with the length of the ftyp atom. Do the attached samples also work?

yes

C:\>kdu_render.exe -i jasper.jp2 -o out.bmp
Rendering finished, using 8 parallel threads of execution.

C:\>kdu_render.exe -i image_to_j2k.jp2 -o out.bmp
Rendering finished, using 8 parallel threads of execution.

by Carl Eugen Hoyos, 9 years ago

Attachment: patchftyp.diff added

comment:8 by Carl Eugen Hoyos, 9 years ago

Does attached patch make a difference?

comment:9 by Carl Eugen Hoyos, 9 years ago

Reproduced by developer: set
Status: newopen

No need to test, it works, I will send the patch in a moment.

comment:10 by Carl Eugen Hoyos, 9 years ago

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