Translating consoles on the fly with Google Lens

The place for all discussion on gaming hardware
Post Reply
User avatar
Syntax
Posts: 1776
Joined: Wed Aug 09, 2017 12:10 am
Location: Australia

Translating consoles on the fly with Google Lens

Post by Syntax »

Over the Christmas break I was playing some PCE-CD games with my brothers and we found the need to pull out our phones and use google lens to translate some of the games we were playing.
It was the first time using it and I quickly found out it likes to translate a sentence or UI element too early/ahead of the rest and will not retranslate until you pull the phone away and refresh the image for Lens.
This isn't so bad when you have 2 brothers to choose from to hold the phone for you, but there has to be a better way.

Fast forward to last night, I decided to have a play with the idea again.
Its pretty simple really.

Install virtual camera to OBS. Not the inbuilt one use this one https://github.com/miaulightouch/obs-virtual-cam
Have the virtual camera as a separate scene and put a black frame over it, set up separate hotkeys in settings to show and hide this layer.
Install Bluestacks 5 Android emulator for Windows and Google Lens
Setup Bluestacks to run off the virtual camera, and feed the virtual camera your console stream, you may want to make this a new device/scene off screen to your main.
Open Google Lens and you should have a feed of your console in the emulator window, tune the OBS virtual camera size in its scene to be smaller and avoid the Google Lens UI.
Capture the Bluestacks window in OBS, be sure to have Bluestacks on screen, if its offscreen or minimized it wont run video.
Setup default, the virtual camera should run 1080p 60fps, if something is wrong it will do 30fps.

Now this next part is optional but makes for smooth super fast translations.
Make an Autohotkey script that presses the show hotkey for the black layer we made earlier, followed by a 50ms pause then the hide hotkey followed by a 100ms pause.
I personally made an Arduino do it for me on a foot pedal.
This is a real game changer, no more holding a phone, missing half a translation or having to flick the phone away from screen and back again, or needing a phone at all for that matter, now the translation is mostly auto but instant when you stomp that button!

This isn't limited to games, it will work with pretty much anything you throw at it, and the Google Ai does all the overlays which most of the time looks seamless.

Is there an easier way to go about this without resorting to Retroarch?

https://youtu.be/3JDS4SW0LxQ?si=uyUquDsW1kjj6wzs


Arduino script used for the hotkeys P and O on pins 2 and 3

Code: Select all

#include <Keyboard.h>

const int pPin = 2;
const int oPin = 3;
bool keyPressed = false;

void setup() {
  // Set pin 2 and pin 3 as input
  pinMode(pPin, INPUT);
  pinMode(oPin, INPUT);
  // Enable internal pull-up resistor for pin 2 and pin 3
  digitalWrite(pPin, HIGH);
  digitalWrite(oPin, HIGH);
  // Start USB communication
  Keyboard.begin();
}

void loop() {
  // Check if pin 2 is low
  if (digitalRead(pPin) == LOW || digitalRead(oPin) == LOW) {
    if (!keyPressed) {
      // Press 'p'
      Keyboard.press('p');
      // Release 'p'
      Keyboard.release('p');
      delay(50);
      // Press 'o'
      Keyboard.press('o');
      // Release 'o'
      Keyboard.release('o');
      
      keyPressed = true;
      delay(100); // Delay to avoid repeated keypresses
    }
  } else {
    keyPressed = false;
  }
}
NightWolve
Posts: 6
Joined: Wed Aug 04, 2021 8:29 pm
Location: Chicagoland
Contact:

Re: Translating consoles on the fly with Google Lens

Post by NightWolve »

Ah yeah, I remember seeing someone do this too by setting up 2 monitors.
https://twitter.com/FantasyAnime/status ... 3313156100

Image

Alej thinks the the guy was mirror-casting his smartphone screen to the LCD TV there while going retro with the CRT (playing an Ys game to boot).

What's the story about RetroArch being able to do this seamlessly ?
https://www.gamedeveloper.com/game-plat ... ated-games

I see, they've had this for a few years now. Looks like it might be limited to text-to-speech.
https://www.youtube.com/watch?v=BhH87cYq_b0
facebook.com/boycottxseed
My Legacy Localizations: Xak III, Ys IV, Ys I&II Complete, Ys: Oath in Felghana
User avatar
Syntax
Posts: 1776
Joined: Wed Aug 09, 2017 12:10 am
Location: Australia

Re: Translating consoles on the fly with Google Lens

Post by Syntax »

User avatar
ASDR
Posts: 832
Joined: Sat Aug 12, 2017 3:43 pm
Location: Europistan

Re: Translating consoles on the fly with Google Lens

Post by ASDR »

NightWolve wrote: Mon Jan 29, 2024 3:09 am Ah yeah, I remember seeing someone do this too by setting up 2 monitors.
Love it. I have quite a few Japanese PS1, Saturn and WonderSwan games, would be a fun way to play them.
Post Reply