[FFmpeg-devel] [PATCH] libopenjpeg J2K encoder

Michael Niedermayer michaelni at gmx.at
Thu Nov 17 16:23:18 CET 2011


On Wed, Nov 16, 2011 at 11:58:26PM -0700, Michael Bradshaw wrote:
> Hi, attached is a patch for J2K encoding with libopenjpeg.  Here are a
> couple of particular features you might want to be aware of:
> Supported pixel formats: Gray, RGB24, RGBA, YUV420P, YUV422P, YUV440P, and
> YUV444P (though decoding YUV444P is tricky since it looks like RGB24)
> Lossless and lossy encoding (not setting compression_level or setting it to
> 0 will give lossless encoding, setting it higher will give lossy encoding)
> I apologize for the octet-stream content type, but Gmail is forcing it.
> Thanks,
> Michael

ill apply the renaming of the decoder in a moment.

The encoder does for me either produce:
Could not copy the frame data to the internal image buffer
Video encoding failed

or crash:

#0  0x00000000013fe0c0 in ?? ()
#1  0x00007ffff5ff8f00 in opj_event_msg () from /usr/lib/libopenjpeg.so.2
#2  0x00007ffff5ffcf7e in j2k_encode () from /usr/lib/libopenjpeg.so.2
#3  0x00000000007863f7 in libopenjpeg_encode_frame (avctx=0x13fda40,
    buf=0x16f1000 "-\262\245E\335Jn\254\310:\a!N\320\301\267\270lQ.\265\005=t.f\323kJ\256a\177\005p\017p\032\021u\363=b\211\216е\n)kVXuh1\251\016\220\361\"\352\345ȂIpb\214F\207\035\223K\031Q\217c\276\226\221\264\234\301\245\225\224k\224\342\353\274KR\271V\034\250\332\032\260-i\236\267\235c\227\306q\324\\\364Tf\336\023\261\204\r\224\261\374\021\002\317\037\034\037\217\255҄\243\233\243{2\245\324\365\065N\355m\355\211ڛ\206\065\313\005\267fʢ\035\274\361\212t\031WJ٘KG\020쯽2\372\274\231V\032\234\326=k1\v\275\203G\344\303\314\302\336\036\061\067\345\364=\003\254\252"..., buf_size=468752, data=<value optimized out>)
    at libavcodec/libopenjpegenc.c:251
#4  0x00000000008a3fff in avcodec_encode_video (avctx=0x13fda40,
    buf=0x16f1000 "-\262\245E\335Jn\254\310:\a!N\320\301\267\270lQ.\265\005=t.f\323kJ\256a\177\005p\017p\032\021u\363=b\211\216е\n)kVXuh1\251\016\220\361\"\352\345ȂIpb\214F\207\035\223K\031Q\217c\276\226\221\264\234\301\245\225\224k\224\342\353\274KR\271V\034\250\332\032\260-i\236\267\235c\227\306q\324\\\364Tf\336\023\261\204\r\224\261\374\021\002\317\037\034\037\217\255҄\243\233\243{2\245\324\365\065N\355m\355\211ڛ\206\065\313\005\267fʢ\035\274\361\212t\031WJ٘KG\020쯽2\372\274\231V\032\234\326=k1\v\275\203G\344\303\314\302\336\036\061\067\345\364=\003\254\252"..., buf_size=468752, pict=0x7fffffffbff0)
    at libavcodec/utils.c:747
#5  0x000000000043f806 in do_video_out (ist=<value optimized out>, ist_index=0, ost_table=0x13f5970, nb_ostreams=2, pkt=<value optimized out>) at ffmpeg.c:1323
#6  output_packet (ist=<value optimized out>, ist_index=0, ost_table=0x13f5970, nb_ostreams=2, pkt=<value optimized out>) at ffmpeg.c:1922
#7  0x0000000000443c3f in transcode (output_files=0x13f6ed0, nb_output_files=1, input_files=0x13f1010, nb_input_files=-2111438377) at ffmpeg.c:2709
#8  0x0000000000447a16 in main (argc=<value optimized out>, argv=<value optimized out>) at ffmpeg.c:4757

depending on the pixel format and video size it seems

also please remove trailing whitespace and the encoder needs to be
added in configure so it depends on libopenjpeg and should be aded to
You also probably want to add yourself to the copyright at the files
top. And if you want to maintain this code in the future in ffmpeg
then please add yourself to MAINTAINERs too

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111117/6e516a57/attachment.asc>

More information about the ffmpeg-devel mailing list