Live data from Hacker News

Show HN: Pxy – A Go server that proxies websocket livestreams to RTMP servers

github.com

11–20 of 34 posts

Re: Show HN: Pxy – A Go server that proxies websocket livestreams to RTMP servers

#11
post #7

Earlier quoted context omitted.

This appears to use the MediaStream Recording API ( https://developer.mozilla.org/en-US/docs/Web/API/MediaStream... ) to produce a WebM H.264 stream, which can be sent to the WebSocket. The server then transmuxes this to a FLV H.264 stream for RTMP output.

A...WebM H.264 stream? Again, with feeling. This time, try something that's a thing.

While WebM usually contains VP8 or VP9, it isn't impossible to throw an h264 stream in there

Re: Show HN: Pxy – A Go server that proxies websocket livestreams to RTMP servers

#12
post #7

Earlier quoted context omitted.

This appears to use the MediaStream Recording API ( https://developer.mozilla.org/en-US/docs/Web/API/MediaStream... ) to produce a WebM H.264 stream, which can be sent to the WebSocket. The server then transmuxes this to a FLV H.264 stream for RTMP output.

A...WebM H.264 stream? Again, with feeling. This time, try something that's a thing.

WebM is Matroška, and it can contain H.264 as far as I'm aware. Not sure precisely what browsers decide to do here, but apparently it's something.

Re: Show HN: Pxy – A Go server that proxies websocket livestreams to RTMP servers

#14
post #5
post #4

What kind of video sources provide output via websockets to be proxied to RTMP? OBS and other streaming video tools usually support RTMP themselves and browsers only support WebRTC out of the box as far as I know. I'm curious what kind custom browser video streaming solution you're using on the client side.

I think the inverse of this (RTMP to Websockets) would be more interesting.

There is no provision for decompressing raw encoded video frames outside of WebRTC. Yes you can use Media Extensions, but that requires boxing the video. There is also Broadway.js, but that is limited to h264 baseline.

Re: Show HN: Pxy – A Go server that proxies websocket livestreams to RTMP servers

#15
post #6

Can this be used as a web front end for say a raspberry pi camera ?

this will allow you to send video to any service that supports RTMP input (Facebook / YouTube etc..) If you just want to view your Rpi Camera remotely there are better solutions.

Re: Show HN: Pxy – A Go server that proxies websocket livestreams to RTMP servers

#16
post #7
post #4

What kind of video sources provide output via websockets to be proxied to RTMP? OBS and other streaming video tools usually support RTMP themselves and browsers only support WebRTC out of the box as far as I know. I'm curious what kind custom browser video streaming solution you're using on the client side.

This appears to use the MediaStream Recording API ( https://developer.mozilla.org/en-US/docs/Web/API/MediaStream... ) to produce a WebM H.264 stream, which can be sent to the WebSocket. The server then transmuxes this to a FLV H.264 stream for RTMP output.

You get Nal h264 packets from MediaStream. Note MediaStream only supports h264 baseline on Chrome (you can request other profiles, but that's all you get). Not sure about FireFox.

https://en.wikipedia.org/wiki/Network_Abstraction_Layer

Re: Show HN: Pxy – A Go server that proxies websocket livestreams to RTMP servers

#17

Earlier quoted context omitted.

A...WebM H.264 stream? Again, with feeling. This time, try something that's a thing.

WebM is Matroška, and it can contain H.264 as far as I'm aware. Not sure precisely what browsers decide to do here, but apparently it's something .

WebM is a subset of Matroska, if something is returning h.264 inside a WebM container...that's not conforming to the WebM subset. But I guess nothing matters.

Re: Show HN: Pxy – A Go server that proxies websocket livestreams to RTMP servers

#18
In the same genre of Go video streaming adapter servers. Here are a couple neat projects which stream from RTSP (as used by eg security cameras) to either fragmented .mp4 files over WebSocket or WebRTC:

https://github.com/deepch/RTSPtoWSMP4f

https://github.com/deepch/RTSPtoWebRTC

I'm jealous of Go's WebRTC library that makes the latter possible. I'd love to have a similar Rust crate.

Re: Show HN: Pxy – A Go server that proxies websocket livestreams to RTMP servers

#19
post #5
post #4

What kind of video sources provide output via websockets to be proxied to RTMP? OBS and other streaming video tools usually support RTMP themselves and browsers only support WebRTC out of the box as far as I know. I'm curious what kind custom browser video streaming solution you're using on the client side.

I think the inverse of this (RTMP to Websockets) would be more interesting.

Look up there :-)

https://news.ycombinator.com/item?id=22921564

Re: Show HN: Pxy – A Go server that proxies websocket livestreams to RTMP servers

#20
Awesome to see this on the front page! I’ve been chatting with the OP for a few days and this is based on a Node.js PoC I wrote for a blog post on the state of broadcasting live from a browser[1].

This is, IMO, the simplest way to be able to go from a modern browser to an RTMP endpoint. You could try and do server-side WebRTC using a project like Pions[2], or use headless Chrome and be a peer, but both of those come with their own headaches. This just uses the MediaRecorder API to send chunks of video as it’s available via a WebSocket, then the server pipes those messages into FFmpeg via stdin. It’s lightweight enough that it even runs incredibly well on Glitch[3].

Also, if you’re curious, the videos that come out of the MediaRecorder are all over the place between browsers, but they’re all varying degrees of “barely qualifying as playable video”. Incredibly fun to play with, but you will absolutely need to encode any output from it.

[1] https://mux.com/blog/the-state-of-going-live-from-a-browser

[2] https://github.com/pion/webrtc

[3] https://glitch.com/~mmcc-next-streamr

Post reply on HN