phoboslab / jsmpeg

MPEG1 Video Decoder in JavaScript
MIT License
6.3k stars 1.43k forks source link

implement python lib for decode and display the video #425

Open eaphone opened 4 months ago

eaphone commented 4 months ago

hi, this project is awesome with its low latency. i am wondering if it is possible to use python to decode and display the video stream locally instead of using js(web)

do you have any idea or suggestion?

eaphone commented 4 months ago

i am using the whole project for showing the stream at web. additionally, i also want to display the streaming with python to integrate with my exist python automation script. my python script is able to communicate to the websocket-relay server and got raw stream data. however, i got trouble at decoding the stream.

phoboslab commented 4 months ago

I don't write much python, but I believe you could use pl_mpeg via FFI in python to decode the video and audio packets.

pl_mpeg doesn't come with an MPEG-TS demuxer (only MPEG-PS), so you'd have to write this part yourself. The MPEG-TS demuxer here is only 200 lines; TS shitty format, but not too complicated.