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 663458 - qtdemux: add support for LPCM QuickTime 7 uncompressed audio
qtdemux: add support for LPCM QuickTime 7 uncompressed audio
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.x
Other Linux
: Normal normal
: 1.1.1
Assigned To: David Schleef
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-11-05 16:01 UTC by Vernon
Modified: 2013-01-29 00:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch from me that was probably tried (923 bytes, patch)
2011-11-07 00:01 UTC, Mart Raudsepp
rejected Details | Review

Description Vernon 2011-11-05 16:01:00 UTC
An Olympus LS-20M Linear PCM camera recorder created this mov file that has a lpcm FOURCC in there and it isn't supported by gstreamer.

Afraid to attach a video clip here as the HD video is large, so I will host a short clip here for a while:
http://lightcloud.verns.net/foo.mov
Comment 1 Vernon 2011-11-05 16:04:27 UTC
trying a patch to qtdemux now ...
Comment 2 Vernon 2011-11-05 18:58:35 UTC
my patch did not work ... imagine that.
Comment 3 Mart Raudsepp 2011-11-07 00:01:26 UTC
Created attachment 200852 [details] [review]
Patch from me that was probably tried

Adds the FOURCC to qtdemux to map it to audio/x-lpcm, for which we have a plugin in -ugly named dvdlpcmdec, but that one doesn't quite like it at all it seems. Needs closer look than just adding a mapping.
Comment 4 Vernon 2011-11-07 01:50:49 UTC
Yes, that's right.  I tried Mart's patch.  It did not work.
Comment 5 Michael Smith 2011-11-09 00:08:05 UTC
dvdlcpmdec is a decoder for the weird linear pcm encoding used on DVDs.

'lpcm' in a mov file is _probably_ some form of straightforward linear pcm. You _probably_ won't need a decoder for it; it'll just need a mapping to audio/x-raw-int or audio/x-raw-float caps.
Comment 6 David Schleef 2011-12-09 02:40:00 UTC
24-bit 2-channel PCM.

gst-launch filesrc location=foo.mov ! qtdemux ! audio/x-gst-fourcc-lpcm ! audioparse channels=2 endianness=1234 depth=24 width=24 ! audioconvert ! alsasink -v


A patch would be welcome, and rather easy.
Comment 7 Mart Raudsepp 2011-12-10 06:17:12 UTC
This is new in QuickTime 7 for uncompressed audio

http://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-128916  "Sound Sample Description (Version 2)" seems to document how to parse out the number of channels and so on.

Might be nice to support this in qtmux as well, though it already supports some other uncompressed audio FOURCCs
Comment 8 Gili 2012-11-11 05:53:56 UTC
Gentlemen,

Without a workaround and newer versions of iOS requiring the use of Quicktime 7+ I am afraid we are out of options. I also get the feeling that this issue won't be resolved anytime soon because nearly a year has passed without any activity.

What can I do to help, short of contributing a patch (which I don't have the technical expertise to do)?
Comment 9 Nicolas Dufresne (ndufresne) 2012-11-11 10:10:58 UTC
I just extracted the raw lpcm stream and did some tests on 1.0. It seems I can play this lpcm as normal 24bit raw PCM.

gst-launch-1.0 filesrc blocksize=4800 location=raw.lpcm ! audio/x-raw,format=S24LE,channels=2,rate=48000 ! audioconvert ! pulsesink

Now one need to check QT format, as we need to know endienness, rate, number of channels, etc.
Comment 10 Nicolas Dufresne (ndufresne) 2012-11-11 10:30:18 UTC
(In reply to comment #9)
> gst-launch-1.0 filesrc blocksize=4800 location=raw.lpcm !
> audio/x-raw,format=S24LE,channels=2,rate=48000 ! audioconvert ! pulsesink

Actually rate is 96000.
Comment 11 Vernon 2012-11-13 13:12:13 UTC
I am still not able to do the playback as you described above.  Did you do something to convert the file from foo.mov to raw.lpcm?
Comment 12 Tim-Philipp Müller 2012-11-13 13:18:29 UTC
I looked at this briefly the other day, and found that the issue wasn't so much figuring out the right caps, but that we get one audio frame (i.e. 1 sample per channel) per chunk, which creates a lot of buffers per second - a bit too much for things to work properly for live playback in my case. Don't know if there's additional info somewhere to pull N chunks in one go, or if the demuxer has to figure this out itself, or how it's supposed to work.
Comment 13 Youness Alaoui 2013-01-09 03:19:17 UTC
I've added LPCM support to qtdemux so it should technically work now. See my commits on qtdemux and qtdemux-1.0 branches here : http://cgit.collabora.com/git/user/kakaroto/gst-plugins-good.git/log/?h=qtdemux (based on 0.10) and
http://cgit.collabora.com/git/user/kakaroto/gst-plugins-good.git/log/?h=qtdemux-1.0 (based on master)
It will parse the sound sample description and output the right caps depending on the format.

The issue that remains though is what Tim-Philipp reported, it's pushing 6 bytes buffers which makes the CPU go crazy both by gst-launch and pulseaudio.

From what I could see, there is a n_samples_per_chunk, but it seems to be given by the file itself (stbl atom), and it says 1 in the file.
I think it's somehow unrelated though, I think it's more about how each sample is stored in the file (interleaved chunks of audio and video) and the demuxer should be smarter than that when pushing out buffers.
I haven't looked too much into how the buffers are output yet from the demuxer, but I would suggest we merge my patches and close this bug and clone/open a new one about the 6 bytes buffers issue, as it's unrelated to LPCM support itself.

With my fixes, transcoding the file actually fixes the sound issue but it took me 35 seconds to transcode the 12s audio from raw to mp3.
Comment 14 Tim-Philipp Müller 2013-01-28 23:59:31 UTC
> I haven't looked too much into how the buffers are output yet from the demuxer,
> but I would suggest we merge my patches and close this bug and clone/open a new
> one about the 6 bytes buffers issue, as it's unrelated to LPCM support itself.

Agreed.

 
> With my fixes, transcoding the file actually fixes the sound issue but it took
> me 35 seconds to transcode the 12s audio from raw to mp3.

This works:

gst-launch-1.0 uridecodebin uri=file:///663458-lpcm.mov name=d  d. ! queue ! videoconvert ! xvimagesink   d. ! rndbuffersize min=6000 max=6000 ! audioconvert ! pulsesink


I've fixed up one of the commit messages a little to explain why qdm2 caps parsing was disabled (which confused me at first when I saw the patch), and added bug links to this bug:

commit f6a00ad6e9165ed3b59eba904cfbb8bbbee23495
Author: Youness Alaoui <youness.alaoui@collabora.co.uk>
Date:   Wed Jan 9 13:24:49 2013 -0500

    qtdemux: set interleaved layout correctly for LPCM audio
    
    https://bugzilla.gnome.org/show_bug.cgi?id=663458

commit a76524ea08ebc0322b11d9743733d3987b4793fd
Author: Youness Alaoui <youness.alaoui@collabora.co.uk>
Date:   Tue Jan 8 20:45:21 2013 -0500

    qtdemux: add support for LPCM fourcc (uncompressed audio in Quicktime7)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=663458

commit 69b814546a65a3f62a733dae40c55ad90aab0b44
Author: Youness Alaoui <youness.alaoui@collabora.co.uk>
Date:   Tue Jan 8 20:42:35 2013 -0500

    qtdemux: print all debug for sound sample description v2
    
    https://bugzilla.gnome.org/show_bug.cgi?id=663458

commit 92ff8a9b09424101557824bb2a3c94939c61a8e0
Author: Youness Alaoui <youness.alaoui@collabora.co.uk>
Date:   Tue Jan 8 20:14:17 2013 -0500

    qtdemux: sound sample description v2 doesn't override samples_per_packet
    
    https://bugzilla.gnome.org/show_bug.cgi?id=663458

commit ee3d9cbd98d1c5e63251d87a061240b0b44eaa23
Author: Youness Alaoui <youness.alaoui@collabora.co.uk>
Date:   Tue Jan 8 19:57:50 2013 -0500

    qtdemux: pass stsd data to qtdemux_audio_caps()
    
    We will need that later for LPCM format support. Disable
    QDM2 parsing of stsd data which dead code before as well
    because data was always NULL.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=663458

commit 6d3ff78575397ec714c7aa7d55ae86285a3efa85
Author: Youness Alaoui <youness.alaoui@collabora.co.uk>
Date:   Tue Jan 8 19:56:46 2013 -0500

    qtdemux: add len check for sound sample descriptions v1 and v2
    
    https://bugzilla.gnome.org/show_bug.cgi?id=663458

commit 629772f735902e81d511ba3c39821b7e178184db
Author: Tim-Philipp Müller <tim@centricular.net>
Date:   Mon Jan 28 22:42:25 2013 +0000

    rtpmanager: use C89-style comments



Thanks for the patches everyone!