dbeef / streamer-ds

Capturing desktop and streaming it to NintendoDS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

streamer-ds

Capturing desktop and streaming it to NDS

128px streaming 256px streaming

Dependencies

Usage

  • create hotspot on your laptop
  • run .nds file on your NDS
  • connect to your hotspot on your NDS via the .nds file
  • run the python script: desktop_client.py

How it works

  • NDS opens port 8080, python script connects PC to it, then:
    • python makes screenshot,
    • resizes it to 256px or 128px (depends how smooth transmition you want - 256px takes ~ 0.6s on frame, 128px - ~0.3s)
    • calls grit to make a 16 bit, lz77 compressed raw binary version
    • sends image size to the NDS
    • sends image
    • receives ACK character from NDS
    • repeat

How to make WIFI hotspot that NDS can connect (it's not that obvious):

  • in Ubuntu open "Network Connections" and click "add new"
  • go to the "Wi-Fi security" - NDS supports only WEP security (so remember, it's dangerous to beacon that poorly secured network all the time, use this hotspot only when playing with your NDS) - select "WEP 40/128 bit key (Hex or ASCII)"
  • select some random 5 character (only digits) password
  • in "Wi-Fi" tab select "Mode" to "Hotspot"
  • save it
  • open "Network"
  • click "Connect to to a hidden network"
  • select network that you've just created (by default its name will be "hotspot")
  • you're done, if you were previously connected with another network via wifi you'll be disconnected
  • now you can connect to this network through your NDS

Performance:

Well... as it's only sending lz77 compressed bitmaps through the network, you won't be suprised that for a 2004 portable console that much of bytes will be a shock therapy. On average it's somewhere between 10-20 kB per 256px frame and 5-10 per 128px frame. Every frame must be decompressed on NDS (it has a dedicated hardware for that so it's not that bad in this task) and that's the thing that takes most of the time (around 2/3 of frame time). I tried sending non-compressed bitmaps but it took around 80kB per each and it took even more time (this time the WiFi capabilities of the NDS were the bottleneck).

Click to see details Efficiency

Click to see details Efficiency

FAQ

  • Can I control my desktop through this app?
    • You could do it, I even created one version that you can access on this video:
    • https://www.youtube.com/watch?v=WR8Y4Iro9t0
    • ...but it's almost no use because I can't utilize multiple threads on NDS so capturing input will occure every frame - that means it will happen every ~0.3 second - so it's basically garbage.
    • If you're interested only in capturing key input (without the video part), I created another program:
    • https://github.com/dbeef/pc-controller-ds

GBAtemp thread

About

Capturing desktop and streaming it to NintendoDS

License:GNU General Public License v3.0


Languages

Language:Python 50.4%Language:C++ 27.1%Language:Makefile 16.0%Language:C 4.1%Language:CMake 1.9%Language:Shell 0.5%