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

Philipp Schafft phschafft at de.loewenfelsen.net
Thu Nov 15 12:12:59 UTC 2018


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
-------------- 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/e2b02eae/attachment.sig>


More information about the ogg-dev mailing list