After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 598916 - qtmux: support more of j2k
qtmux: support more of j2k
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 0.10.18
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-10-19 11:41 UTC by Andy Wingo
Modified: 2009-12-16 19:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
First patch (12.91 KB, patch)
2009-10-20 19:46 UTC, Thiago Sousa Santos
none Details | Review
same as thiago's patch, updated to compile (9.42 KB, patch)
2009-12-01 16:40 UTC, Andy Wingo
none Details | Review
updated patch (9.88 KB, patch)
2009-12-11 01:23 UTC, Thiago Sousa Santos
none Details | Review
Support for more j2k (14.91 KB, patch)
2009-12-14 23:24 UTC, Thiago Sousa Santos
committed Details | Review

Description Andy Wingo 2009-10-19 11:41:06 UTC
Things that it would be nice if qtmux supported, regarding jpeg2000 data:

 1. Images with alpha channels. Would require component mappings and channel definitions, as from #598915.

 2. Similarly, images with nonstandard component counts or orderings. For example AYUV or BGRA.

 3. Images with num-components != 3. This is probably just a bug, the num-components field in the image/x-j2c caps from #598915 could be used to determine this.

See also #598915.
Comment 1 Thiago Sousa Santos 2009-10-20 19:46:37 UTC
Created attachment 145887 [details] [review]
First patch

Please, review and test. I don't have many mj2 files around, and the jp2kdec keeps rejecting the files I try to play.
Comment 2 Andy Wingo 2009-12-01 16:40:34 UTC
Created attachment 148833 [details] [review]
same as thiago's patch, updated to compile

Here's a patch that compiles with the current code. However the resulting file does not demux properly, due to an mdat without a length or something. Do you know what the deal is, Thiago?
Comment 3 Andy Wingo 2009-12-01 16:41:15 UTC
BTW, I am finally able to deal in proper J2C streams, so I should be able to test this patch now. Sorry for the delay.
Comment 4 Thiago Sousa Santos 2009-12-01 21:17:57 UTC
Could you make some samples available so that I could try myself?
Comment 5 Thiago Sousa Santos 2009-12-02 13:56:19 UTC
(In reply to comment #2)
> Created an attachment (id=148833) [details] [review]
> same as thiago's patch, updated to compile
> 
> Here's a patch that compiles with the current code. However the resulting file
> does not demux properly, due to an mdat without a length or something. Do you
> know what the deal is, Thiago?

What pipeline are you using? Are you using gst-launch using a live src for recording? If so, you might be missing the -e flag to gst-launch to force it to push an EOS when you press the ctrl+c.
Comment 6 Andy Wingo 2009-12-02 17:40:26 UTC
I have been trying to do so all day but found some bugs. I will have them for you next week :/
Comment 7 Andy Wingo 2009-12-02 17:41:53 UTC
(In reply to comment #5)
> (In reply to comment #2)
> > Created an attachment (id=148833) [details] [review] [details] [review]
> > same as thiago's patch, updated to compile
> > 
> > Here's a patch that compiles with the current code. However the resulting file
> > does not demux properly, due to an mdat without a length or something. Do you
> > know what the deal is, Thiago?
> 
> What pipeline are you using? Are you using gst-launch using a live src for
> recording? If so, you might be missing the -e flag to gst-launch to force it to
> push an EOS when you press the ctrl+c.

That could very well be. I'll check it out. As it is I am having some problems getting my hardware decoder to handle valid j2c. Will let you know when things settly on my end.

Thanks for the tip :)
Comment 8 Andy Wingo 2009-12-09 10:45:32 UTC
Verily:

  image/x-j2c, fourcc=(fourcc)sYUV, width=(int)800, height=(int)600,
       num-components=(int)3, framerate=(fraction)10/1, fields=(int)1

  http://wingolog.org/pub/thiago-j2c-yuv.gdp

And:

  image/x-j2c, fourcc=(fourcc)sRGB, width=(int)800, height=(int)600,
       num-components=(int)3, framerate=(fraction)10/1, fields=(int)1,
       channel-definitions=(int)< 1, 2, 3 >

  http://wingolog.org/pub/thiago-j2c-rgb.gdp

Both are about 1 MB, and 20 frames.
Comment 9 Andy Wingo 2009-12-09 12:41:48 UTC
Hm, I see now that "image/x-j2c" is supposed to be boxed already, according to comments in gstjasperdec.c. The data in those streams is unboxed, but claims to be image/x-j2c.
Comment 10 Andy Wingo 2009-12-09 13:38:44 UTC
I fixed my codestream muxer and made these with image/x-jpc caps.

  http://wingolog.org/pub/thiago-j2c-yuv.gdp
  http://wingolog.org/pub/thiago-j2c-rgb.gdp

I have verified that the RGB one decodes correctly with jp2kdec (jasper), though it has an error on the yuv one, which I haven't yet tracked down.
Comment 11 Andy Wingo 2009-12-09 13:39:19 UTC
er, sorry; I meant these links:

  http://wingolog.org/pub/thiago-jpc-yuv.gdp
  http://wingolog.org/pub/thiago-jpc-rgb.gdp
Comment 12 Andy Wingo 2009-12-09 13:45:40 UTC
Whee, YUV decoding with jasper works too. I was just missing holy water in the form of ffmpegcolorspace.
Comment 13 Andy Wingo 2009-12-10 11:09:48 UTC
Is there any way to make mj2mux accept jpc instead of j2c? It seems quite silly to have to box the codestreams just for Quicktime's benefit.
Comment 14 Thiago Sousa Santos 2009-12-11 01:20:44 UTC
What is the difference between them in qt/mj2 muxing terms? Couldn't find it in the docs I have around.
Comment 15 Thiago Sousa Santos 2009-12-11 01:23:21 UTC
Created attachment 149558 [details] [review]
updated patch

Still couldn't test as the current implementation is for image/x-jp2 streams.
Comment 16 Thiago Sousa Santos 2009-12-14 23:24:24 UTC
Created attachment 149737 [details] [review]
Support for more j2k

Updated patch, now with support to jpc as well.
Comment 17 Andy Wingo 2009-12-16 10:10:58 UTC
Most excellent! I have been able to mux frames, demux with qtmux, and decode them, with correct colors.

Thank you very much!
Comment 18 Thiago Sousa Santos 2009-12-16 19:46:57 UTC
Fixed.

Module: gst-plugins-bad
Branch: master
Commit: 1b2e0eae670fafeb9773b7c9f7efdb8c06c05f18
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=1b2e0eae670fafeb9773b7c9f7efdb8c06c05f18

Author: Thiago Santos <thiago.sousa.santos@collabora.co.uk>
Date:   Thu Dec 10 22:20:45 2009 -0300

qtmux: support more of j2k

Reads the new caps added to qtdemux by commit
c917d65e6df0b5d585f905c7ad78a8a0a44b2cb0
and adds its corresponding atoms.

Also adds support for image/x-jpc as it is the same
as image/x-jp2, except that the buffers need to be
boxed inside a jp2c isom box before muxing. To solve
this the QTPads now have a function that (if
not NULL) is called when a buffer is collected. This
function returns a replacement to the current collected
buffer.

Fixes #598916