Bug 17201 - Can't stream M4A/AAC podcasts
: Can't stream M4A/AAC podcasts
Status: NEW
Product: Logitech Media Server
Classification: Unclassified
Component: Podcasts
: 7.6.0
: PC Windows Home Server
: P2 normal with 7 votes (vote)
: ---
Assigned To: Squeezebox QA Team email alias
: patch_waiting
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-06 05:55 UTC by Wigster
Modified: 2013-05-07 15:41 UTC (History)
5 users (show)

See Also:
Category: ---


Attachments
SBS Log (7.90 KB, application/octet-stream)
2011-05-06 05:55 UTC, Wigster
Details
AAC media file analysis (3.10 KB, text/plain)
2011-05-06 05:56 UTC, Wigster
Details
New log file following addition to custom-convert.conf (6.90 KB, text/plain)
2011-05-15 06:56 UTC, Wigster
Details
Windows crash report for FAAD.exe (50.31 KB, application/octet-stream)
2011-07-15 02:52 UTC, Wigster
Details
Patch to Slim/Utils/Scanner/Remote.pm (1.69 KB, patch)
2011-10-03 03:53 UTC, Bryan Alton
Details | Diff
Patch to Slim/Player/Song.pm (1.16 KB, patch)
2011-10-03 03:55 UTC, Bryan Alton
Details | Diff
Custom-convert.conf file to enable ffmpeg to do mp4 format transcoding (370 bytes, application/octet-stream)
2011-10-03 03:57 UTC, Bryan Alton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wigster 2011-05-06 05:55:44 UTC
Created attachment 7262 [details]
SBS Log

I am running 7.6.32390 on WHS. I have a Squeezebox 3.

Currently, if I try to access an m4a podcast, the Squeezebox thinks it's
playing it and starts producing random crackling noise interspersed with
silence. I am playing the podcasts through Mediafly, but as far as I am aware
this app is just a wrapper which redirects the Squeezeserver to a file on the
podcast server, so I don't think it's an issue with Mediafly.

Attempting to use the podcast app to play these podcasts was even less
successful in the past. A typical problematic podcast would be:

http://podcast.hospitalrecords.com/H...rdsPodcast.xml

It is an AAC file (with an m4a extension). I have attached a file analysis to
this message. I should say that playing the podcast file locally is not
problematic (faad and flac are both running and doing the transcoding).

When I try to stream the file, the web interface reports that buffering goes on
as it should. Then one of two things happens: either the faad process starts
begins to take all the CPU time and runs for a while before quitting. During
this time the SBS web interface is frozen and unfreezes when faad is gone. Or,
I never see faad appear (maybe it quits immediately?) and the interface does
not freeze.

Either way, the playing time counter keeps running and the Squeezebox mostly
produces silence, interspersed with crackles.

I'm attaching a log from SBS and an analysis for the podcast file, if that is
helpful.
Comment 1 Wigster 2011-05-06 05:56:12 UTC
Created attachment 7263 [details]
AAC media file analysis
Comment 2 Wigster 2011-05-11 03:06:01 UTC
Following some discussion on the beta forum

http://forums.slimdevices.com/showthread.php?t=87526

it turns out that the particular podcast erroneously serves its MIME type as text. However, the same problem occurs with m4a podcasts which serve the correct MIME type of audio/mp4, for example:

http://media.ninjatune.net/podcast/ninja_cast_11.m4a

Trying to stream this through the podcast player or as "tune in URL" either makes the SBS think it's playing it with the silence/crackling behaviour, or worse: it sometimes launches FAAD which then begins to take up 30% of CPU time while the web interface hangs until FAAD gives up.
Comment 3 Wigster 2011-05-15 06:56:33 UTC
Created attachment 7279 [details]
New log file following addition to custom-convert.conf
Comment 4 Wigster 2011-07-15 02:52:33 UTC
Created attachment 7332 [details]
Windows crash report for FAAD.exe
Comment 5 Wigster 2011-07-15 02:55:08 UTC
I have realised that FAAD.exe actually repeatedly *CRASHES* when I try to transcode an AAC/M4A stream off the internet (podcast, or just a URL link, BBC iPlayer somehow manages it fine).

I'm attaching the crash reports that Windows Home Server offers to send to Microsoft. Hopefully they will be helpful.
Comment 6 Bryan Alton 2011-10-03 03:53:37 UTC
Created attachment 7488 [details]
Patch to Slim/Utils/Scanner/Remote.pm

In its current form, an faad based solution will never be able to stream m4a/mp4 podcasts for two reason:
1. faad cannot take an URL as an input (type "F" in convert.conf) 
2. if SBS streams the URL through stdin to faad (type "I" in convert.conf) - faad needs to be able to seek into the stream to handle mpeg4 headers and so it crashes as it cannot backup stdin.

The changes to convert.conf will not fix these shortcoming with faad and in fact cause the crashes (i.e. faad crashes while attempting to seek stdin backwards).

Attached to this post are two patches to SBS 7.7 svn 33544 files and a custom-convert.conf file.  The patches enable an ffnpeg based way of streaming m4a/mp4 podcats and also being able to ffw/rew/jumpt to a time point in the stream. I haven't tested the patches & conf on OSX or Windows but I think only conf file and ffmpeg would vary according to platform so shouldn't affect a standard SBS.

If the patches are applied to 7.7 - then there will be no addition or breaking of functionality as faad will still have shortcoming.  If the user install ffmpeg and the custom-convert.conf file - then user will have m4a/mp4 streaming functionality.  I think applying the patches to 7.7 as standard is reasonable as leaving it up to user to install ffmpeg is the same as current SBS practice wrt lame.  ffmpeg is also better at handling mp4 file with other content such as video and so provide a workaround to bugs such as bug 17556.

There are caveats.
1. To play m4as podcasts on Touch, native mp4 will need to be disabled. I think this will not affect AAC files and stream playback but will affect m4a/mp4 files playback.
2. Many m4a/mp4 podcast have strange MIME type associated with the context.  The fixes (together with bug 17586 ) override MP3 and TXT format types if podcast has m4a/mp4 name extension.  For other "standard" MIME type would need the user to add their own in custom-types.conf 

These patches can be applied to 7.6.* but the fix suggested in bug 17586 would need to be applied (https://bugs-archive.lyrion.org/show_bug.cgi?id=17586 ) as SBS would use "MOV" type rather than mp4.
Comment 7 Bryan Alton 2011-10-03 03:55:48 UTC
Created attachment 7489 [details]
Patch to Slim/Player/Song.pm

Second part of patch to fix m4a podcast support.  This patch enables seeking into transcoded streams.
Comment 8 Bryan Alton 2011-10-03 03:57:28 UTC
Created attachment 7490 [details]
Custom-convert.conf file to enable ffmpeg to do mp4 format  transcoding

conf file to enable ffmpeg to do transcoding including seeking into streams.
Comment 9 Bryan Alton 2011-10-03 03:59:06 UTC
*** This bug has been confirmed by popular vote. ***
Comment 10 Michael Herger 2012-03-26 22:39:46 UTC
One other issue I've encountered is LMS failing to stream to SP based players directly if the content type is set to m4a instead of aac.
Comment 11 Michael Herger 2013-04-29 19:03:26 UTC
*** Bug 14313 has been marked as a duplicate of this bug. ***
Comment 12 Martin Williams 2013-05-07 15:33:24 UTC
(In reply to comment #10)
> One other issue I've encountered is LMS failing to stream to SP based
> players directly if the content type is set to m4a instead of aac.

Disabling transcoding MPEG4 -> AAC native resolves this for me. But that's
not an option if connected directly to MySB.com.

Direct cause:

My SB Radio does not include 'mp4' in its list of capabilities. Despite
that, the server still attempts to direct stream. (The decision made by
Slim::Player::Protocols::HTTP:canDirectStream doesn't take stream format
into account).

Therefore the attempt fails in Slim::Player::Squeezebox2::directHeaders,
as 'mp4' fails '$client->contentTypeSupported($contentType)'. Set
player.streaming.direct log level to 'warning' to see a trace.

Observation:

If one 'fudges' the SB Radio capabilities to include 'mp4', a stream will
start playing. This might be useful for MySB.com. But there still seem to
be problems with pause/resume - it just doesn't resume. Attempts to seek
within the track also fail. Perhaps there just shouldn't be a seek option
offered. I don't know whether these are SB Radio or server issues.

I tested this briefly by fudging and disabling the local transcoders. I
haven't spotted the cause, and wouldn't really know where to look.
Comment 13 Martin Williams 2013-05-07 15:41:19 UTC
I should remark that I have applied Bryan's patches & installed his custom
config file. Works well with my Debian Squeeze and a stock ffmpeg.

Provided, as mentioned, that the mp4->aac direct transcoding is disabled.
Media mime type being played is 'audio/mp4', with an 'm4a' file type
suffix.