Bug 12893 - Support OggFLAC
: Support OggFLAC
Status: RESOLVED FIXED
Product: SqueezePlay
Classification: Unclassified
Component: Audio
: unspecified
: PC Other
: P2 enhancement with 7 votes (vote)
: 7.8.0
Assigned To: Alan Young
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-07-16 09:22 UTC by Andy Grundman
Modified: 2012-03-29 00:22 UTC (History)
7 users (show)

See Also:
Category: Feature


Attachments
Oggflac server side decode (3.17 KB, patch)
2012-01-04 09:00 UTC, Adrian Smith
Details | Diff
Squeezeplay support (3.87 KB, patch)
2012-01-04 14:50 UTC, Adrian Smith
Details | Diff
Oggflac server support (3.91 KB, patch)
2012-01-04 15:48 UTC, Adrian Smith
Details | Diff
Patch to Poky build to include Ogg support in libFLAC (738 bytes, patch)
2012-01-06 06:15 UTC, Alan Young
Details | Diff
Patch to Audio::Scan to support oggflac (4.56 KB, patch)
2012-01-07 05:54 UTC, Adrian Smith
Details | Diff
Patch to Audio::Scan to support oggflac (7.43 KB, patch)
2012-01-07 05:55 UTC, Adrian Smith
Details | Diff
Updated server patch (4.56 KB, patch)
2012-01-07 05:57 UTC, Adrian Smith
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Grundman 2009-07-16 09:22:45 UTC
Should be fairly trivial to support OggFLAC, at least 1 radio stream uses this: http://forums.slimdevices.com/showthread.php?t=65553

Would need to add libogg and build libFLAC with Ogg support, then make a few changes to SC to detect these files/streams and use the FLAC decoder, and have the FLAC decoder call a few Ogg-specific API methods.
Comment 1 bblauret 2011-01-15 04:30:37 UTC
One other radio station is using it as well:
http://www.absoluteradio.co.uk/about/technology_services/flac.html

This could as well be taking off as a lossless streaming method and of course a nice feature to have in SBS!

(BTW bug 12701 is a duplicate, but I did not know how to change that bug's status)
Comment 2 Adrian Smith 2012-01-04 09:00:50 UTC
Created attachment 7595 [details]
Oggflac server side decode
Comment 3 Adrian Smith 2012-01-04 09:04:19 UTC
Above is a proposed server side decode for oggflac making use of the flac binary already shipped.  Interested in views?
Comment 4 Andy Grundman 2012-01-04 09:31:53 UTC
CC Alan for comment. Good work!
Comment 5 Jim McAtee 2012-01-04 09:42:46 UTC
OggFLAC is FLAC in an Ogg container, correct?

So this would decode the FLAC and stream it as AIFF? If you can strip the FLAC from the container, why wouldn't it be streamed as FLAC?
Comment 6 Adrian Smith 2012-01-04 09:52:13 UTC
From my reading that means changing the flac binary - I was trying to use what it currently supports.  But feel free to put me right on a set of options which doesn't do the decode...
Comment 7 Andy Grundman 2012-01-04 09:56:19 UTC
I guess worst case you could pipe it to another flac process to re-encode.
Comment 8 bblauret 2012-01-04 10:00:17 UTC
(In reply to comment #5)
> OggFLAC is FLAC in an Ogg container, correct?
> 
> So this would decode the FLAC and stream it as AIFF? If you can strip the FLAC
> from the container, why wouldn't it be streamed as FLAC?

Of course you can also add the following convert rule to the patch to allow streaming of pcm if you don't like AIFF:

ogf pcm * *
	[flac] -dcsF --ogg --force-raw-format --endian=little --sign=signed -- $FILE$
Comment 9 bblauret 2012-01-04 10:10:42 UTC
It indeed looks a bit silly:

ogf flc * *
    [flac] -dcsF --ogg -- $FILE$ | [flac] -cs --totally-silent --compression-level-0 -
Comment 10 Adrian Smith 2012-01-04 14:50:56 UTC
Created attachment 7596 [details]
Squeezeplay support

This patch supports oggflac streaming on Squeezeplay linux desktop with very minor change (needs a couple of line change in server too)

I've not tried a firmware build but it will require flac to be build with ogg support which it is not at present.
Comment 11 Adrian Smith 2012-01-04 15:48:16 UTC
Created attachment 7597 [details]
Oggflac server support

Updated server patch which supports the SP client playback in the other patch.
Comment 12 Jim McAtee 2012-01-04 20:44:06 UTC
This should re-encode the Ogg FLAC input stream to plain FLAC.

I placed the rule in custom-convert.conf and disabled the other two rules. I can't  decipher the debugging output from player.source, so you'll have verify that it's actually doing what I believe. 

ogf flc * *
	[flac] -cs -- $FILE$
Comment 13 Alan Young 2012-01-05 00:06:56 UTC
Good work.

I note the following from the header of the first stream (http://radio.cesnet.cz:8000/cro-d-dur.flac), which I do not think we currently use:

ice-audio-info: ice-samplerate=48000;ice-bitrate=128;ice-channels=2
Comment 14 Adrian Smith 2012-01-05 02:41:04 UTC
Absolute streams have this as the header:

  "cache-control"  => "no-cache",
  "content-type"   => "application/ogg",
  "ice-audio-info" => "ice-samplerate=44100;ice-bitrate=128;ice-channels=2",
  "icy-br"         => [128, 128],
  "icy-genre"      => "Rock",
  "icy-name"       => "Absolute Radio",
  "icy-private"    => 0,
  "icy-pub"        => 1,
  "icy-url:http"   => "//www.absoluteradio.co.uk",
  server           => "Icecast 2.3.2",

So both using the same Icecast 2.3.2 server (or claiming to!)  Note the bitrate is wrong for a flac stream on both.  I've mailed Absolute about their bitrate setting, but not sure if it is a feature of the server.

LMS is showing a bitrate of 128 for these streams.
Comment 15 Adrian Smith 2012-01-05 02:42:13 UTC
(In reply to comment #12)
> This should re-encode the Ogg FLAC input stream to plain FLAC.
> 
> I placed the rule in custom-convert.conf and disabled the other two rules. I
> can't  decipher the debugging output from player.source, so you'll have verify
> that it's actually doing what I believe. 
> 
> ogf flc * *
>     [flac] -cs -- $FILE$

Unfortunately this doesn't work for streamed files - it fails with:
ERROR: FLAC input has STREAMINFO with unknown total samples which is not supported

Hence the need to decode the file via flac -d.
Comment 16 bblauret 2012-01-05 04:26:33 UTC
Please add the following (or something like that) to the patch for strings.txt:

OGF
        CS      OggFLAC
        DA      OggFLAC
        DE      OggFLAC
        EN      OggFLAC
        ES      OggFLAC
        FI      OggFLAC
        FR      OggFLAC
        HE      OggFLAC
        IT      OggFLAC
        NL      OggFLAC
        NO      OggFLAC
        PL      OggFLAC
        RU      OggFLAC
        SV      OggFLAC
Comment 17 bblauret 2012-01-05 04:43:15 UTC
I get an error with AIFF output:
Slim::Player::TranscodingHelper::getConvertCommand2 (361) Rejecting [flac] -dcsF --ogg --force-aiff-format -- $FILE$ because no available stream mode supported: R

AIFF output still functions, but shouldn't the convert rule be:

ogf aif * *
        # IR
        [flac] -dcsF --ogg --force-aiff-format -- $FILE$
Comment 18 Alan Young 2012-01-06 06:15:11 UTC
Created attachment 7598 [details]
Patch to Poky build to include Ogg support in libFLAC
Comment 19 Jim McAtee 2012-01-06 09:16:00 UTC
(In reply to comment #16)
> Please add the following (or something like that) to the patch for strings.txt:
> 
> OGF
>         EN      OggFLAC

Should be "Ogg FLAC", similar to "Ogg Vorbis".
Comment 20 Adrian Smith 2012-01-07 05:54:14 UTC
Created attachment 7599 [details]
Patch to Audio::Scan to support oggflac

Proposed patch to Scan::Audio to parse streaminfo and vorbis comment blocks from oggflac files and streams.
Comment 21 Adrian Smith 2012-01-07 05:55:56 UTC
Created attachment 7600 [details]
Patch to Audio::Scan to support oggflac

Proposed patch to Scan::Audio to parse streaminfo and vorbis comment blocks
from oggflac files and streams.
Comment 22 Adrian Smith 2012-01-07 05:57:13 UTC
Created attachment 7601 [details]
Updated server patch

Updated server patch including support for local oggflac parsing and playback using AudioScan addition.  No seeking support.
Comment 23 Andy Grundman 2012-01-08 10:55:49 UTC
Great work again. :) How hard do you think seeking would be to support? How popular do you think local OggFLAC files are? I'd guess not very popular at all...
Comment 24 SVN Bot 2012-03-28 06:30:37 UTC
 == Auto-comment from SVN commit #9689 to the jive repo by ayoung ==
 == http://svn.slimdevices.com/jive?view=revision&revision=9689 ==

bug 12893: Support OggFLAC 

Add OggFLAC support to Squeezeplay.
Requires libogg-devel as build-time dependency.
Comment 25 SVN Bot 2012-03-28 08:58:23 UTC
 == Auto-comment from SVN commit #9690 to the jive repo by ayoung ==
 == http://svn.slimdevices.com/jive?view=revision&revision=9690 ==

bug 12893: Support OggFLAC; refer ogf over flc so that we can have a 'ogf -> flc' rule in LMS.
Comment 26 SVN Bot 2012-03-29 00:19:57 UTC
 == Auto-comment from SVN commit #33922 to the slim repo by ayoung ==
 == http://svn.slimdevices.com/slim?view=revision&revision=33922 ==

bug 12893: Support OggFLAC - server support

This is intended only to support streaming, not local files.
Transcoding to ordinary FLAC is included.