mtplvcap icon indicating copy to clipboard operation
mtplvcap copied to clipboard

Feature request: Send stream to stdout

Open Artiom-M opened this issue 3 years ago • 3 comments

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.

Artiom-M avatar Aug 13 '21 11:08 Artiom-M

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.

puhitaku avatar Aug 13 '21 14:08 puhitaku

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.

Artiom-M avatar Aug 14 '21 09:08 Artiom-M

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

maxammann avatar Jan 22 '22 16:01 maxammann