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

Vitaly Zdanevich zdanevich.vitaly at ya.ru
Thu Nov 15 12:22:56 UTC 2018


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?


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


More information about the ogg-dev mailing list