`Uncaught Error: Current Matroska cluster exceeded its maximum allowed length` when muxing both Audio and Video · Issue #56 · Vanilagy/webm-muxer · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I want to mux both Audio and Video, I run into Uncaught Error: Current Matroska cluster exceeded its maximum allowed length of 32768 milliseconds. In order to produce a correct WebM file, you must pass in a key frame at least every 32768 milliseconds. even if keyframes are placed correctly at or before the 32768ms mark.
Cause
The writing logic falsely assumes that the first chunk in a Cluster will always be a video frame. This can cause an audio chunk (which are always keyframes) to extend the size of the current Cluster:
[
0,
33000 // <-- need to be written in second cluster
]
With Video Frames at:
[
0,
33001 // <-- will create second cluster
]
At the time we encode the second video frame, currentCluster is still the first cluster we created. The Audio chunk is queued. Since we encode all Audio chunks before the Video chunk, we try to add the audio chunk to the wrong cluster.
Proposed fix
Allow creation of new Chunks from queued Audio chunks, even if we also mux video in the same file.
The text was updated successfully, but these errors were encountered:
Hey @marstamm, thank you for the issue. You're right that audio chunks must also be able to start a new cluster. An upcoming version of this library that I have in the works already has this behavior. But otherwise, @ZoranRavic is right with his point: This error message is not required. Matroska/WebM does just fine with clusters that begin with delta frames. It's just nice when clusters begin with key frames, and I'll keep making it so that they typically do, but when they become too long (>32 seconds), then it should just automatically spill over into a new cluster that can start with a video delta frame. I will implement the fix for #58.
Problem
When I want to mux both Audio and Video, I run into
Uncaught Error: Current Matroska cluster exceeded its maximum allowed length of 32768 milliseconds. In order to produce a correct WebM file, you must pass in a key frame at least every 32768 milliseconds.
even if keyframes are placed correctly at or before the 32768ms mark.Cause
The writing logic falsely assumes that the first chunk in a Cluster will always be a video frame. This can cause an audio chunk (which are always keyframes) to extend the size of the current Cluster:
webm-muxer/src/muxer.ts
Lines 453 to 457 in 40aa073
Example:
We have Audio chunks with the timestamps (ms):
With Video Frames at:
At the time we encode the second video frame,
currentCluster
is still the first cluster we created. The Audio chunk is queued. Since we encode all Audio chunks before the Video chunk, we try to add the audio chunk to the wrong cluster.Proposed fix
Allow creation of new Chunks from queued Audio chunks, even if we also mux video in the same file.
The text was updated successfully, but these errors were encountered: