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

Add MJPEG stream and snapshot support #61

Closed scraton closed 2 years ago

scraton commented 2 years ago

Love the work you've done here! I wanted to use my Nikon camera along with OctoPrint for some sweet timelapse videos of 3D prints. But their software expects an MJPEG stream and a way to capture JPEG snapshots. So I added endpoints for both of these:

Not sure if this would fit into your main project scope, but wanted to provide it back in case others find it useful. :)

scraton commented 2 years ago

Awesome! Glad you find it useful to merge. I've resolved the formatting issues and add a line to .editorconfig to hopefully prevent that sort of issue in the future. Thanks for the diligence in maintaining code formatting!

As a note to myself (and I welcome an additional commit to be appended here); snapshot feature has room to make it even better: it can serve the last received frame instead of the next incoming frame. It allows the users fetch the last frame even the camera stopped working.

I had considered doing it this way, but didn't want to add in the extra memory requirements that'd entail. But if you're open to it, I think it'd be a great addition. I'll open a separate PR for it if I can find some time to add that this weekend.

puhitaku commented 2 years ago

Okay, I understood the thoughts behind the implementation. I'm going to merge this now since the addition does what you want! Because frames received from DSLRs are so small, I can accept the increment of the memory consumption IMO. Thank you again for your contribution, and I'd like to ask you to implement this if you have time.