mux.js icon indicating copy to clipboard operation
mux.js copied to clipboard

Transmux MPEG-2 TS packets via websocket from multicast UDP

Open kcchenkd opened this issue 6 years ago • 7 comments

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 image

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);
}
}

image

image

kcchenkd avatar Mar 19 '19 20:03 kcchenkd

@kcchenkd were you ever able to get this working?

mclayton7 avatar Jul 19 '20 21:07 mclayton7

same issue

cllee1214 avatar Jul 27 '21 02:07 cllee1214

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.

brandonocasey avatar Jul 27 '21 19:07 brandonocasey

I have the same issue I am reading udp packets and sending to websocket. What else does it need ? my buffer is closing.

danrossi avatar Dec 01 '21 18:12 danrossi

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.

danrossi avatar Dec 11 '21 13:12 danrossi

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 ?

danrossi avatar Jan 12 '22 12:01 danrossi

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.

danrossi avatar Mar 17 '23 05:03 danrossi