Opened 9 years ago

Last modified 8 years ago

#2653 reopened enhancement

DCP-compatible output with libopenjpeg encoder

Reported by: Sulio Pulev Owned by:
Priority: wish Component: undetermined
Version: git-master Keywords: libopenjpeg j2k xyz
Cc: nicoinattendu@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

Summary of the bug:
How to reproduce:

% ffmpeg" -i sample.h264 -vf crop=iw:ih-2*138,scale=2048:858,lutrgb=gammaval(2.6) -pix_fmt yuv444p12le -vcodec libopenjpeg -profile 1 -cinema_mode 1 "decoded/test_%6d.j2c

ffmpeg version N-53885-gf97e28e
built on gcc windows 7 64 bit by Zeranoe

The problem is:

  1. I have no see any gamma change in picture. 26 is high value for gamma and thisd can be very visible.
  2. libopenjpeg do not receive or do not execute the follow option "-profile 1" with above command line should be expected converting of h264 video to sequence of JPEG2000 images with digital cinema standard. testing jpeg2000 images after, show that they are NOT digital cinema compliant. My testing tools cannot say why but absolutely sure say that they are not digital cinema compliant. libopenjpeg itself used with another programs (for example image_to_j2c or OpenDCP do well conversion exactly on DCI specifications for jpeg2000 for digital cinema. I guess that avoptions are not sent corectly to openjpeg. For example "-profile" command are not specific for libopenjpeg, its not "private" command only for libopenjpeg and may be ffmpeg do not pass this option to libopenjpeg. Also explanation of AVoptions generally is ambiguous and is hard to understand how exactly are used such options. ffmpeg -h codecs=libopenjpeg do not do big thing due to lack of details. Also I do not understand who decide which pix_fmt should understand libopenjpeg, but original openjpeg understand xyz12le and in ffmpeg do not understand it,instead understand yuv444p12le this may be not so important because anyway xyz transformations is done before libopenjpeg encoding.
  3. I cannot understand why xyz12le is only input format , its make more sense to be more output format.

I attach an report file and you will see what I'm talking about. IF what is written in wiki is true then with this command we should have from some video file source,XYZ encoded,gammacorected jpeg2000 DCI compressed sequence of images, but for some reason its not happened.

Attachments (3)

ffmpeg-20130608-214631.log (50.3 KB ) - added by Sulio Pulev 9 years ago.
report logs from ffmpeg
ffmpeg-20130608-214947.log (51.2 KB ) - added by Sulio Pulev 9 years ago.
another report another options
ffmpeg-20130608-215436.log (42.3 KB ) - added by Sulio Pulev 9 years ago.
another report another options

Download all attachments as: .zip

Change History (20)

by Sulio Pulev, 9 years ago

Attachment: ffmpeg-20130608-214631.log added

report logs from ffmpeg

by Sulio Pulev, 9 years ago

Attachment: ffmpeg-20130608-214947.log added

another report another options

by Sulio Pulev, 9 years ago

Attachment: ffmpeg-20130608-215436.log added

another report another options

comment:1 by Carl Eugen Hoyos, 9 years ago

Keywords: j2k xyz added; AVoptions removed
Priority: normalwish
Type: defectenhancement
Version: unspecifiedgit-master

Could you point me to the place where the wiki claims that FFmpeg supports DCinema output? (It does not.)

comment:2 by Sulio Pulev, 9 years ago

ffmpeg do not support digital cinema, but libopenjpeg (used by ffmpeg -hope without serious modifications) support it. Check the ffmpeg -h codec=libopenjpeg there are options dedicated to Dcinema.So, if you corectly pass libopenjpeg parameteres to it may it should work corectly. What is wrong?

comment:3 by Carl Eugen Hoyos, 9 years ago

Description: modified (diff)

Could you test if reencoding the sample j2c_10db24e2-0c6f-4ca2-9af7-a90a3685a0d6__000000.j2c from ticket #1279 works?

Last edited 9 years ago by Carl Eugen Hoyos (previous) (diff)

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

Replying to cehoyos:

Could you test if reencoding the sample rgb-bary-12bpc.preview.jpg from ticket #1279 works?

Sorry, I meant the sample j2c_10db24e2-0c6f-4ca2-9af7-a90a3685a0d6__000000.j2c from ticket #1279.

comment:5 by Sulio Pulev, 9 years ago

I dont know what reencoding of j2c mean. I trying to encode tiff in j2c or to decode videofile (h.264,xvid or whatever) in jpeg2000 sequence. Its encoded,but even if I write option to libopenjpeg in ffpeg commend line libopenjpeg do not encode in DCI complain format, libopenjpeg do that if used with another front application like image_to_j2c which is inckuded as sample in libopenjpeg package. For that reason Im afraid that ffmpeg do not pass corectly AVoption to libopenjpeg or libopenjpeg is not original one from OpenJPEG project and is modified in bad way.
I tested j2c files received from decoding using AVoptions but those files do not pass dci complians test. I guess that specially problem is "-profile" AVoption that may be is not interpreted like AVoption or interfere with ffmpeg "global" option.
May be also I dont know something "hidden" about options. May be you suggest me exact command line that decode h264 file to j2c sequence using libopenjpeg codec and using AVoption described in -h codec=libopenjpeg especially profile cinema2K and cinema_mode 2k_24.
Thank you

comment:6 by Carl Eugen Hoyos, 9 years ago

Does the file j2c_10db24e2-0c6f-4ca2-9af7-a90a3685a0d6__000000.j2c from ticket #1279 pass the DCI compliance tests?

comment:7 by Sulio Pulev, 9 years ago

Yes, its passed, but as I understand this is j2c image taken from .mxf file created but some other utility may be OpenDCP or other, but not with ffmpeg using libopenjpeg and his AVoption.
If this picture is made with ffmpeg libopenjpeg or image2 filterwhat was option on command line?

in reply to:  7 comment:8 by Carl Eugen Hoyos, 9 years ago

Replying to sulio:

Yes, its passed, but as I understand this is j2c image taken from .mxf file created but some other utility may be OpenDCP or other, but not with ffmpeg using libopenjpeg and his AVoption.

You are correct but I believe it is a good source to test DCinema creation.

How does the image_to_j2c command line looks like that produces the intended images?

comment:9 by Sulio Pulev, 9 years ago

image_to_j2c.exe -i inputfile -o outputfile -cinema2K 24 (or -cinema4K or -cinema2K 48)
Image_to_j2c is just frontend to library.
Also another usage can be (for directory converting)
image_to_j2c.exe -ImgDir directory -OutFor format (j2c,jp2,j2k) -cinema2K 24 (or -cinema4K or -cinema2K 48)
In this case it convert all what is in directory without further interaction so with one command line - all directory converted
So ffmpeg should also pass AVoptions to libopenjpeg same way like image_to_j2c do.

comment:10 by Elon Musk, 9 years ago

Resolution: invalid
Status: newclosed

The options you provide via command line to ffmpeg are invalid.

See output of:
ffmpeg -h encoder=libopenjpeg

comment:11 by Carl Eugen Hoyos, 9 years ago

I was unable to find any reference to image_to_j2c on the internet (except this ticket), did you mean image_to_j2k?

in reply to:  11 comment:12 by Sulio Pulev, 9 years ago

Replying to cehoyos:

I was unable to find any reference to image_to_j2c on the internet (except this ticket), did you mean image_to_j2k?

Yes ,its on openjpeg.org site or on openjpeg.googlecode.com its true image-to-j2k.

comment:13 by Sulio Pulev, 9 years ago

Resolution: invalid
Status: closedreopened

comment:14 by Nicolas Bertrand, 9 years ago

Cc: nicoinattendu@gmail.com added

comment:15 by Sulio Pulev, 9 years ago

Did we will repair this bug?
I guess that this is not libopenjpe, but ffmpeg bug transfering AVoptions to libopenjpeg.

comment:16 by Carl Eugen Hoyos, 8 years ago

Could you test the following?

$ ffmpeg -i input -vcodec libopenjpeg -pix_fmt xyz12 -profile cinema2k -cinema_mode 2k_24 -s 2048x858 out%6d.j2c

in reply to:  description comment:17 by Carl Eugen Hoyos, 8 years ago

Summary: problem with libopenjpeg with some optionDCP-compatible output with libopenjpeg encoder

Replying to sulio:

% ffmpeg" -i sample.h264 -vf crop=iw:ih-2*138,scale=2048:858,lutrgb=gammaval(2.6) -pix_fmt yuv444p12le -vcodec libopenjpeg -profile 1 -cinema_mode 1 "decoded/test_%6d.j2c

The problem could be that -profile cinema2k corresponds to -profile 3

Note: See TracTickets for help on using tickets.