[FFmpeg-user] DPX to jp2 encoding

Dave Rice dave at dericed.com
Tue May 27 18:18:26 CEST 2014


Hi Rajendran,

On May 27, 2014, at 8:46 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> Rajendran Krishnan <rajendran_t_k <at> yahoo.co.in> writes:
> 
>> I'm in process of converting DPX image files to JPEG2000 
>> (jp2) lossless image sequence. Kindly advise how
>> do I convert using ffmpeg with reversible option.
> 
> What is the "reversible option"?

For some reason jpeg2000 users use reversible and irreversible in place of lossless and lossy. Example: http://www.digitalpreservation.gov:8081/formats/fdd/fdd000140.shtml

> I believe that on this mailing list, you are less likely 
> to get an answer if you ask "how can I" than to ask "I 
> tried 'ffmpeg -i input.dpx out.jp2' but the output isn't 
> what I expected, please see my command line including 
> the complete, uncut console output below".

I agree with Carl's comments but will answer despite the odds. ;)

Typically dpx files represent an image sequence, so you'd need to express that sequence pattern as an ffmpeg input. Often dpx image sequences don't count from zero so you can declare a start number before the input.

I have a folder of dpx images that start at 100000.dpx and increment from there, so to convert that to a jpeg2000 in mov container, I could use this:

ffmpeg -start_number 100000 -i %06d.dpx -c:v libopenjpeg output.mov

The %06d represents an incrementing six digit number while the -start_number declares that the number starts counting up from 100000.

To verify the revisibility in a very paranoid way you could do this:

ffmpeg -start_number 100000 -i %06d.dpx -c:v libopenjpeg output.mov -f framemd5 dpx_sequence.framemd5
ffmpeg -vcodec libopenjpeg -i output.mov -f framemd5 jpeg2000_reversible_copy.framemd5

Then if framemd5 dpx_sequence.framemd5 and jpeg2000_reversible_copy.framemd5 are identical you can presume that both the original dpx sequence and the jpeg2000 copy decode to the same video data (reversible). See http://ffmpeg.org/ffmpeg-formats.html#framemd5.

Also note that libopenjpeg is slow compared to other lossless codecs in ffmpeg. I tested dpx->libopenjpeg and dpx->ffv1 and ffv1 was about 10 times faster at getting a lossless result.

> Don't forget to compile with --enable-libopenjpeg.

Yes, please note that the default jpeg2000 encoder/decoder is broken on most pixel formats. If you're a jpeg2000 user it is often safer to use both --enable-libopenjpeg and --disable-decoder=jpeg2000 when compiling. If not using --disable-decoder=jpeg2000 it's a good idea to always use "-vcodec libopenjpeg" before any jpeg2000 input, as otherwise ffmpeg may default to its native j2k decoder which is broken for all but a couple pixel formats. See: http://trac.ffmpeg.org/ticket/3619.

Best Regards,
Dave Rice


More information about the ffmpeg-user mailing list