I'm trying to achieve a lossy JPEG 2000 output with FFMPEG, but no success so far.

Using this command line:

ffmpeg -i input.dpx -pix_fmt yuv420p -vcodec libopenjpeg output.jp2

As a result I get lossless output, which is a default setting for JPEG 2000. I tried -b:v and -q:v, but they both have no impact to the output.

Does anyone know a command that changes the quality/compress the output?

Any kind of help is really appreciated. Thank you!

  • the question how to control the spent bitrate for libopenjpeg? normal -vb ffmpeg option doesnt seem to work, neither the compression_level switch. – user10960 Jun 1 '15 at 10:34

Did you try using the -compression_level flag? It takes an int from 0-100 afaik (maybe the range is even higher, the docs just say "int").

That should set a lossy compression strength.

There is also an interesting blog post about creating DCI compilant JPEG2000 encodes with FFMPEG for DCP's. Which require lossy encoded JPEG2000.

  • Thank you for your answer! The -compression_level flag does indeed reduce picture quality/file size. The range is 0-9999999999999. The only problem with this method is that -compression_level flag is not a defined scale. I'd like to compare the coding efficiency of different encoders. By using -compression_level flag I have no common value, which would allow me to compare different encoders. – dmkr Jul 23 '14 at 21:40
  • The -profile:v flag mentioned in the blog post might help you. It applys specific encoding profiles that are also found in other encoders. I cant find it in the documentation specific to JPEG2000, to know which profile is which you may have to look into the source. – timonsku Jul 23 '14 at 22:31
  • 1
    Btw. if you just want to compare JPEG2000 implementations I recommend to just download the OpenJPEG binary directly and work with that, afaik FFmpeg only partially implents it. You will have far more options and better documentation: code.google.com/p/openjpeg/wiki/Downloads?tm=2 – timonsku Jul 23 '14 at 22:43
  • The -profile:v flag defines AFAIK such things as image size, wavelet levels etc, but not the compression ration. Well, I'll look into this anyway. I want to compare HEVC against JPEG 2000, especially benefits of higher bit depth in combination with chroma subsampling. I tried OpenJPEG, it kinda does the job. But the input formats are pretty sparse. They either don't support higher bit depth or are all RGB. – dmkr Jul 23 '14 at 23:08
  • What is the issue with them being RGB? That doesn't affect the compression in any way, doesn't matter what color space your source has, OpenJPEG will decode them and use the color space provided by you for encoding. Almost all of the listed formats support 16bit color, much more than HEVC even supports. – timonsku Jul 24 '14 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.