Transmux MPEG-2 TS packets via websocket from multicast UDP
Hi,
We have a device streaming the MPEG TS to multicast UDP, and then we write relay server basically taking the bytes from UDP and forward to browser through web socket. On the browser, simply push the bytes to muxjs.mp4.Transmuxer, and append the result from Transmuxer to media source, but I got the following error on creating init segment. Any idea what I am missing?
Error 4; details: CHUNK_DEMUXER_ERROR_APPEND_FAILED: Unrecognized video codec profile
Here is codec information from playing back in VLC

And does mux.js support raw MPEG TS packets or need to wrap them in RTP ?
Thank you!
Eric
var mime = 'video/mp4; codecs="avc1.640028,mp4a.40.5"';
webSocket.onmessage = function (messageEvent) {
mux.push(new Uint8Array(messageEvent.data));
mux.flush();
}
mux.on('data', function (event) {
if (createInitSegment) {
var bytes = new Uint8Array(event.initSegment.byteLength + event.data.byteLength)
bytes.set(event.initSegment, 0);
bytes.set(event.data, event.initSegment.byteLength);
createInitSegment = false;
vjsParsed = muxjs.mp4.tools.inspect(bytes);
console.log('transmuxed', vjsParsed);
sourceBuffer.appendBuffer(bytes);
}
}


@kcchenkd were you ever able to get this working?
same issue
This issue will be hard to diagnose without samples of code and video to test with. Seems like the video codec that the source buffer is being created with might be wrong, judging by the error.
I have the same issue I am reading udp packets and sending to websocket. What else does it need ? my buffer is closing.
Does the data need to be parsed or reconstructed before sending to mux ? Something to be dependancyless of ffmpeg would be nice. The UDP packet size seems to be 1316. It is mpegts h264 being sent.
Is there any update to this. Is there a requirement to queue frames and send a certain number of frames or does it need segmenting on the server side first ?
Has anyone managed to figure it out ? I've got an agent launching ffmpeg for local HLS playback for now. But passing udp through a websocket would be ideal. There is ffmpeg wasm but it can only do protocols the browser supports.