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

Ralph Giles giles at thaumas.net
Thu Nov 15 16:39:38 UTC 2018


On 2018-11-15 4:22 a.m., Vitaly Zdanevich wrote:

> Note: Stream 1 has serial number 0, which is legal but may cause problems with some tools.

Note if *both* files have the same serial number, it's impossible to 
find the points where they were concatentated by bisection, and most 
tools will assume they've found all the sections and calculate an 
incorrect duration. They can still be played individually because there 
is not concatenation boundary to find in the individual case.

If ogginfo shows the same serial (00000000) for both of your input 
streams, that's likely the problem. Muxers are supposed to use a random 
serial number to make conflicts unlikely. You can fix them by rewriting 
the serial number so there's no conflict. Basically, you change the 
serialno field in each ogg page header and then update the crc.

If you want an example, I have a quick script for doing this in 
https://git.xiph.org/?p=rogg.git;a=blob;f=rogg_serial.c

HTH,
  -r


More information about the ogg-dev mailing list