Re: Error in streamed MPEG4 handling - Movie.pm or Audio::Scan error ?
philippe_44 <philippe_44.adycvb-NUepA2SMhDQqspMVqqL2D+4xXEVPTSb/[email protected]>
| Newsgroups | gmane.music.equipment.slimdevices.devel |
|---|---|
| Organization | Logitech Squeezebox Forums |
| Message-ID | <[email protected]> |
bpa wrote:
> 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
------------------------------------------------------------------------
philippe_44's Profile: http://forums.slimdevices.com/member.php?userid=17261
View this thread: http://forums.slimdevices.com/showthread.php?t=115678