Yi Dash Cam python library and web app

kwirk

New Member
Joined
Aug 27, 2016
Messages
21
Reaction score
13
Location
Wiltshire, England
Country
United Kingdom
As a bit of a weekend project, I developed a software library (written in Python) and basic web app to interface with the Yi Dash Camera. The idea is I wanted an easier way to sync and view video clips from the camera to my laptop/Raspberry-Pi using the WiFi interface, rather than going via my mobile phone.

There's still some work to be done in the library (can't change camera configuration at the moment). The web app is fairly simple, but there is a basic layout of thumbnails for "emergency" and "roadmap" clips, which you can than play/download in your web browser.

You can find the initial version (0.1) on GitHub:kwirk/yidashcam, where you'll also find the README with some more information. I welcome any comments, bugs reports and contributions.

In live video streaming mode, I had a few problems with video constantly jumping back to first frame, so I'd be interested if anyone else sees the same behavior or not; I suspect it may be my laptop.

Please note this is unofficial software, so use at your own risk!
 
I've just released version 0.3. Still a work in progress, especially on the web frontend, but library and command line tool are pretty much complete.

The command line tool now allows you to take photos with the camera, as well as steam the live video (ignore previous comments about streaming issues...its was my laptop ;)).

In addition, the command line tool allows you to view and change the settings on the camera. Of interest is some options not available from the official app or camera UI, including: change video record length; change exposure level; change photo resolution; language (some text remains in English); and record auto start (app mode only).
 
Umm how do I use this? I downloaded Python and the files, but what do I launch? webapp.py? I want to change the exposure level and video recording length.
 
In the command line, execute "python -m yidashcam config --help" to see help on how to set options.
 
Managed to connect. However, I tried changing video_length and exposure, but after entering the command and pausing for a while, the change is not applied. the 'confirmation' does not show the new value. And I can't seem to even try to set exposure to -1/3. Seems like the / is confusing the command line? I've tried --1/3, "-1/3" and '1/3'.
 
Thanks for testing nfshp253. The "-1/3" was a bug on my part due to the "-" prefix. I put a fix in for this.

The issue with the settings, is due to the dashcam not responding to config changes when starting/stopping recording. I had "video_auto_start" set to false on my dashcam, so I didn't notice this issue. I've now added an additional delay to allow the dashcam to settle into recording before issuing config commands.

Hopefully you should be able to change the settings now in the new v0.3.1 release.
 
Ah, it seems to work perfectly now! Thanks! Any plans to try to change the encoding bitrate?
 
Glad to hear its working for you now. Thanks for testing and helping me find those bugs.

I don't believe there is a way to change the bit rate via the WiFi interface unfortunately. I suspect it may require a custom firmware to change that.
 
Ah well I don't think that's happening then. Well thanks for the interface that allowed me to change the exposure to -1/3 and video length to 10 minutes.
 
Do you have PHP version?
I don't understand how use your library. Upload library on hosting \ on flash card? How access to files? Connect my iphone with the XIAOMI APP to YI and so next?
Connect iphone to YI wifi and...? Visit some url?
Can you share this library from internet with test? Ex: http://yilibrary.to
Please make full instruction.
 
Last edited:
Only Python sorry. The app runs a local web server on your computer, so no need to host it.

To use you'll need to install Python 3.4+ (I've tested with 3.5); then you can use virtual environment and pip to install 'Flask-Bootstrap' and 'yidashcam' (other dependencies should be taken care of). Then connect to your YI's Wi-Fi and run 'python -m yidashcam webapp'. This should then output a URL which you can copy into your web browser's address bar.
 
i think i should have notebook with wi-fi, not desktop with lan RG-45 or iphone :)
 
On trying to run the webapp, I'm getting these errors:

Traceback (most recent call last):
File "C:\Users\nfshp253\AppData\Local\Programs\Python\Python36\lib\site-packages\werkzeug\serving.py", line 65, in <module>
from SocketServer import ThreadingMixIn, ForkingMixIn
ImportError: No module named 'SocketServer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\nfshp253\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\nfshp253\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\nfshp253\Desktop\yidashcam-0.6.2\yidashcam\__main__.py", line 114, in <module>
app.run()
File "C:\Users\nfshp253\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 828, in run
from werkzeug.serving import run_simple
File "C:\Users\nfshp253\AppData\Local\Programs\Python\Python36\lib\site-packages\werkzeug\serving.py", line 68, in <module>
from socketserver import ThreadingMixIn, ForkingMixIn
ImportError: cannot import name 'ForkingMixIn'
 
Hmm not sure how to downgrade. It's already a miracle I got this version of Python working.
 
This looks great, thanks! Any changes that may be needed or features that could be added with the recent V-1.03.026-US firmware update?
 
My latest code (not tagged with a version number yet) supports 720p option, deleting the small video files and the new driving report option.

I want to add a check on which firmware version you have on the camera, as setting 720p on the old firmware can cause the camera to freeze; then I'll bump the version number of my software.

I could also add a feature to exploit the small video and also parse the driving data (maybe highlight videos which have a hard acceleration/deceleration event?).
 
Is it possible to completely turn off the gsensor?
 
Back
Top