Demo of gPhoto2 live view in python. Adapted from aqiank/gphoto2-liveview-example
- Download liveview.py and navigate to its directory
- Plug in a USB connector from your camera to your computer
- run
gphoto2 --capture-movie --stdout | python liveview.py
gphoto2 --capture-movie --stdout
will spit out a byte stream of jpegs, where each jpeg is delimited by a start code \xff\xd8
and a stop code \xff\xd9
.
All there is to creating a frame of the liveview is reading what's in between those codes and displaying it as a jpeg to the screen. Do that repeatedly and you have a liveview. liveview.py
does the reading and displaying in two separate threads to increase speed, but this might be unnecessary depending on your camera and computer.