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 733467 - Cannot play JPEG2000 encoded QuickTime video
Cannot play JPEG2000 encoded QuickTime video
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.7.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 756288 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-07-20 19:22 UTC by Lubosz Sarnecki
Modified: 2015-10-13 14:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
qtdemux: assume the content is image/jp2 if no jp2h is found (1.76 KB, patch)
2014-07-21 19:31 UTC, Thiago Sousa Santos
none Details | Review
avcodecmap: add jpeg2000 decoder mapping (1.25 KB, patch)
2014-07-21 19:32 UTC, Thiago Sousa Santos
none Details | Review

Description Lubosz Sarnecki 2014-07-20 19:22:28 UTC
File: https://drive.google.com/file/d/0B0bLtNyAhxgoNVlhNkZWQXQtbWM


I have some jpeg2000 decoders installed


$ gst-inspect-1.0 | grep 2000
libav:  avdec_jpeg2000: libav JPEG 2000 decoder
jp2kdecimator:  jp2kdecimator: JPEG2000 decimator
openjpeg:  openjpegdec: OpenJPEG JPEG2000 decoder
openjpeg:  openjpegenc: OpenJPEG JPEG2000 encoder
rtp:  rtpj2kdepay: RTP JPEG 2000 depayloader
rtp:  rtpj2kpay: RTP JPEG 2000 payloader


But gst-discoverer and uridecodebin don't think so


$ gst-discoverer-1.0 31230.mov
Analyzing file:///home/bmonkey/workspace/ges/data/31262/31230.mov
Done discovering file:///home/bmonkey/workspace/ges/data/31262/31230.mov
Missing plugins

Topology:
  container: Quicktime
    audio: MPEG-4 AAC
    video: JPEG 2000

Properties:
  Duration: 0:00:10.091000000
  Seekable: yes
  Tags: 
      application name: Lavf55.21.102
      container format: Quicktime
      audio codec: MPEG-4 AAC
      maximum bitrate: 192193
      bitrate: 192193
      language code: en

$ gst-launch-1.0 uridecodebin uri=file:///home/bmonkey/workspace/ges/data/31262/31230.mov ! videoconvert ! autovideosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Missing element: JPEG 2000 decoder
WARNING: from element /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0: No decoder available for type 'image/x-j2c, fields=(int)1, width=(int)640, height=(int)360, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)1/1'.
Additional debug info:
gsturidecodebin.c(939): unknown_type_cb (): /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0
ERROR: from element /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0: GStreamer encountered a general stream error.
Additional debug info:
qtdemux.c(4434): gst_qtdemux_loop (): /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0:
streaming stopped, reason not-linked
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...


Using openjpegdec and avdec_jpeg2000 manually also does not work.


$ gst-launch-1.0 filesrc location=31230.mov ! qtdemux ! openjpegdec ! videoconvert ! autovideosink
$ gst-launch-1.0 filesrc location=31230.mov ! qtdemux ! avdec_jpeg2000 ! videoconvert ! autovideosink
Comment 1 Thiago Sousa Santos 2014-07-21 05:36:08 UTC
Do you know what generated this sample? Lavf55.21.102? There are a few issues that are preventing this from working.

AFAIK you can have jpeg2000 either as a standalone file, or as its own isomedia  format (jp2) or embedded in a quicktime like any other media. This file is a regular quicktime file but the jpeg2000 track is actually (or seems to be) a jp2 file and not a 'raw' jpeg2000 stream as it usually is.

So the quicktime headers that should describe the media are missing as those headers are already stored in the jp2 file. This leads to an incomplete caps that gets rejected by your openjpegdec element.

The problem continues as, even after extracting this jp2 file from the quicktime one, gstreamer still can't play it (or libav). 


On a related issue, the gst-libav decoder seems be missing a codec id map to gstcaps (working on a patch already).
Comment 2 Lubosz Sarnecki 2014-07-21 10:19:57 UTC
The source of the video file is this page:
http://www.ignitemotion.com/video-with-alpha/

The special thing about the file is that it has an alpha channel.

It plays in VLC and is decodable in ffmpeg.

How fault tolerant should Gstreamer be? It would be cool if anything worked :)
Comment 3 Thiago Sousa Santos 2014-07-21 19:31:43 UTC
Created attachment 281338 [details] [review]
qtdemux: assume the content is image/jp2 if no jp2h is found

This is a weird file as jpeg2000 should have its headers in the trak/stsd
and only the bitstream at the data area. Some applications, however, seem
to be placing the whole jp2 file into the data area and omitting the
jp2h headers from the stsd entry in quicktime.
Comment 4 Thiago Sousa Santos 2014-07-21 19:32:45 UTC
Created attachment 281339 [details] [review]
avcodecmap: add jpeg2000 decoder mapping

Map the 3 possible jpeg2000 caps to JPEG2000 codec id

But it still seems libav can't decode this sample. avplay also fails on it.
So we might need to fix libav to make it work with avdec_jpeg2000
Comment 5 Thiago Sousa Santos 2014-07-21 19:37:01 UTC
I'd like a second opinion on those patches before pushing.
Comment 6 Lubosz Sarnecki 2014-07-24 14:41:07 UTC
The first file I provided was actually reencoded with the ffmpeg command line tool (it looks like this was done incorrectly, maybe?). It is playable in VLC and Google Drive though.

The source files I provided in the link cannot be played by VLC nor detected by gst-dicoverer, but my colleagues could transcode them with ffmpeg successfully.

Thank you for the patches. I tested them can confirm that the incorrectly(?) transcoded ffmpeg files work now.
Comment 7 Sebastian Dröge (slomo) 2014-07-24 15:31:56 UTC
Are you sure libav can handle all 3 variants? I would assume that it only handles jp2 and jpc (codestream *without* size atom in the beginning).
Comment 8 Tim-Philipp Müller 2014-07-24 15:37:13 UTC
If it's just one tool that creates broken files, perhaps we should just catch it and error out instead and get the tool fixed?
Comment 9 Thiago Sousa Santos 2014-07-25 04:32:49 UTC
For gst-libav I couldn't make it work with neither of the 3 jpeg2000 formats using:

gst-launch-1.0 videotestsrc ! openjpegenc ! "image/x-jpc" ! avdec_jpeg2000 ! videoconvert ! autovideosink

None of image/jp2, image/x-jpc or image/x-j2c worked. openjpegdec works with all 3.
Comment 10 Thiago Sousa Santos 2014-07-25 04:47:26 UTC
Filed bug about jpeg2000 in libav: https://bugzilla.libav.org/show_bug.cgi?id=721
Comment 11 Thiago Sousa Santos 2014-07-25 05:10:34 UTC
(In reply to comment #6)
> The first file I provided was actually reencoded with the ffmpeg command line
> tool (it looks like this was done incorrectly, maybe?). It is playable in VLC
> and Google Drive though.
> 
> The source files I provided in the link cannot be played by VLC nor detected by
> gst-dicoverer, but my colleagues could transcode them with ffmpeg successfully.
> 
> Thank you for the patches. I tested them can confirm that the incorrectly(?)
> transcoded ffmpeg files work now.

Can you share the command line you used to generate this file? It would be nice if we could get this fixed in ffmpeg.
Comment 12 Thiago Sousa Santos 2014-08-06 21:55:36 UTC
https://bugzilla.libav.org/show_bug.cgi?id=721

The bug in libav was fixed and using latest version 10 commit makes this file play. Just need to merge the avdec decoder mapping once we decide what should be supported.
Comment 13 Sebastian Dröge (slomo) 2014-08-07 07:07:45 UTC
Well, everything that is handled by libav and does not require conversions on our side :)
Comment 14 Tim-Philipp Müller 2015-06-10 16:44:38 UTC
What's up with this? 1.4 now depends on v10.7 and master on v11.4.
Comment 15 Thiago Sousa Santos 2015-10-10 00:23:12 UTC
*** Bug 756288 has been marked as a duplicate of this bug. ***
Comment 16 Sebastian Dröge (slomo) 2015-10-11 09:37:19 UTC
*** Bug 756288 has been marked as a duplicate of this bug. ***
Comment 17 Thiago Sousa Santos 2015-10-13 14:03:46 UTC
The qtdemux patch isn't needed anymore to play with gst-libav decoder, as this is an weird formatting that was used I just decided to not add special handling for it. In case someone really needs that, please reopen the bug.


commit 1356ff84b3833ce3526758c4c8fe546c303c9cda
Author: Thiago Santos <thiagoss@osg.samsung.com>
Date:   Fri Oct 9 21:22:12 2015 -0300

    avcodecmap: add jpeg2000 decoder mapping
    
    Map the 3 possible jpeg2000 caps to JPEG2000 codec id