In my webapp user can download OGG (vorbis), but I found that for example VLC show one file duration as 35 seconds but play it for ten minutes.
Currently I build a file for downloading with:
const blob = new Blob(listOfChunksBlobs, {'type': 'audio/ogg'});
With xdd
I checked the start of the OGG - but I do not see how I can alter anything here:
00000000: 4f67 6753 0002 0000 0000 0000 0000 0000 OggS............
00000010: 0000 0000 0000 5664 269e 011e 0176 6f72 ......Vd&....vor
00000020: 6269 7300 0000 0001 2256 0000 0000 0000 bis....."V......
00000030: 058a 0000 0000 0000 a901 4f67 6753 0000 ..........OggS..
00000040: 0000 0000 0000 0000 0000 0000 0100 0000 ................
00000050: 5096 ab47 0e16 ffff ffff ffff ffff ffff P..G............
00000060: ffff c503 766f 7262 6973 0600 0000 6666 ....vorbis....ff
00000070: 6d70 6567 0000 0000 0105 766f 7262 6973 mpeg......vorbis
00000080: 2242 4356 0100 4000 0018 4210 2a05 ad63 "[email protected].*..c
00000090: 8e3a c815 218c 19a2 a042 ca29 c71d 42d0 .:..!....B.)..B.
000000a0: 21a3 2443 883a c635 c718 6347 b964 8a42 !.$C.:.5..cG.d.B
000000b0: c981 d090 5500 0040 0000 a41c 5750 7249 [email protected]
000000c0: 2de7 9c73 a318 57cc 71e8 20e7 9c73 e520 -..s..W.q. ..s.
000000d0: 67cc 7109 25e7 9c73 8e39 e792 728e 31e7 g.q.%..s.9..r.1.
000000e0: 9c73 a318 570e 7229 2de7 9c73 8114 478a .s..W.r)-..s..G.
000000f0: 71a7 18e7 9c73 a41c 478a 71a8 18e7 9c73 q....s..G.q....s
00000100: 6d31 b792 72ce 39e7 9c73 e620 8752 72ae m1..r.9..s. .Rr.
00000110: 35e7 9c73 a418 670e 720b 25e7 9c73 c620 5..s..g.r.%..s.
00000120: 67cc 71eb 20e7 9c73 8c35 b7d4 72ce 39e7 g.q. ..s.5..r.9.
00000130: 9c73 ce39 e79c 73ce 39e7 9c73 8c31 e79c .s.9..s.9..s.1..
00000140: 73ce 39e7 9c73 6e31 e716 73ae 39e7 9c73 s.9..sn1..s.9..s
00000150: ce39 e71c 73ce 39e7 9c73 2034 6415 0090 .9..s.9..s 4d...
00000160: 0000 a0a1 288a e228 0e10 1ab2 0a00 c800 ....(..(........
00000170: 0010 4071 1447 9114 4bb1 1ccb d124 0d08 [email protected]....$..
00000180: 0d59 0500 0001 0008 0000 a048 86a4 488a .Y.........H..H.
00000190: a558 8e66 699e 267a a228 9aa2 2aab b269 .X.fi.&z.(..*..i
000001a0: cab2 2ccb b2eb ba2e 101a b20a 0048 0000 ..,..........H..
000001b0: 5051 14c5 7014 0708 0d59 0500 6400 0008 PQ..p....Y..d...
000001c0: 6028 8aa3 388e e458 92a5 599e 0784 86ac `(..8..X..Y.....
000001d0: 0200 8000 0004 0000 500c 47b1 144d f124 ........P.G..M.$
000001e0: cff2 3ccf f33c cff3 3ccf f33c cff3 3ccf ..<..<..<..<..<.
000001f0: f33c cff3 3c0d 080d 5905 0020 0000 0082 .<..<...Y.. ....
00000200: 2864 1803 4243 5601 0040 0000 0821 1a19 (d..BCV..@...!..
00000210: 439d 5212 5c0a 1642 1c11 431d 42ce 43a9 C.R.\..B..C.B.C.
00000220: a583 e029 8525 63d2 53ac 4108 217c ef3d ...).%c.S.A.!|.=
00000230: f7de 7bef 81d0 9055 0000 1000 0061 1438 ..{....U.....a.8
00000240: 8881 c724 0821 8462 1427 4471 a620 0821 ...$.!.b.'Dq. .!
00000250: 84e5 2458 ca79 e824 08dd 8310 42b8 9c7b ..$X.y.$....B..{
00000260: cbb9 f7de 7b20 3464 1500 0008 00c0 2084 ....{ 4d...... .
00000270: 1042 0821 8410 4208 29a4 9452 4829 a698 .B.!..B.)..RH)..
00000280: 628a 29c7 1c73 cc31 c720 830c 32e8 a093 b.)..s.1. ..2...
00000290: 4e3a c9a4 924e 3aca 24a3 8e52 6b29 b514 N:...N:.$..Rk)..
000002a0: 534c b1e5 1663 adb5 d69c 73af 4129 638c SL...c....s.A)c.
000002b0: 31c6 1863 8c31 c618 638c 31c6 1823 080d 1..c.1..c.1..#..
000002c0: 5905 0080 0000 1006 1964 9041 0821 8414 Y........d.A.!..
000002d0: 5248 29a6 9872 cc31 c71c 0342 4356 0100 RH)..r.1...BCV..
000002e0: 8000 0002 0000 001c 4552 2447 7224 4792 ........ER$Gr$G.
000002f0: 24c9 922c 4993 3ccb b33c cbb3 3c4d d444 $..,I.<..<..<M.D
00000300: 4d15 55d5 556d d7f6 6d5f f66d dfd5 65df M.U.Um..m_.m..e.
00000310: f665 dbd5 655d 9665 ddb5 6d5d d65d 5dd7 .e..e].e..m].]].
00000320: 755d d775 5dd7 755d d775 5dd7 755d d781 u].u].u].u].u]..
00000330: d090 5500 8004 0080 8ee4 388e e438 8ee4 ..U.......8..8..
00000340: 488e a448 0a10 1ab2 0a00 9001 0010 0080 H..H............
00000350: a338 8ae3 488e e458 8e25 5992 2669 9667 .8..H..X.%Y.&i.g
00000360: 7996 a779 9aa8 891e 101a b20a 0000 0400 y..y............
00000370: 1000 0000 0000 80a2 288a a338 8e24 5996 ........(..8.$Y.
00000380: a669 9ea7 7aa2 289a aaaa 8aa6 a9aa aa6a .i..z.(........j
00000390: 9aa6 699a a669 9aa6 699a a669 9aa6 699a ..i..i..i..i..i.
000003a0: a669 9aa6 699a a669 9aa6 699a a669 9aa6 .i..i..i..i..i..
000003b0: 6902 a121 ab00 0009 0000 1dc7 711c 4771 i..!........q.Gq
000003c0: 1cc7 7124 4792 2420 3464 1500 2003 0020 ..q$G.$ 4d.. ..
000003d0: 0000 4351 1c45 722c c792 344b b33c cbd3 ..CQ.Er,..4K.<..
000003e0: 44cf f45c 5136 7553 576d 2034 6415 0000 D..\Q6uSWm 4d...
000003f0: 0800 2000 0000 0000 00c7 733c c773 3cc9 .. .......s<.s<.
00000400: 933c cb73 3cc7 933c 49d3 344d d334 4dd3 .<.s<..<I.4M.4M.
00000410: 344d d334 4dd3 344d d334 4dd3 344d d334 4M.4M.4M.4M.4M.4
00000420: 4dd3 344d d334 4dd3 344d d334 4dd3 344d M.4M.4M.4M.4M.4M
00000430: d334 4d03 4243 5602 0064 0000 1093 904a .4M.BCV..d.....J
00000440: 4eb1 5746 29c6 24b4 5e2a a414 93d4 7ba8 N.WF).$.^*....{.
00000450: 9862 4c3a eda9 4206 2907 b987 4a21 a5a0 .bL:..B.)...J!..
00000460: d3de 32a5 9052 0c7b a798 42c8 18ea a183 ..2..R.{..B.....
00000470: 9031 85b0 d7da 73cf bdf7 1e08 0d59 1100 .1....s......Y..
00000480: 4401 0000 c620 c610 63c8 3126 2583 1231 D.... ..c.1&%..1
00000490: c724 6452 22e7 9c94 4e4a 26a5 a456 5acc .$dR"...NJ&..VZ.
000004a0: a484 984a 8b91 734e 4a27 2593 525a 0ba9 ...J..sNJ'%.RZ..
000004b0: 6592 4a6b 25a6 0200 0002 1c00 0002 2c84 e.Jk%.........,.
000004c0: 4243 5604 0051 0000 8831 4829 a414 524a BCV..Q...1H)..RJ
000004d0: 31a7 9843 4a29 c794 6348 29e5 9c72 4e39 1..CJ)..cH)..rN9
000004e0: c798 7410 2ae7 1874 0e4a a494 728e 39a7 ..t.*..t.J..r.9.
000004f0: 9c73 1232 0795 730e 4226 9d00 0080 0007 .s.2..s.B&......
00000500: 0080 000b a1d0 9015 0140 9c00 0080 9073 [email protected]
00000510: 8a31 0811 6310 4209 2985 5052 aa9c 93d2 .1..c.B.).PR....
00000520: 4149 a983 9252 49a9 c592 528c 9573 523a AI...RI...R..sR:
00000530: 0929 7512 522a 29c5 5852 8a2d a454 6369 .)u.R*).XR.-.Tci
00000540: 2dd7 d252 8d2d c69c 5b8c bd86 9462 2da9 -..R.-..[....b-.
00000550: d55a 5aab b9c5 5873 8b35 f7c8 394a 9d94 .ZZ...Xs.5..9J..
00000560: d63a 29ad a5d6 6a4d add5 da49 692d a4d6 .:)...jM...Ii-..
00000570: 6269 2dc6 d662 cd29 c69c 3329 ad85 9662 bi-..b.)..3)...b
00000580: 2ba9 c5d8 62cb 35b5 9873 692d d714 63cf +...b.5..si-..c.
00000590: 29c6 9e6b acb9 c79c 8330 add5 9c5a cb39 )..k.....0...Z.9
The root of the problem is because of the same
serial
of my every ogg, for example result fromogginfo
:For correct Ogg concatenation we must have unique
serial
per every file with correctcrc
. I did not found existing JS snippets for that (please feel free to comment/answer with your JS), only C code for a few hundreds of lines that you can use on the backend or compile to WASM (230K for generated JS and 59K for thewasm
file) - or I hope that somebody will rewrite it to JS - I have no knowledge of C.Original message from Ralph Giles in Ogg mailing list:
UPDATE: This is the gif with serials
11111111
and22222222
- I think that if we get Oggs from the same source in the same format (for example AWS Polly) - maybe it will be much simpler to alter hardcoded positions for serial and crc32.UPDATE: Yes set unique serial for every Ogg chunk (to all "pages" of that chunk) and set correct CRC32 (again for all pages of every Ogg), see the documentation of Ogg and Wikipedia page; also see this answer about how to build CRC32. And do not forget that all hexes must be 8 characters long, so
const hex = crc.toString(16).padStart(8, '0')