Error in streamed MPEG4 handling - Movie.pm or Audio::Scan error ?

bpa <bpa.admwgn-NUepA2SMhDQqspMVqqL2D+4xXEVPTSb/[email protected]>
Newsgroups gmane.music.equipment.slimdevices.devel
Organization Logitech Squeezebox Forums
Message-ID <[email protected]>
Looking at feasibility of an Accuradio plugins and was checking the
audio streams.
I've having a problem playing some MPEG-4 streaming URLs. Tests are on a
Ubuntu system LMS 8.3 (2Jan) 

It looks like a bug in either LMS MPEG-4 Handling of InitialAudioBlock
or in Audio::Scan

Example URL.
https://d1qg6pckcqcdk0.cloudfront.net/classical2/londonoratorysc_sacredtreasures_07_salvatormundii.m4a

When downloaded as a file, the file plays OK on both an Receiver (i.e.
faad MP4->Flc transcode) and a DAC32 (i.e. MP4->aac) 

When played as an URL
- no output on Receiver - faad (-q removed) produces an error -
Duration, speed and channel all are wrong.

Code:
--------------------
    
  Streamed input format  samplerate 22050 channels 0.
  - file info:
  ADTS, 1.000 sec, 16 kbps, 44100 Hz
  
  Error: Bitstream value not allowed by specification
  
--------------------


- DAC32 error  following error is logged 

Code:
--------------------
    
  [22-01-02 16:58:25.3427] Slim::Player::Squeezebox2::statHandler (156) Error: 7c:9e:bd:2b:52:94: Decoder does not support file format, code 0
  
--------------------


On examination an extra 4 bytes of zeroes had been inserted by LMS into
the created ADTS audio stream from MPEG-4 file.
It seems there is padding in the m4a file and so the value of "seek
offset" to start of audio and length of MPEG4 header are not the same. 


In Movie::findFrameBoundaries - Audio ::Scan is called on initial Audio
block of m4a stream.
Data::Dump::dump of variable $info (returned from Audio::Scan) 

Code:
--------------------
    
  [22-01-02 16:38:20.1771] Slim::Formats::Movie::findFrameBoundaries (198)  Dump of info from AudioScan do {
  require MIME::Base64;
  {
  audio_offset      => 22_092,
  audio_size        => 880_370,
  avg_bitrate       => 62_768,
  compatible_brands => ["M4A ", "mp42", "isom", "\0\0\0\0"],
  dlna_profile      => "AAC_ISO_192",
  file_size         => 22_116,
  major_brand       => "mp42",
  minor_version     => 0,
  mv_timescale      => 90_000,
  samplerate        => 22_050,
  seek_header       => MIME::Base64::decode("
  .
  .(deleted)
  .
  "),
  seek_offset       => 22_108,
  song_length_ms    => 224_351,
  tracks            => [
  {
  audio_object_type => 2,
  audio_type        => 64,
  bits_per_sample   => 16,
  channels          => 1,
  duration          => 224_351,
  encoding          => "mp4a",
  handler_name      => "Sound Media Handler",
  handler_type      => "soun",
  id                => 1,
  max_bitrate       => 37_608,
  samplerate        => 22_050,
  },
  { duration => 224_351, id => 1 },
  ],
  };
  
  
--------------------

Audio::Scan - the length of $info->{seek_header} is 22,100
Audio::Scan - audio_offset is at 22,092 but seek_offset to start of
audio is 22,108 

LMS seems to be streaming from end of MPEG4 header when it should be
streaming from seek_offset which is start of audio. 
Not sure if the error is in Audio::Scan or Movie.pm.

I'll try to come up with a solution but any suggestions welcome. I need
to check Audio::Scan documentation to see if the returned values are
correct and expected.


------------------------------------------------------------------------
bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=115678
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.