Comments (14)
Did you try the same code using a valid example webm file?
from matroska.
Nope, if you need this test to confim that your package works on my machine I'll immediatly do it, but my requirement is to get the opus audio stream from the webm opus recorded audio from Chrome, It's you're package supposed to works only when reading webm files (FileStream)?
from matroska.
Can you try this file?
Estas Tonne - Internal Flight Experience (Live in Cluj Napoca).webm
from matroska.
Just tried the file you provided and with another file i've manually converted with an online converter and it looks working fine, the problem appear only when using audio data streamed from js using the MediaRecorder API.
If can be usefull, this is the MatroskaDocument
of your webm file once deserialized:
{
"Ebml": {
"DocType": "webm",
"DocTypeExtension": null,
"DocTypeReadVersion": 2,
"DocTypeVersion": 4,
"EBMLMaxIDLength": 4,
"EBMLMaxSizeLength": 8,
"EBMLReadVersion": 1,
"EBMLVersion": 1,
"Void": null,
"CRC32": null
},
"Segment": {
"Attachments": null,
"Chapters": null,
"Clusters": [Too long
],
"Cues": {
"CuePoints": [Too long
],
"Void": null,
"CRC32": null
},
"Info": {
"ChapterTranslate": null,
"DateUTC": null,
"Duration": 419941.0,
"MuxingApp": "google/video-file",
"NextFilename": null,
"NextUID": null,
"PrevFilename": null,
"PrevUID": null,
"SegmentFamily": null,
"SegmentFilename": null,
"SegmentUID": null,
"TimestampScale": 1000000,
"Title": null,
"WritingApp": "google/video-file",
"Void": null,
"CRC32": null
},
"SeekHead": {
"Seek": {
"SeekID": "HFO7aw==",
"SeekPosition": 218,
"Void": null,
"CRC32": null
},
"Void": null,
"CRC32": null
},
"Tags": null,
"Tracks": {
"TrackEntries": [
{
"AttachmentLink": null,
"Audio": {
"BitDepth": 16,
"ChannelPositions": null,
"Channels": 2,
"OutputSamplingFrequency": null,
"SamplingFrequency": 48000.0,
"Void": null,
"CRC32": null
},
"BlockAdditionMapping": null,
"CodecDecodeAll": 0,
"CodecDelay": 6500000,
"CodecDownloadURL": null,
"CodecID": "A_OPUS",
"CodecInfoURL": null,
"CodecName": null,
"CodecPrivate": "T3B1c0hlYWQBAjgBgLsAAAAAAA==",
"CodecSettings": null,
"ContentEncodings": null,
"DefaultDecodedFieldDuration": null,
"DefaultDuration": null,
"FlagDefault": 0,
"FlagEnabled": 0,
"FlagForced": 0,
"FlagLacing": 0,
"Language": "eng",
"LanguageIETF": null,
"MaxBlockAdditionID": 0,
"MaxCache": null,
"MinCache": 0,
"Name": null,
"SeekPreRoll": 80000000,
"TrackNumber": 1,
"TrackOffset": null,
"TrackOperation": null,
"TrackOverlay": null,
"TrackTimestampScale": 0.0,
"TrackTranslate": null,
"TrackType": 2,
"TrackUID": 27231307933070081,
"TrickMasterTrackSegmentUID": null,
"TrickMasterTrackUID": null,
"TrickTrackFlag": null,
"TrickTrackSegmentUID": null,
"TrickTrackUID": null,
"Video": null,
"Void": null,
"CRC32": null
}
],
"Void": null,
"CRC32": null
},
"Void": null,
"CRC32": null
}
}
and this is the same obj but after a webm audio stream from Chrome:
{
"Ebml": {
"DocType": "webm",
"DocTypeExtension": null,
"DocTypeReadVersion": 2,
"DocTypeVersion": 4,
"EBMLMaxIDLength": 4,
"EBMLMaxSizeLength": 8,
"EBMLReadVersion": 1,
"EBMLVersion": 1,
"Void": null,
"CRC32": null
},
"Segment": {
"Attachments": null,
"Chapters": null,
"Clusters": null,
"Cues": null,
"Info": {
"ChapterTranslate": null,
"DateUTC": null,
"Duration": null,
"MuxingApp": "Chrome",
"NextFilename": null,
"NextUID": null,
"PrevFilename": null,
"PrevUID": null,
"SegmentFamily": null,
"SegmentFilename": null,
"SegmentUID": null,
"TimestampScale": 1000000,
"Title": null,
"WritingApp": "Chrome",
"Void": null,
"CRC32": null
},
"SeekHead": null,
"Tags": null,
"Tracks": {
"TrackEntries": [
{
"AttachmentLink": null,
"Audio": {
"BitDepth": 32,
"ChannelPositions": null,
"Channels": 1,
"OutputSamplingFrequency": null,
"SamplingFrequency": 48000.0,
"Void": null,
"CRC32": null
},
"BlockAdditionMapping": null,
"CodecDecodeAll": 0,
"CodecDelay": null,
"CodecDownloadURL": null,
"CodecID": "A_OPUS",
"CodecInfoURL": null,
"CodecName": null,
"CodecPrivate": "T3B1c0hlYWQBAQAAgLsAAAAAAA==",
"CodecSettings": null,
"ContentEncodings": null,
"DefaultDecodedFieldDuration": null,
"DefaultDuration": null,
"FlagDefault": 0,
"FlagEnabled": 0,
"FlagForced": 0,
"FlagLacing": 0,
"Language": null,
"LanguageIETF": null,
"MaxBlockAdditionID": 0,
"MaxCache": null,
"MinCache": 0,
"Name": null,
"SeekPreRoll": 0,
"TrackNumber": 1,
"TrackOffset": null,
"TrackOperation": null,
"TrackOverlay": null,
"TrackTimestampScale": 0.0,
"TrackTranslate": null,
"TrackType": 2,
"TrackUID": 8083526733988260,
"TrickMasterTrackSegmentUID": null,
"TrickMasterTrackUID": null,
"TrickTrackFlag": null,
"TrickTrackSegmentUID": null,
"TrickTrackUID": null,
"Video": null,
"Void": null,
"CRC32": null
}
],
"Void": null,
"CRC32": null
},
"Void": null,
"CRC32": null
}
}
from matroska.
Just looked at the console and I noticed the following error (looks different from the debugging context, I don't know why):
ERROR: Segment at position 146 not mapped. Exception: NEbml.Core.EbmlDataFormatException: invalid element size value
at NEbml.Core.EbmlReader.ReadNext()
at Matroska.MatroskaSerializer.Deserialize(Type type, EbmlReader reader)
fail: Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher[8]
Failed to invoke hub method 'SendAudio'.
System.ArgumentNullException: Value cannot be null. (Parameter 'Clusters')
at Matroska.Muxer.OggOpus.OggOpusAudioStreamDemuxer.CopyTo(MatroskaDocument doc, Stream outputStream, OggOpusAudioStreamDemuxerSettings settings)
at Matroska.Muxer.MatroskaDemuxer.ExtractOggOpusAudio(MatroskaDocument doc, Stream outputStream, OggOpusAudioStreamDemuxerSettings settings)
at PROJECT_NAME.API.Hubs.LiveDataHub.SendAudio(ReceiveAudioDTO audioPkt) in PATH_TO_PROJECT\PROJECT_NAME\PROJECT_NAME.API\Hubs\LiveDataHub.cs:line 72
at Microsoft.Extensions.Internal.ObjectMethodExecutor.<>c__DisplayClass33_0.b__0(Object target, Object[] parameters)
at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher1.ExecuteMethod(ObjectMethodExecutor methodExecutor, Hub hub, Object[] arguments) at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher
1.g__ExecuteInvocation|18_0(DefaultHubDispatcher1 dispatcher, ObjectMethodExecutor methodExecutor, THub hub, Object[] arguments, AsyncServiceScope scope, IHubActivator
1 hubActivator, HubConnectionContext connection, HubMethodInvocationMessage hubMethodInvocationMessage, Boolean isStreamCall)
from matroska.
Can you provide your file here as attachment?
from matroska.
I used this code to save the file after recording the audio:
this.mediaRecorder.ondataavailable = (e) => {
const a = document.createElement("a");
document.body.appendChild(a);
const url = window.URL.createObjectURL(e.data);
a.href = url;
a.download = "test.webm";
a.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
//...
}
Here the test file recorded and saved with the posted code:
test.webm
The problem persist when I try to extract the ogg from this webm, but the default media player of windows 10/11 can play the audio without problems.
from matroska.
It can be that this file follows a newer EBML / Matroska specification.
I'll take a look if I can update some code...
from matroska.
@FossaMalaEnt
I've made a fix.
Can you try version 0.0.11-preview-01.
?
from matroska.
@FossaMalaEnt did you have time to test that preview version?
from matroska.
@StefH, sorry for the delay. I downloaded the code from the "issue16" branch to give it a try, but I'm having trouble compiling it in both VS 2019 and 2022. It seems that VS is unable to locate the "Span<>" class. Have you published the DLL somewhere?
from matroska.
I did push version 0.0.11-preview-01
Make sure to enable preview in VS:
from matroska.
@FossaMalaEnt
Did you have time to validate that preview version?
from matroska.
@FossaMalaEnt
Did you have time to validate that preview version?
from matroska.
Related Issues (6)
- A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) HOT 5
- Unable to correctly deserialize a Matroska file with multiple attachments HOT 2
- Incorrect endianness of TimeCode property in (Simple)Block object HOT 4
- Any chance to be able to use this library for writing MKVs ? HOT 1
- Convert to ts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matroska.