Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22
  1. #11
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,880
    Quote Originally Posted by bpa View Post
    Clause 4.2 Size = 0 is a special case - it means all data up to eof

    Code:
    aligned(8) class Box (unsigned int(32) boxtype,
      optional unsigned int(8)[16] extended_type) {
      unsigned int(32) size;
      unsigned int(32) type = boxtype;
      if (size==1) {
          unsigned int(64) largesize;
      } else if (size==0) {
    // box extends to end of file
       }
      if (boxtype==‘uuid’) { 
          unsigned int(8)[16] usertype = extended_type;
      }
    }
    But it's supposed to be 'size' first then 'boxtype', so I don't see what these 8 following zero are...
    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

  2. #12
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    21,536
    Quote Originally Posted by philippe_44 View Post
    But it's supposed to be 'size' first then 'boxtype', so I don't see what these 8 following zero are...
    Yes - I posted too quickly.

    From your previous post
    Code:
    00 0D 6E F2 6D 64 61 74 00 00 00 00 00 00 00 00 00 D0 35 03
                 m  d  a  t
    Audio size is 880,370 which is 0DF26D - so size is OK, 'mdat' is OK.

    Maybe sample table offset (or similar) has something interesting.

    I'll look at it again tomorrow with fresh eyes.

  3. #13
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    21,536
    Quick status on the problem.
    I was trying find out where Audio::Scan gets its value for audio_offset (i.e how does Audio::Scan know to skip the extra zeroes in the mdat)
    Looking at the MPEG4-Spec for mdat - the 2nd para in 8.1.1.1 for mdat

    Code:
    There may be any number of these boxes in the file (including zero, if all the media data is in other files).
    The metadata refers to media data by its absolute offset within the file (see subclause 8.7.5, the Chunk
    Offset Box); so Media Data Box headers and free space may easily be skipped, and files without any box
    structure may also be referenced and used.
    The following comes from the description for "stco" in clause 8.7.5
    Code:
    The chunk offset table gives the index of each chunk into the containing file. There are two variants,
    permitting the use of 32‐bit or 64‐bit offsets. The latter is useful when managing very large
    presentations. At most one of these variants will occur in any single instance of a sample table.
    Offsets are file offsets, not the offset into any box within the file (e.g. Media Data Box). This permits
    referring to media data in files without any box structure. It does also mean that care must be taken
    when constructing a self‐contained ISO file with its metadata (Movie Box) at the front, as the size of the
    Movie Box will affect the chunk offsets to the media data.
    As I read it, the audio_offset from Audio::Scan is the value of the first entry in the chunk offset table.

    I'm currently trying to do a quick fix in Movie.pm to test this out.

  4. #14
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    21,536
    I have a patched Movie.pm which seems to play The problem URLs and a random m4a podcast which has a "normal" mdat. Need more example to test.

    I used Audio::Scan seek_offset to update the "audio_offset" rather than first data in mdat.

    Code:
    /slimserver-public-8.3/Slim/Formats$ diff org-Movie.pm Movie.pm 
    270a271,274
    > 
    >       $fh->seek(0, 0);
    >       my $seek_offset = Audio::Scan->find_frame_fh_return_info( mp4 => $fh, 0 )->{'seek_offset'};
    > 
    277c281
    <       $info->{audio_offset} = $args->{_mdat_} + 8;
    ---
    >       $info->{audio_offset} = $seek_offset;
    In parseStream routine
    Code:
            # finally got it, add 'moov' size it if was last atom                                   # finally got it, add 'moov' size it if was last atom
            substr($args->{_scanbuf}, $args->{_offset} + ($args->{_atom} eq 'moov' ? $arg           substr($args->{_scanbuf}, $args->{_offset} + ($args->{_atom} eq 'moov' ? $arg
    
            # put at least 16 bytes after mdat or it confuses audio::scan (and header cre           # put at least 16 bytes after mdat or it confuses audio::scan (and header cre
            my $fh = File::Temp->new( DIR => Slim::Utils::Misc::getTempDir);                        my $fh = File::Temp->new( DIR => Slim::Utils::Misc::getTempDir);
            $fh->write($args->{_scanbuf} . pack('N', $args->{_audio_size}) . 'mdat' . ' '           $fh->write($args->{_scanbuf} . pack('N', $args->{_audio_size}) . 'mdat' . ' '
                                                                                          >
                                                                                          >         $fh->seek(0, 0);
                                                                                          >         my $seek_offset = Audio::Scan->find_frame_fh_return_info( mp4 => $fh, 0 )->{'seek_offset'}
                                                                                          >
            $fh->seek(0, 0);                                                                        $fh->seek(0, 0);
    
            my $info = Audio::Scan->scan_fh( mp4 => $fh )->{info};                                  my $info = Audio::Scan->scan_fh( mp4 => $fh )->{info};
            $info->{fh} = $fh;                                                                      $info->{fh} = $fh;
    
            # the offset is *after* the mdat atom, make size consistent                             # the offset is *after* the mdat atom, make size consistent
            $info->{audio_offset} = $args->{_mdat_} + 8;                                  |         $info->{audio_offset} = $seek_offset;
            $info->{audio_size} -= 8;                                                               $info->{audio_size} -= 8;
    
            # MPEG-4 audio = 64,  MPEG-4 ADTS main = 102, MPEG-4 ADTS Low Complexity = 10           # MPEG-4 audio = 64,  MPEG-4 ADTS main = 102, MPEG-4 ADTS Low Complexity = 10
            # MPEG-4 ADTS Scalable Sampling Rate = 104                                              # MPEG-4 ADTS Scalable Sampling Rate = 104
            if ($info->{tracks}->[0] && $info->{tracks}->[0]->{audio_type} == 64) {                 if ($info->{tracks}->[0] && $info->{tracks}->[0]->{audio_type} == 64) {
                    $info->{processors} = { 'aac' => \&setADTSProcess };                                    $info->{processors} = { 'aac' => \&setADTSProcess };
            }                                                                                       }
    
            return $info;                                                                           return $info;
    Last edited by bpa; 2022-01-03 at 15:14.

  5. #15
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,880
    Quote Originally Posted by bpa View Post
    I have a patched Movie.pm which seems to play The problem URLs and a random m4a podcast which has a "normal" mdat. Need more example to test.

    I used Audio::Scan seek_offset to update the "audio_offset" rather than first data in mdat.

    Code:
    /slimserver-public-8.3/Slim/Formats$ diff org-Movie.pm Movie.pm 
    270a271,274
    > 
    >       $fh->seek(0, 0);
    >       my $seek_offset = Audio::Scan->find_frame_fh_return_info( mp4 => $fh, 0 )->{'seek_offset'};
    > 
    277c281
    <       $info->{audio_offset} = $args->{_mdat_} + 8;
    ---
    >       $info->{audio_offset} = $seek_offset;
    In parseStream routine
    Code:
            # finally got it, add 'moov' size it if was last atom                                   # finally got it, add 'moov' size it if was last atom
            substr($args->{_scanbuf}, $args->{_offset} + ($args->{_atom} eq 'moov' ? $arg           substr($args->{_scanbuf}, $args->{_offset} + ($args->{_atom} eq 'moov' ? $arg
    
            # put at least 16 bytes after mdat or it confuses audio::scan (and header cre           # put at least 16 bytes after mdat or it confuses audio::scan (and header cre
            my $fh = File::Temp->new( DIR => Slim::Utils::Misc::getTempDir);                        my $fh = File::Temp->new( DIR => Slim::Utils::Misc::getTempDir);
            $fh->write($args->{_scanbuf} . pack('N', $args->{_audio_size}) . 'mdat' . ' '           $fh->write($args->{_scanbuf} . pack('N', $args->{_audio_size}) . 'mdat' . ' '
                                                                                          >
                                                                                          >         $fh->seek(0, 0);
                                                                                          >         my $seek_offset = Audio::Scan->find_frame_fh_return_info( mp4 => $fh, 0 )->{'seek_offset'}
                                                                                          >
            $fh->seek(0, 0);                                                                        $fh->seek(0, 0);
    
            my $info = Audio::Scan->scan_fh( mp4 => $fh )->{info};                                  my $info = Audio::Scan->scan_fh( mp4 => $fh )->{info};
            $info->{fh} = $fh;                                                                      $info->{fh} = $fh;
    
            # the offset is *after* the mdat atom, make size consistent                             # the offset is *after* the mdat atom, make size consistent
            $info->{audio_offset} = $args->{_mdat_} + 8;                                  |         $info->{audio_offset} = $seek_offset;
            $info->{audio_size} -= 8;                                                               $info->{audio_size} -= 8;
    
            # MPEG-4 audio = 64,  MPEG-4 ADTS main = 102, MPEG-4 ADTS Low Complexity = 10           # MPEG-4 audio = 64,  MPEG-4 ADTS main = 102, MPEG-4 ADTS Low Complexity = 10
            # MPEG-4 ADTS Scalable Sampling Rate = 104                                              # MPEG-4 ADTS Scalable Sampling Rate = 104
            if ($info->{tracks}->[0] && $info->{tracks}->[0]->{audio_type} == 64) {                 if ($info->{tracks}->[0] && $info->{tracks}->[0]->{audio_type} == 64) {
                    $info->{processors} = { 'aac' => \&setADTSProcess };                                    $info->{processors} = { 'aac' => \&setADTSProcess };
            }                                                                                       }
    
            return $info;                                                                           return $info;
    Thanks - I will also try to understand why my simple mdat offset calculation does not work
    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. #16
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    21,536
    Quote Originally Posted by philippe_44 View Post
    Thanks - I will also try to understand why my simple mdat offset calculation does not work
    I think it assumed that audio data starts at first byte of mdat which if I read the stco explanation does not have to be the case.

    Given that it seems to work when the Audio::Scan offset calculation is used, my explanation not be correct but the "fix" doesn't seem to break MP4 streaming. I have tested with a few MP4 audio podcast.

    I don't use Tidal so will set up a trial account to test Tidal MP4 streaming to see if it still works.

  7. #17
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,880
    Quote Originally Posted by bpa View Post
    I think it assumed that audio data starts at first byte of mdat which if I read the stco explanation does not have to be the case.

    Given that it seems to work when the Audio::Scan offset calculation is used, my explanation not be correct but the "fix" doesn't seem to break MP4 streaming. I have tested with a few MP4 audio podcast.

    I don't use Tidal so will set up a trial account to test Tidal MP4 streaming to see if it still works.
    I will re-read the mpeg4 doc so see if I can easily put that inside the parseStream()
    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

  8. #18
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,880
    I've pushed that PR https://github.com/Logitech/slimserver/pull/749, let me know if this works for you
    Last edited by philippe_44; 2022-01-13 at 19:49.
    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

  9. #19
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,719

    Error in streamed MPEG4 handling - Movie.pm or

    > I've pushed that PR https://github.com/Logitech/slimserver/pull/749

    Thanks a lot philippe_44! I'll wait for bpa's thumbs up before merging. Ok?

  10. #20
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,880
    Quote Originally Posted by mherger View Post
    > I've pushed that PR https://github.com/Logitech/slimserver/pull/749

    Thanks a lot philippe_44! I'll wait for bpa's thumbs up before merging. Ok?
    Absolutely!


    Envoyé de mon iPad en utilisant Tapatalk
    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

Posting Permissions

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