GNOME Bugzilla – Bug 733467
Cannot play JPEG2000 encoded QuickTime video
Last modified: 2015-10-13 14:03:46 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
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).
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 :)
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.
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
I'd like a second opinion on those patches before pushing.
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.
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).
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?
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.
Filed bug about jpeg2000 in libav: https://bugzilla.libav.org/show_bug.cgi?id=721
(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.
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.
Well, everything that is handled by libav and does not require conversions on our side :)
What's up with this? 1.4 now depends on v10.7 and master on v11.4.
*** Bug 756288 has been marked as a duplicate of this bug. ***
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