timotheeg / nestrischamps

A web-based OCR and restreamer system for NES Classic Tetris players
MIT License
45 stars 11 forks source link

Capture from USB #99

Closed MajorMajor0 closed 2 years ago

MajorMajor0 commented 2 years ago

I apologize if this is a stupid question: When I open the calibration site, my USB video capture device is not available. My guess is that the workaround here is to stream the capture device to a window and run nestrischamps on that window. I think it'd be better if this intermediate window were not necessary because

  1. It requires having another window open distracting and taking resources
  2. The calibration then depends (I'm guessing?) on the window size

I suggest it'd be cleaner if you could calibrate directly to any webcam or video device

FWIW, my capture device shows up in the device manager under "Sound, video, and Game Controllers". And is enumerated by Aforge along with my webcam.

timotheeg commented 2 years ago

Hey @MajorMajor0 👋

It's well understood that capturing straight from capture devices is much better, and the code is already designed to list all video devices. Capturing from window screencap is only there for folks playing on emulators.

See code here

So you need to check why your browser is not listing your device.

In case this is a browser issue, note that Nestrischamps is tested only on Chrome and Firefox.

To troubleshoot, you can try this: 1) visit obs.ninja, click on Add your Camera to OBS, and check if the video capture device is listed there. 2) In nestrischamps capture page in Chrome, open the dev tools (right-click somewhere where there's nothing, and select Inspect, then click the console tab, and run this code:

navigator.mediaDevices.enumerateDevices().then(ds => ds.forEach(d => console.log(d)))

or if you want to see only the videoinput devices, run this:

navigator.mediaDevices.enumerateDevices().then(ds => ds.filter(d => d.kind === 'videoinput').forEach(d => console.log(d)))

On my computer, it shows this: image

MajorMajor0 commented 2 years ago

Thanks very much for the rapid response. I wiped and reloaded Chrome and it started working. It must have been some privacy setting.

If I could bother you with another question, have you seen the capture show up half green like this before? This is the same USB capture card you have.

[image: image.png]

On Sat, Sep 11, 2021 at 8:10 PM Timothee Groleau @.***> wrote:

Hey @MajorMajor0 https://github.com/MajorMajor0 👋

It's well understood that capturing straight from capture devices is much better, and the code is already designed to list all video devices. Capturing from window screencap is only there for folks playing on emulators.

See code here https://github.com/timotheeg/nestrischamps/blob/5ef9766a587d352f9876d351c039f8ba38c1285c/public/ocr/ocr_main.js#L547-L572

So you need to check why your browser is not listing your device.

In case this is a browser issue, note that Nestrischamps is tested only on Chrome and Firefox.

To troubleshoot, you can try this:

  1. visit obs.ninja, click on Add your Camera to OBS, and check if the video capture device is listed there.
  2. In nestrischamps capture page in Chrome, open the dev tools (right-click somewhere where there's nothing, and select Inspect, then click the console tab, and run this code:

navigator.mediaDevices.enumerateDevices().then(ds => ds.forEach(d => console.log(d)))

or if you want to see only the videoinput devices, run this:

navigator.mediaDevices.enumerateDevices().then(ds => ds.filter(d => d.kind === 'videoinput').forEach(d => console.log(d)))

On my computer, it shows this: [image: image] https://user-images.githubusercontent.com/935223/132970567-21e5db3e-37e7-466a-8501-693f30665151.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/timotheeg/nestrischamps/issues/99#issuecomment-917541363, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFZBOS7URKSCQJKYRRJQPG3UBQK3NANCNFSM5D3J3Y5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

timotheeg commented 2 years ago

Yes, I've seen the dreaded half-green issue reported before. It seems to be a bug with chrome, The only workaround I know is to use Firefox 😞

MajorMajor0 commented 2 years ago

I want to tell you, this software is the tip top.

I started writing a program in .NET last year that was to have, essentially, the exact same features. I got as far as a custom OCR, and storing frame states, piece counts, and droughts, separate player logins, a calibration screen, and redrawing the board HD.

I got a little stuck on the interlacing issue. I tried to solve it by making the OCR count 4 identical frames in a row--I never thought of taking every other line. Then I got busy with other projects, and I set it aside. I had just picked it up again this week when I found NestrisChamp--which has put me to shame and made my effort totally obsolete.

All of which is to say how impressed I am, and thanks again.

On Sun, Sep 12, 2021 at 12:06 AM Timothee Groleau @.***> wrote:

Yes, I've seen the dreaded half-green issue reported before. It seems to be a bug with chrome, The only workaround I know is to use Firefox 😞

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/timotheeg/nestrischamps/issues/99#issuecomment-917572412, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFZBOS6HNHUQLUV3QGU663TUBRGOPANCNFSM5D3J3Y5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.