This might help a lot of people having similar issues. I have one of those old cctv systems which require internet explorer to view and manage the cameras (no other browser will work )and no type of streaming is available. No custom integration available to feed the stream into Home Assistant making it impossible to integrate into anything.
I didn’t want to buy a new system since it was still working so I started looking into software which streams entire desktop as a RTSP protocol. As you do I started to play with VLC but it was very slow and out of sync.
I then came across Open Screen from MrKonstantinSh on github. I setup 4x Windows 7 VM’s (one for each camera) and setup Open Screen to stream the entire desktop and whatever is displayed (camera feed in IS)
After 2 weeks of letting it run to see if anything crashes I carried on automating it. I started with windows autologin after restart.
Which then I wrote a python script with pyautogui which gets executed in a .bat file added into the Windows AutoStart directory to start Open Screen then Internet Explorer with couple automated mouse movements and series of left and right clicks to go through the menu to select the correct camera, change it to best stream quality and setting it to Fullscreen mode.
Pros:
- don’t need to buy new CCTV system
- can stream anything what runs on windows
Cons:
- for each stream you require its own windows vm and different python script
- little scripting knowledge needed to automate it otherwise every time the computer reboots you will need to login and reconfigure it
I am happy to share my python script but since everyone has different screen resolutions and different mouse click and positions for the script to execute you will need somewhat a little bit of knowledge on how to change it to your requirements.
import subprocess
import time
import pyautogui
def start_OpenScreen(OpenScreen_path):
try:
subprocess.Popen(OpenScreen_path)
print(f"Successfully started the application: {OpenScreen_path}")
time.sleep(1)
for _ in range(5):
pyautogui.press('tab')
for _ in range(2):
pyautogui.press('down')
for _ in range(4):
pyautogui.press('tab')
pyautogui.press('space')
pyautogui.press('tab')
pyautogui.press('enter')
time.sleep(1)
pyautogui.hotkey('win', 'down')
except FileNotFoundError:
print(f"Application not found: {OpenScreen_path}")
except Exception as e:
print(f"An error occurred while starting the application: {str(e)}")
def start_IE(IE_path):
try:
subprocess.Popen(IE_path)
print(f"Successfully started the application: {IE_path}")
time.sleep(4)
pyautogui.hotkey('win', 'up')
time.sleep(4)
pyautogui.press('enter')
time.sleep(4)
pyautogui.moveTo(380, 250)
pyautogui.doubleClick()
time.sleep(4)
pyautogui.moveTo(800, 450)
pyautogui.click(button='right')
time.sleep(4)
pyautogui.moveTo(880, 525)
pyautogui.click(button='left')
time.sleep(4)
pyautogui.moveTo(409, 810)
pyautogui.click(button='left')
except FileNotFoundError:
print(f"Application not found: {IE_path}")
except Exception as e:
print(f"An error occurred while starting the application: {str(e)}")
OpenScreen_path = r"C:\Program Files (x86)\MrKonstantinSh\OpenScreen\OpenScreen.exe"
IE_path = r"C:\Program Files (x86)\Internet Explorer\iexplore.exe"
start_OpenScreen(OpenScreen_path)
time.sleep(1)
start_IE(IE_path)