Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 10 of 22

Hybrid View

  1. #1
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    21,631

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

    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.ne...atormundii.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:ump::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.

  2. #2
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,881

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

    Quote Originally Posted by bpa View Post
    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.ne...atormundii.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:ump::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.
    The error is probably in movie.pm where I calculate the offset. From memory, I donít rely on Audio::Scan when header is at the end of the file and I need to do an HTTP range to reach it. I assume I made a mistake and some files have an extended mdat header (or a similar issue) and I canít just add 8 to the mdat position.
    LMS 8.2 on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

  3. #3
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    21,631
    Quote Originally Posted by philippe_44 View Post
    The error is probably in movie.pm where I calculate the offset. From memory, I donít rely on Audio::Scan when header is at the end of the file and I need to do an HTTP range to reach it. I assume I made a mistake and some files have an extended mdat header (or a similar issue) and I canít just add 8 to the mdat position.
    The URL is streamable and so the header is at the start but there is padding at end (maybe a "free" atom) which is throwing things off.

    After looking at AudioScan soc, it says "seek_header - A rewritten MP4 header that can be prepended to the audio data" - I interpret "rewritten" to means "not the same as source" (e.g. "free" atom removed) and so I think the problem lies in Movie.pm.

    I now need to remember all the MPEG4 and InitialAudioBlock stuff to create a fix.

  4. #4
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,881
    Quote Originally Posted by bpa View Post
    The URL is streamable and so the header is at the start but there is padding at end (maybe a "free" atom) which is throwing things off.

    After looking at AudioScan soc, it says "seek_header - A rewritten MP4 header that can be prepended to the audio data" - I interpret "rewritten" to means "not the same as source" (e.g. "free" atom removed) and so I think the problem lies in Movie.pm.

    I now need to remember all the MPEG4 and InitialAudioBlock stuff to create a fix.
    If you are not too much in a hurry, I can have a look today or tomorrow
    LMS 8.2 on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

  5. #5
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,881
    Quote Originally Posted by philippe_44 View Post
    If you are not too much in a hurry, I can have a look today or tomorrow
    I think the "mdat" box has an extended size over 8 bytes and not 4, that's what I'm missing; I'll re-read mp4 standard to be sure
    LMS 8.2 on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

  6. #6
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    21,631
    Quote Originally Posted by philippe_44 View Post
    I think the "mdat" box has an extended size over 8 bytes and not 4, that's what I'm missing; I'll re-read mp4 standard to be sure
    It's a background project so no urgency at all. I'll have a look at the standard again as I'm sure I've forgotten lots.

Posting Permissions

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