Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"-max-resolution" not workig with some models #56

Closed
maxammann opened this issue Jan 22, 2022 · 29 comments
Closed

"-max-resolution" not workig with some models #56

maxammann opened this issue Jan 22, 2022 · 29 comments

Comments

@maxammann
Copy link

maxammann commented Jan 22, 2022

Related: #44

Switching to XGA does not work with mtplvcap. I also tested this with ptpwebcam on a Mac which actually worked.

I uploaded the camera info from ptpwebcam as camera.txt:
camera.txt

This is from the log of mtplvcap

[0001]  INFO lv: available resolutions (higher is larger): [1 2 3]
[0001]  INFO lv: automatically use the largest choice: 3
[0004]  WARN lv: failed to change the image resolution (%!s(MISSING)); if it affects capturing frames, consider disabling `-max-resolution
@maxammann
Copy link
Author

In fact I found out what the problem is :)

On the Z6, the datatype is u8:

	payload := struct {
		Resolution uint8
	}{
		Resolution: uint8(3),
	}

@maxammann
Copy link
Author

POC: 2f455e1

@puhitaku
Copy link
Owner

Many thanks for the report and POC 👍
I'll merge your changes somehow, like adding a quirk flag ;)
I leave here opened until then.

@maxammann
Copy link
Author

Are you sure this is a quirk? With which Nikons did you test the 64bit value?

@puhitaku
Copy link
Owner

D500, D850, and D7500 want 64bit value and I confirmed it works.
If the newer models incl. Z6 and the brothers want 8bit, it's not a quirk specific to Z6 and I'll add a new value like ResolutionValueType in the mtp.ModelMap struct.

(Extra story: I confirmed the max resolution feature in a camera store with permission from a clerk and I found that it doesn't work with Z6 and similar models. I didn't have a courage to ask clerk for a permission to debug my code in the store so I left there 😅)

@maxammann
Copy link
Author

D500, D850, and D7500 want 64bit value and I confirmed it works.
If the newer models incl. Z6 and the brothers want 8bit, it's not a quirk specific to Z6 and I'll add a new value like ResolutionValueType in the mtp.ModelMap struct.

(Extra story: I confirmed the max resolution feature in a camera store with permission from a clerk and I found that it doesn't work with Z6 and similar models. I didn't have a courage to ask clerk for a permission to debug my code in the store so I left there 😅)

Haha, nice! Do you know that you can get the documentation from nikon for all cameras? :) Im not sure whether one is allowed to use them though.

@puhitaku
Copy link
Owner

puhitaku commented Jan 25, 2022

Do you know that you can get the documentation from nikon

That's what I'm negotiating with Nikon for. Here is the story. I'm asking a Nikon guy to re-release the SDK under an OSI-approved license.

Their public SDK may give me something interesting, but it's licensed under a proprietary agreement that is considered not to be compatible with GPL.

@puhitaku puhitaku changed the title "-max-resolution" not workig with Nikon Z6 "-max-resolution" not workig with some models Feb 21, 2022
@puhitaku
Copy link
Owner

Sorry for being inactive,
The fix is merged in #57 . mtplvcap now transmits an uint8 value for the newer models incl. Z6.

@maxammann
Copy link
Author

No worries :) thank you for your project!

Will test next week

@fedegratti
Copy link

Hi @puhitaku I can confirm that this doesn't work on D3500:
image

maybe #57 fixes it?

Thank you for this project, I love it!

@puhitaku
Copy link
Owner

Thanks for the report fedegratti-san,
I suspect that all Nikon needs uint8 (the fix introduced in #57) in the end so I'm going to test it in a week or so.
Please wait for a while and I'll mention you.

@ria8651
Copy link

ria8651 commented Mar 12, 2022

I get exactly the same log as fedegratti with a D3400.

When using master I get:
Screen Shot 2022-03-12 at 7 46 35 PM

Awesome project thanks :)

@puhitaku
Copy link
Owner

Thank you everyone, now I identified the bug in changing the resolution and it is due to my untested change (Sorry for that! I have no new DSLRs capable of higher resolutions), so I fixed it now in #59 after a brief test in near camera shop.

Interestingly, the internal model name is different from what I expected e.g. Z7 II returns NIKON DSC Z 7_2 as its model name. And D3400 also differs too (its model name is NIKON DSC D3400 according to it while I expected "D3400").

@fedegratti
Copy link

Hi @puhitaku, thank you so much for your support!

I've just tested and it still not working on D3500:
image

I hope the above image helps. Also, if you need me to do some testing on my camera, we can do chat about it.

Lastly, do you have a place for donations? I love your work and I would like to give you something!

Cheers.

@puhitaku
Copy link
Owner

That's because the resolution value type is "falling back" (as you see in the log) to uint64 I guess and I added a tweak to use uint8 by default.

@fedegratti Could you pull the branch fix/resolution and give it a try again?

do you have a place for donations? I love your work and I would like to give you something!

Thank you very much! Donation is very appreciated. The top page of mtplvcap and my GitHub profile page have a link to GitHub Sponsors and Patreon.

@fedegratti
Copy link

@fedegratti Could you pull the branch fix/resolution and give it a try again?

@puhitaku same issue. Is there a way to log more info? Maybe I can add more logs in the core.

@puhitaku
Copy link
Owner

Argh, I temporarily can't think of what to do next ... I should borrow a D3500 (or other model that causes the "closing connection").

@maxammann
Copy link
Author

Argh, I temporarily can't think of what to do next ... I should borrow a D3500 (or other model that causes the "closing connection").

We could also take a look at the specification. Im pretty sure thats legal.

@maxammann
Copy link
Author

According to some other project the D3500 is not capable of higher resolutions: https://github.com/dognotdog/ptpwebcam/blob/9f138716eaf1d14a3505f57b71480ab8577150e5/CAMERAS.md#aps-c--dx

@keeandamok
Copy link

for the d3300 im getting a similar error to the d3400
Screen Shot 2022-04-20 at 1 57 41 AM

@fedegratti
Copy link

Hi @puhitaku, were you able to find a workaround for this issue?

@puhitaku
Copy link
Owner

@maxammann

According to some other project the D3500 is not capable of higher resolutions

If its max is 640x480, it actually is. But they described the resolution pair with parens. I'm not sure what it means.

@fedegratti Unfortunately, no :P

Is there a way to log more info?

mtplvcap is not so verbose even when all logging options are enabled because I preferred to debug it with an interactive debugger. I think I should improve and increase the log...
At present, I'm pretty not sure how to remedy this and looking for a D3500 body.

@puhitaku
Copy link
Owner

Sorry for neglecting here. And thanks for kind donations.

@puhitaku
Copy link
Owner

@maxammann It's been a while, Z6 is confirmed to accept high resolutions according to a comment in #59 . The fixed version v1.5.1 is released. Thanks for providing me a POC!

@JobLeonard
Copy link

Despite the issue being closed I assume this is the best topic to give resolution feedback for untested models, is that correct?

I just tried this out for my Z fc. It works, max resolution is 1024x680. So a higher resolution is available, but it doesn't seem to have the full range the camera should be able to support.

image

@puhitaku
Copy link
Owner

@JobLeonard Hi Job, I appreciate your feedback. So glad to see that Z fc supports high-res!

I assume this is the best topic to give resolution feedback for untested models, is that correct?

Yes, commenting here and creating a new issue are the choices, and "it worked" things will come here since no further discussion is needed in general.

it doesn't seem to have the full range

It should be possible to transmit high-res frames like 1920x1080 at 30fps, but Nikon seems not to give LV more than a preview purpose.

@JobLeonard
Copy link

Ah, so they distinguish the live view from their own "webcam" support? That explains it :)

Luckily 1024x680 is more than enough for my purposes, the image is so clean it's probably better than most people's HD webcams anyway ;)

And as a Linux user, thanks for writing this amazing piece of software!

@evanslify
Copy link

Hello,

I confirm Nikon Z 8 is working with high resolution, with -max-resolution enabled.

$ ./mtplvcap -debug server -max-resolution
[0000]  INFO main: started
[0000] DEBUG lv: manufacturer = NIKON, product = NIKON DSC Z 8, serialnumber = ****
[0000] DEBUG lv: model didn't match, falling back to the generic model 
[0001]  INFO lv: getting available resolutions
[0001]  INFO lv: available resolutions (higher is larger): [1 2 3]
[0001]  INFO lv: automatically use the largest choice: 3

@puhitaku
Copy link
Owner

@evanslify Thank you for reporting it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants