Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 9 of 9
  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    8

    DVB Streaming - AC3 Support?

    Hello,

    For some time now I'm using my own software ts2shout (see http://www.siski.de/~carsten/radio-s...queezebox.html) to play DVB-S satellite radio programs on my Squeezeboxes (piCore Player replicas and original Squeezebox radio) and also get some information about the current transmission on the squeezebox display. This works pretty well.

    I have recently implemented the option to extract AC-3 streams from the MPEG transport stream. Obviously the Squeezeboxes can't handle it but playing the resulting AC-3 stream with mplayer on the linux command line works very nice. Has anyone ever dealt with AC-3 files or even streams on piCore player? I would like to send the streams directly as "raw" AC3 streams to the amplifier via the SPDIF interface to get multicannel sound. My amplifier should then decode this.

    Is it possible to make a few changes inside logitechmediaserver (I'm using 7.9.0) to get this working or is it a big issue?

    Thanks,

    Carsten

  2. #2
    Senior Member
    Join Date
    Apr 2015
    Posts
    631
    Have a look at this thread:
    https://forums.slimdevices.com/showt...igma2-Receiver
    Maybe this and the PlayHLS-Plugin — especially all the files on its Folder — may give you some clues.
    The Plugin comes with a custom-convert.conf and a custom-type.conf (or so, I don’t remember the exact filename).
    The first contains the command with the appropriate parameters to progress the filetype, the latter the filetypes to be handled by LMS.
    I don’t understand exactly, what the Plugin itself does. For me, it looks as it would only hook in the debugging mechanism.

  3. #3
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    17,112
    PlayHLS could be repurposed but it is "triggered" by the mime type of a http stream.

    More details on how to "play" the streams by LMS is required ? Are they transported by http, if so what mimemtype has been assigned ?

    Otherwise a plugin with a protocol handle may be necessary - again full details on how the AC3 appears to LMS ius required ? For example on a linux system what is the command line you would use to play the AC3 stream to a ALSA type output device ?

  4. #4
    Junior Member
    Join Date
    Aug 2011
    Posts
    8
    Quote Originally Posted by bpa View Post
    PlayHLS could be repurposed but it is "triggered" by the mime type of a http stream.

    More details on how to "play" the streams by LMS is required ? Are they transported by http, if so what mimemtype has been assigned ?

    Otherwise a plugin with a protocol handle may be necessary - again full details on how the AC3 appears to LMS is required ? For example on a linux system what is the command line you would use to play the AC3 stream to a ALSA type output device ?
    This is all implemented by myself. Therefore the mime-type is actually flexible (means: I can change it), but the standard recommends "audio/ac3". Therefore the http headers of the streaming server look like:

    Code:
    python:~/src/ts2shout>wget -S "http://172.16.0.4/radio/bayern4-ac3" -O output.ac3
    --2019-03-18 22:03:49--  http://172.16.0.4/radio/bayern4-ac3
    Connecting to 172.16.0.4:80... connected.
    HTTP request sent, awaiting response... 
      HTTP/1.1 200 OK
      Date: Mon, 18 Mar 2019 21:03:49 GMT
      Server: Apache/2.4.10 (Debian)
      Connection: close
      Transfer-Encoding: chunked
      Content-Type: audio/ac3
    Length: unspecified [audio/ac3]
    Saving to: 'output.ac3'
    The resulting file can be played for example with mplayer

    Code:
    python:~/src/ts2shout>mplayer output.ac3 
    MPlayer 1.3.0 (Debian), built with gcc-7 (C) 2000-2016 MPlayer Team
    [...]
    ==========================================================================
    Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
    libavcodec version 57.107.100 (external)
    [ac3 @ 0x7f9e3e274920]frame sync error
    AUDIO: 48000 Hz, 2 ch, floatle, 448.0 kbit/14.58% (ratio: 56000->384000)
    Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
    ==========================================================================
    AO: [pulse] 48000Hz 2ch floatle (4 bytes per sample)
    [ And voila ... perfect audio is played ...]

  5. #5
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    17,112
    Quote Originally Posted by siski View Post
    Transfer-Encoding: chunked
    Is the http really "chunked" (i.e. mulitple GET of small http "files" of about 3-10 secs) like DASH, HLS or HDS or it is normal streaming http (single GET of a "file" of a infinite length)

    What creates the original http://172.16.0.4/radio/bayern4-ac3 ? What is the source -(e.g. vendor, model name, model number, software version)

    If the stream is "normal" http (i.e. single GET) and not chunked - it is easy to modify PlayHLS (e.g. callit PlayAC3) and add an Ac3 Type to handle mime audio/ac3

    I suspect it is "normal" but giving more detaisl of the source would help confirm.

  6. #6
    Junior Member
    Join Date
    Aug 2011
    Posts
    8
    Quote Originally Posted by bpa View Post
    Is the http really "chunked" (i.e. mulitple GET of small http "files" of about 3-10 secs) like DASH, HLS or HDS or it is normal streaming http (single GET of a "file" of a infinite length)

    What creates the original http://172.16.0.4/radio/bayern4-ac3 ? What is the source -(e.g. vendor, model name, model number, software version)

    If the stream is "normal" http (i.e. single GET) and not chunked - it is easy to modify PlayHLS (e.g. callit PlayAC3) and add an Ac3 Type to handle mime audio/ac3

    I suspect it is "normal" but giving more detaisl of the source would help confirm.
    It's a normal streaming, this means an endless stream of bytes in a single tcp connection. It works pretty well with normal mpeg stream data from normal radio stations. The AC-3 data should be given in something like a "raw" mode directly to the amplifier and should not be converted/downmixed to normal stereo.

    My setup used is:

    SAT>IP Antenna (Selfsat SATIP21 receiving Astra 19.2) -> tvheadend 4.3-1774~g0122ccb -> apache 2.2 with ts2shout as cgi (converting mp2t -> audio/ac3) -> logitechmediaserver (7.9.0)

    everything works very nice this way (and is described on my page):

    SAT>IP Antenna (Selfsat SATIP21 receiving Astra 19.2) -> tvheadend 4.3-1774~g0122ccb -> apache 2.2 with ts2shout as cgi (converting mp2t -> audio/mpeg (shoutcast) ) -> logitechmediaserver (7.9.0)

  7. #7
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    17,112
    Quote Originally Posted by siski View Post
    It's a normal streaming, this means an endless stream of bytes in a single tcp connection. It works pretty well with normal mpeg stream data from normal radio stations. The AC-3 data should be given in something like a "raw" mode directly to the amplifier and should not be converted/downmixed to normal stereo.
    That make it a bit more complicated because LMS expects 2chn audio and to encourage LMS to handle multichannel it has to be wrapped in a "known" format such as Flac and then sent to the player to decode. This mulit channel issue has been handled in terms of AC3/DTS files so I'll need ot have a look around especially at https://forums.slimdevices.com/showt...urced-from-DVD

  8. #8
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    17,112
    Attached is a framework plugin to play AC3 stream. The plugin is required in order to create a new File Type AC3 (identified by mime-type audio/ac3) and associated a transcoding rule using ffmpeg.

    Your linux system needs to have ffmpeg. Mplayer uses all ffmpeg libraries but the ffmpeg command line is better behaved for LMS transcoding than mplayer. If your distro does not have ffmpeg but avconv - Make a link from avconv to ffmepg or edit the plugin file custom-convert.conf from ffmpeg to avconv.

    Test that your version of ffmpeg can handle ac3 by the following command with a test Ac3 file called testfile.ac3
    Code:
    ffmpeg -i  testfile.ac3 -f flac  testfile.flc
    The converted testfile.flc should be a multichannel flac file and can be played by mplayer or vlc.

    To install the plugin. Download the attached zip file. Unzip - it should create a directory called "PlayAC3 with a few files. Copy the directory to your LMS installation into the "Plugins" directory that is at the same level as "Slim" (this is the manual insytall foir user plugins) do NOT install in the "Plugin" directory under "Slim" - this for Logitech plugins. Restart LMS and check for single entry AC3 file type in WebUI Setting/Advanced/FileTypes
    Attached Files Attached Files

  9. #9
    Junior Member
    Join Date
    Aug 2011
    Posts
    8
    Quote Originally Posted by bpa View Post
    Attached is a framework plugin to play AC3 stream. The plugin is required in order to create a new File Type AC3 (identified by mime-type audio/ac3) and associated a transcoding rule using ffmpeg.

    [...]

    Code:
    ffmpeg -i  testfile.ac3 -f flac  testfile.flc
    The converted testfile.flc should be a multichannel flac file and can be played by mplayer or vlc.
    Many thanks for your help! Actually now I can directly play the AC-3 from stream. For your information:

    Code:
    python:~>wget -S "http://172.16.0.4/radio/bayern4-ac3" -O output.ac3
    [...]
    python:~>file output.ac3 
    output.ac3: ATSC A/52 aka AC-3 aka Dolby Digital stream, 48 kHz,, complete main (CM) 2 front/0 rear, not Dolby Surround encoded, 448 kbit/s
    python:~>ffmpeg -i output.ac3 -f flac output.flac
    ffmpeg version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2000-2018 the FFmpeg developers
    [...]
    [ac3 @ 0x55609a2018c0] Estimating duration from bitrate, this may be inaccurate
    Input #0, ac3, from 'output.ac3':
      Duration: 00:00:08.12, start: 0.000000, bitrate: 448 kb/s
        Stream #0:0: Audio: ac3, 48000 Hz, stereo, fltp, 448 kb/s
    ...etc.
    On first sight it works. Also your plugin - it converts sucessfully to flac like ffmpeg does on the command-line and it works - this means the AC-3 stream is played on the piCore player replica. But .. it's only a stereo PCM, which is what I expect as you convert it with ffmpeg. But it's very good to know how this is implemented. During my test BR-KLASSIK did only send a dual-channel AC-3 (this is quite normal, only some "friday evening" concerts get AC-3 multichannel).

    I'll take a different approach: I'll try to fetch something like a concert on BR-KLASSIK in AC-3 multichannel and try to play the resulting file directly to test the Hifiberry card on the piCore player. If this works I'll continue with the squeezebox/slimserver/logitechmediaserver.

    Thanks for your help! I also updated my ts2shout to improve stream startup.

    Regards and thanks

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •