[ogg-dev] How to concatenate Ogg in the browser JS?

Philipp Schafft phschafft at de.loewenfelsen.net
Thu Nov 15 13:23:45 UTC 2018


Good afternoon,

On Thu, 2018-11-15 at 15:22 +0300, Vitaly Zdanevich wrote:
> Thank you, ogginfo returned:
> -----
> Note: Stream 1 has serial number 0, which is legal but may cause problems with some tools.
> New logical stream (#1, serial: 00000000): type vorbis
> Vorbis headers parsed for stream 1, information follows...
> Version: 0
> Vendor: ffmpeg
> Channels: 1
> Rate: 22050
> 
> Nominal bitrate: 35.333000 kb/s
> Upper bitrate not set
> Lower bitrate not set
> Vorbis stream 1:
> 	Total data length: 25835 bytes
> 	Playback length: 0m:06.338s
> 	Average bitrate: 32.606833 kb/s
> Logical stream 1 ended
> WARNING: illegally placed page(s) for logical stream 1
> This indicates a corrupt Ogg file: Page found for stream after EOS flag.
> WARNING: sequence number gap in stream 1. Got page 1 when expecting page 27. Indicates missing data.
> -----
> 
> `Playback length` is incorrect here - this is the length of the first concatenated file, this file consists of multiple Oggs.
> 
> So this is impossible to correctly concat Ogg with simple Javascript?

It is possible.

See the warnings ogginfo returns: There are pages AFTER the EOS flag but
not after a new BOS page.

So your file looks like this:

BOS DATA... EOS Data...

However it should like like this:

BOS Data... EOS BOS Data... EOS

You can try to save your second part only and try to play that back. If
it does not work the second part is invalid to begin with (this is what
ogginfo indicates).

     A. With best regards,


> 15.11.2018, 15:13, "Philipp Schafft" <phschafft at de.loewenfelsen.net>:
> > Good morning,
> >
> > On Thu, 2018-11-15 at 14:48 +0300, Vitaly Zdanevich wrote:
> >>  Good day, no answers in Google about that. I asked
> >>  https://stackoverflow.com/questions/53290693/how-to-alter-duration-of-ogg-with-js - in short I have Ogg Vorbis files on the client side (webapp) and I need to concatenate them in one file for downloading. I did concatenation with this line of code:
> >>
> >>  const blob = new Blob(listOfChunksBlobs, {'type': 'audio/ogg'});
> >>
> >>  And I play the final audio in VLC without problem,
> >
> > Yes. If the files are valid Ogg (this does not depend on the used
> > codecs) you can just concatenate them.
> >
> >>  BUT the length is incorrect, looks like I need to alter some header /
> >>  metadata for that? Can you please guide me, maybe I need to alter some
> >>  bytes as specific position?
> >
> > No.
> > Note that there is a different between the playback time of the file and
> > that of the tracks contained. Some software is not aware of that and
> > only display the track playback time OR the file playback time.
> >
> > If you want a file with a single track you must splice the data on the
> > codec level. This requires understanding of the codecs used as well as
> > completly rewriting the Container (Ogg).
> >
> > This will also require that there is no change in parameters (including
> > metadata).
> >
> > You can check your resulting file with e.g. ogginfo(1). It will tell you
> > the parameters for each track and also if the file has errors on the
> > container level.
> >
> > Generally I suspect that this is just a display problem in VLC.
> >
> > With best regards,
> >
> > --
> > Philipp Schafft (CEO/Geschäftsführer)
> > Telephon: +49.3535 490 17 92
> >
> > Löwenfelsen UG (haftungsbeschränkt) Registration number:
> > Bickinger Straße 21 HRB 12308 CB
> > 04916 Herzberg (Elster) VATIN/USt-ID:
> > Germany DE305133015

-- 
Philipp Schafft (CEO/Geschäftsführer) 
Telephon: +49.3535 490 17 92

Löwenfelsen UG (haftungsbeschränkt)     Registration number:
Bickinger Straße 21                     HRB 12308 CB
04916 Herzberg (Elster)                 VATIN/USt-ID:
Germany                                 DE305133015
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <http://lists.xiph.org/pipermail/ogg-dev/attachments/20181115/a457ad8f/attachment.sig>


More information about the ogg-dev mailing list