puhitaku / mtplvcap

Nikon to USB Webcam. Supports older models that Nikon WU does not. Windows/macOS/Linux. No HDMI capture dongle is needed. Ask me on Twitter @puhitaku
https://twitter.com/puhitaku
Other
251 stars 17 forks source link

Feature request: Send stream to stdout #45

Open Artiom-M opened 3 years ago

Artiom-M commented 3 years ago

I am using your program with OBS as per instruction as a webcam, but using OBS for just this is an overkill. Would it be possible to send the same stream you are sending to websocket to the STDOUT? In this case, on Linux I would be able to pipe it to a virtual video device directly.

puhitaku commented 3 years ago

While it makes sense to me, I currently have no idea what kind of container to pack the video stream for having it transmitted on stdout. It should be clarified, and it'll be more feasible when I have a choice of muxers written in Go.

Artiom-M commented 3 years ago

You can just stream the same raw data as you streaming through the web socket then pipe it through ffmpeg, for example. So you don't really require a muxer. I would propose to make a switch --stdout which will just send captured stream to stdout instead of starting webserver.

maxammann commented 2 years ago

I did a POC here: https://github.com/puhitaku/mtplvcap/commit/806a48fb0d5ff63114d4eaccfcf9900165452f98

With this command you can stream to basically anything:

CGO_CFLAGS='-Wno-deprecated-declarations' go run . -max-resolution -debug usb,data,mtp,server | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f sdl Preview