Re: [FFmpeg-devel] [PATCH] aadec: alternate mp3 seek handling

2018-08-20 Thread Karsten Otto
Ping. Any thoughts on this? Cheers, Karsten > Am 31.07.2018 um 21:16 schrieb Karsten Otto : > > After seeking, determine the offset of the next frame in the decrypted > buffer by scanning the first few bytes for a valid mp3 header. > This significantly improves the listening

Re: [FFmpeg-devel] [PATCH] aadec: alternate mp3 seek handling

2018-08-08 Thread Karsten Otto
Ping. Any thoughts on this? Cheers, Karsten > Am 31.07.2018 um 21:16 schrieb Karsten Otto : > > After seeking, determine the offset of the next frame in the decrypted > buffer by scanning the first few bytes for a valid mp3 header. > This significantly improves the listening

[FFmpeg-devel] [PATCH] aadec: alternate mp3 seek handling

2018-07-31 Thread Karsten Otto
After seeking, determine the offset of the next frame in the decrypted buffer by scanning the first few bytes for a valid mp3 header. This significantly improves the listening experience for audio content with untypical encoding. --- This is a refinement of an earlier patch iteration, according to

[FFmpeg-devel] [PATCH v7 3/3] aadec: improve seeking in mp3 content

2018-07-14 Thread Karsten Otto
MP3 frames may not be aligned to aa chunk boundaries. When seeking, calculate the expected frame offset in the target chunk. Adjust the timestamp and truncate the next packet accordingly. This solution works for the majority of tested audio material. For some rare encodings with mp3 padding or emb

Re: [FFmpeg-devel] [PATCH v6 3/3] aadec: improve seeking in mp3 content

2018-07-14 Thread Karsten Otto
> Am 14.07.2018 um 02:20 schrieb Michael Niedermayer : > > Signierter PGP-Teil > On Fri, Jul 13, 2018 at 12:35:07PM +0200, Karsten Otto wrote: >> MP3 frames may not be aligned to aa chunk boundaries. When seeking, >> calculate the expected frame offset in the

[FFmpeg-devel] [PATCH v6 3/3] aadec: improve seeking in mp3 content

2018-07-13 Thread Karsten Otto
MP3 frames may not be aligned to aa chunk boundaries. When seeking, calculate the expected frame offset in the target chunk. Adjust the timestamp and truncate the next packet accordingly. This solution works for the majority of tested audio material. For some rare encodings with mp3 padding or emb

[FFmpeg-devel] [PATCH] libavcodec/mpegaudiodecheader.h: fix version check pattern

2018-07-12 Thread Karsten Otto
This fixes the check for the reserved MPEG audio version ID, used to detect an invalid frame header. --- libavcodec/mpegaudiodecheader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpegaudiodecheader.h b/libavcodec/mpegaudiodecheader.h index ed9961250a..1da2a4cb6

Re: [FFmpeg-devel] [PATCH] libavcodec/mpegaudiodecheader.h : detect reserved mpeg id

2018-07-11 Thread Karsten Otto
atch to the patch that is already applied? Sorry for the inconvenience, Karsten > Am 09.07.2018 um 02:46 schrieb Michael Niedermayer : > > Signierter PGP-Teil > On Sun, Jul 08, 2018 at 12:26:10PM +0200, Karsten Otto wrote: >> Check the MPEG version ID for the reserved bit patter

[FFmpeg-devel] [PATCH v5 3/3] aadec: improve seeking in mp3 content

2018-07-11 Thread Karsten Otto
MP3 frames may not be aligned to aa chunk boundaries. When seeking, calculate the expected frame offset in the target chunk. Adjust the timestamp and truncate the next packet accordingly. This solution works for the majority of tested audio material. For some rare encodings with mp3 padding or emb

Re: [FFmpeg-devel] [PATCH v4 3/3] aadec: improve seeking in mp3 content

2018-07-11 Thread Karsten Otto
> Am 11.07.2018 um 20:09 schrieb Michael Niedermayer : > > Signierter PGP-Teil > On Sat, Jul 07, 2018 at 07:41:29PM +0200, Karsten Otto wrote: >> MP3 frames may not be aligned to aa chunk boundaries. When seeking, >> calculate the expected frame offset in the

Re: [FFmpeg-devel] [PATCH v4 3/3] aadec: improve seeking in mp3 content

2018-07-10 Thread Karsten Otto
Ping - What about this one? I tested it with about 20 files and it works perfectly for all of them - except one which has tag/padding. In its case, playback quality is virtually the same as without the patch, i.e. no harm done. Cheers, Karsten > Am 07.07.2018 um 19:41 schrieb Karsten O

[FFmpeg-devel] [PATCH] libavcodec/mpegaudiodecheader.h : detect reserved mpeg id

2018-07-08 Thread Karsten Otto
Check the MPEG version ID for the reserved bit pattern 01, and abort the header check in that case. This reduces the chance of misinterpreting arbitrary data as a valid header, and prevents resulting audio artifacts. --- libavcodec/mpegaudiodecheader.h | 3 +++ 1 file changed, 3 insertions(+) dif

Re: [FFmpeg-devel] [PATCH] libavcodec/mpegaudiodecheader.c : prevent reserved id misinterpretation

2018-07-08 Thread Karsten Otto
> Am 08.07.2018 um 10:58 schrieb Michael Niedermayer : > > Signierter PGP-Teil > On Sat, Jul 07, 2018 at 10:29:11PM +0200, Karsten Otto wrote: >> Check the MPEG version ID for the reserved bit pattern 01, and abort header >> parsing in that case. This reduces the c

[FFmpeg-devel] [PATCH v5 2/3] aadec: add chapters and seeking

2018-07-08 Thread Karsten Otto
read_packet reads content in chunks. Thus seek must be clamped to valid chunk positions in the file, which in turn are relative to chapter start positions. So in read_header, scan for chapter headers once by skipping through the content. Set stream time_base based on bitrate in bytes/s, for easy t

Re: [FFmpeg-devel] [PATCH v4 2/3] aadec: add chapters and seeking

2018-07-08 Thread Karsten Otto
> Am 08.07.2018 um 11:12 schrieb Michael Niedermayer : > > Signierter PGP-Teil > On Sat, Jul 07, 2018 at 07:41:28PM +0200, Karsten Otto wrote: >> read_packet reads content in chunks. Thus seek must be clamped to valid >> chunk positions in the file, which in turn are r

[FFmpeg-devel] [PATCH] libavcodec/mpegaudiodecheader.c : prevent reserved id misinterpretation

2018-07-07 Thread Karsten Otto
Check the MPEG version ID for the reserved bit pattern 01, and abort header parsing in that case. This reduces the chance of misinterpreting arbitrary data as a valid frame start, and prevents the resulting audio artifacts. --- libavcodec/mpegaudiodecheader.c | 5 +++-- 1 file changed, 3 insertion

[FFmpeg-devel] [PATCH v4 2/3] aadec: add chapters and seeking

2018-07-07 Thread Karsten Otto
read_packet reads content in chunks. Thus seek must be clamped to valid chunk positions in the file, which in turn are relative to chapter start positions. So in read_header, scan for chapter headers once by skipping through the content. Set stream time_base based on bitrate in bytes/s, for easy t

[FFmpeg-devel] [PATCH v4 1/3] aadec: improve eof detection

2018-07-07 Thread Karsten Otto
Remember the end position of audio content in the file and check it during read_packet. There always seems to be other data beyond it, which could be misinterpreted as more audio. Also add some extra avio_read error checks, to bail early in case of a broken/truncated file. --- libavformat/aadec.c

[FFmpeg-devel] [PATCH v4 3/3] aadec: improve seeking in mp3 content

2018-07-07 Thread Karsten Otto
MP3 frames may not be aligned to aa chunk boundaries. When seeking, calculate the expected frame offset in the target chunk. Adjust the timestamp and truncate the next packet accordingly. This solution works for the majority of tested audio material. For some rare encodings with mp3 padding or emb

[FFmpeg-devel] [PATCH v4 0/3] libavformat/aadec: seek support

2018-07-07 Thread Karsten Otto
ks for the majority of tested audio material, while the effect on rare divergent material is negligible. Karsten Otto (3): aadec: improve eof detection aadec: add chapters and seeking aadec: improve seeking in mp3 content libavformat/aadec.c | 113 --

Re: [FFmpeg-devel] [PATCH v3 3/3] aadec: fix seeking in mp3 content

2018-07-07 Thread Karsten Otto
> Am 06.07.2018 um 23:32 schrieb Michael Niedermayer : > > Signierter PGP-Teil > On Fri, Jul 06, 2018 at 10:49:46AM +0200, Karsten Otto wrote: >> >>> Am 04.07.2018 um 23:54 schrieb Michael Niedermayer : >>> >>> Signierter PGP-Teil >>>

Re: [FFmpeg-devel] [PATCH v3 3/3] aadec: fix seeking in mp3 content

2018-07-06 Thread Karsten Otto
> Am 04.07.2018 um 23:54 schrieb Michael Niedermayer : > > Signierter PGP-Teil > On Wed, Jul 04, 2018 at 09:32:32AM +0200, Karsten Otto wrote: >> >>> Am 04.07.2018 um 03:26 schrieb Michael Niedermayer : >>> >>> Signierter PGP-Teil >>>

Re: [FFmpeg-devel] [PATCH v3 3/3] aadec: fix seeking in mp3 content

2018-07-04 Thread Karsten Otto
> Am 04.07.2018 um 03:26 schrieb Michael Niedermayer : > > Signierter PGP-Teil > On Tue, Jul 03, 2018 at 10:25:36PM +0200, Karsten Otto wrote: >> TL;DR: I will drop patch 3/3, may rather spend some time investigating why >> "ff ee 47 9d“ passes the mp3 header par

Re: [FFmpeg-devel] [PATCH v3 3/3] aadec: fix seeking in mp3 content

2018-07-03 Thread Karsten Otto
> Am 03.07.2018 um 22:29 schrieb Carl Eugen Hoyos : > > 2018-07-03 22:25 GMT+02:00, Karsten Otto : > >> It took a closer look at what happens when I hear a BLEEP: The packet begins >> with a partial frame, starting with the byte sequence "ff ee 47 9d“. >> Unfo

Re: [FFmpeg-devel] [PATCH v3 3/3] aadec: fix seeking in mp3 content

2018-07-03 Thread Karsten Otto
ichael Niedermayer : > > Signierter PGP-Teil > On Mon, Jul 02, 2018 at 07:21:43PM +0200, Karsten Otto wrote: >> >>> Am 02.07.2018 um 10:59 schrieb Michael Niedermayer : >>> >>> Signierter PGP-Teil >>> On Thu, Jun 21, 2018 at 06:58:26PM +0200, Karsten

Re: [FFmpeg-devel] [PATCH v3 3/3] aadec: fix seeking in mp3 content

2018-07-02 Thread Karsten Otto
> Am 02.07.2018 um 10:59 schrieb Michael Niedermayer : > > Signierter PGP-Teil > On Thu, Jun 21, 2018 at 06:58:26PM +0200, Karsten Otto wrote: >> MP3 frames may not be aligned to aa chunk boundaries. After seeking, >> scan for the next valid frame header. Then truncate

Re: [FFmpeg-devel] [PATCH v3 2/3] aadec: add chapters and seeking

2018-07-02 Thread Karsten Otto
> Am 02.07.2018 um 10:22 schrieb Michael Niedermayer : > > Signierter PGP-Teil > On Thu, Jun 21, 2018 at 06:58:25PM +0200, Karsten Otto wrote: >> read_packet reads content in chunks. Thus seek must be clamped to valid >> chunk positions in the file, which in turn are r

Re: [FFmpeg-devel] [PATCH v3 1/3] aadec: improve eof detection

2018-07-01 Thread Karsten Otto
> Am 02.07.2018 um 02:33 schrieb Michael Niedermayer : > >> […] > > What is this additional data ? > Short answer: Since there is no official format specification, nobody really knows. Longer answer: From what I have read, the aa format is a generic frame, containing several "tagged“ sectio

Re: [FFmpeg-devel] [PATCH v3 0/3] libavformat/aadec: seek support

2018-07-01 Thread Karsten Otto
Bump… I’d like a review please :-) Cheers, Karsten > Am 21.06.2018 um 18:58 schrieb Karsten Otto : > > A patch series adding seek support to libavformat/aadec. > > This third version of the series addresses all the earlier comments from the > mailing list (thanks again!).

[FFmpeg-devel] [PATCH v3 2/3] aadec: add chapters and seeking

2018-06-21 Thread Karsten Otto
read_packet reads content in chunks. Thus seek must be clamped to valid chunk positions in the file, which in turn are relative to chapter start positions. So in read_header, scan for chapter headers once by skipping through the content. Set stream time_base to bitrate in bytes/s, for easy timesta

[FFmpeg-devel] [PATCH v3 1/3] aadec: improve eof detection

2018-06-21 Thread Karsten Otto
Remember the end position of audio content in the file and check it during read_packet. There always seems to be other data beyond it, which could be misinterpreted as more audio. Also add some extra avio_read error checks, to bail early in case of a broken/truncated file. --- libavformat/aadec.c

[FFmpeg-devel] [PATCH v3 0/3] libavformat/aadec: seek support

2018-06-21 Thread Karsten Otto
container: After a seek operation, it skips to the next valid frame header, which prevents audible glitches from partial frame playback. Karsten Otto (3): aadec: improve eof detection aadec: add chapters and seeking aadec: fix seeking in mp3 content libavformat/aadec.c | 129

[FFmpeg-devel] [PATCH v3 3/3] aadec: fix seeking in mp3 content

2018-06-21 Thread Karsten Otto
MP3 frames may not be aligned to aa chunk boundaries. After seeking, scan for the next valid frame header. Then truncate the packet, and also adjust timestamp information accordingly. --- libavformat/aadec.c | 33 - 1 file changed, 28 insertions(+), 5 deletions(-)

Re: [FFmpeg-devel] mpegaudio_parser question

2018-06-18 Thread Karsten Otto
to do? Cheers, Karsten > Am 18.06.2018 um 00:58 schrieb Ronald S. Bultje : > > Hi Karsten, > > I believe that the parsers are seek-unaware, so you're expected to delete > and recreate (or reinit) the parsers after each seek. > > Ronald > > On Sun, Jun 17, 20

[FFmpeg-devel] mpegaudio_parser question

2018-06-17 Thread Karsten Otto
Hi list, I have a question about mpegaudio_parser. I see that it keeps any packet data before a frame header, instead of discarding it. This makes sense, because it usually can combine this data with the leftovers from a previous packet to complete a frame. But the parser also does this when ju

[FFmpeg-devel] [PATCH v2 1/2] aadec: improve eof detection

2018-01-28 Thread Karsten Otto
Remember the end position of audio content in the file and check it during read_packet. There always seems to be other data beyond it, which could be misinterpreted as more audio. Also add some extra avio_read error checks, to bail early in case of a broken/truncated file. --- Update addresses comm

[FFmpeg-devel] [PATCH v2 2/2] aadec: add chapters and seeking

2018-01-28 Thread Karsten Otto
read_packet reads content in chunks. Thus seek must be clamped to valid chunk positions in the file, which in turn are relative to chapter start positions. So in read_header, scan for chapter headers once by skipping through the content. Set stream time_base to bitrate in bytes/s, for easy timesta

[FFmpeg-devel] [PATCH 2/2] aadec: add chapters and seeking

2018-01-27 Thread Karsten Otto
read_packet reads content in chunks. Thus seek must be clamped to valid chunk positions in the file, which in turn are relative to chapter start positions. So in read_header, scan for chapter headers once by skipping through the content. Set stream time_base to bitrate in bytes/s, for easy timesta

[FFmpeg-devel] [PATCH 0/2] hello + aadec improvements

2018-01-27 Thread Karsten Otto
what you think, improvements very welcome! Disclaimer: No reverse engineering was involved in creating this patch. Everything was derived from preexisting code, mostly aa_read_packet. Cheers, Karsten Karsten Otto (2): aadec: improve eof detection aadec: add chapters and seeking

[FFmpeg-devel] [PATCH 1/2] aadec: improve eof detection

2018-01-27 Thread Karsten Otto
Remember the end position of audio content in the file and check it during read_packet. There always seems to be other data beyond it, which could be misinterpreted as more audio. Also add some extra avio_read error checks, to bail early in case of a broken/truncated file. --- libavformat/aadec.c