2017-07-02, 09:04
PS you'd be better using a setting for the directory to record to.
Oh and length isn't defined. Probably best in a setting too.
Oh and length isn't defined. Probably best in a setting too.
(2017-07-02, 09:04)nickr Wrote: PS you'd be better using a setting for the directory to record to.
Oh and length isn't defined. Probably best in a setting too.
# -*- coding: utf-8 -*-
import sys
sys.path.append('/storage/.kodi/addons/virtual.rpi-tools/lib')
import picamera
from time import sleep,strftime,localtime
from resources.lib import kodiutils
from resources.lib import kodilogging
import logging
import xbmcaddon
import xbmcgui
ADDON = xbmcaddon.Addon()
logger = logging.getLogger(ADDON.getAddonInfo('id'))
# Save video in a specified folder
save_path = '/var/media/Samsung USB'
filename = "Dashcam-" + strftime("%Y%m%d%H%M"),localtime + ".264"
completed_video = os.path.join(save_path, filename)
# User inputs selected data
# Camera is on for a specified time
camera = picamera.PiCamera()
camera.resolution = (1280, 720)
camera.framerate = (60)
camera.start_recording(completed_video)
time.sleep(float(length))
camera.wait_recording(5)
camera.stop_recording()
filename = "Dashcam-" + strftime("%Y%m%d%H%M"),localtime + ".264"
filename = "Dashcam-" + strftime("%Y%m%d%H%M", localtime()) + ".264"
(2017-07-02, 22:44)nickr Wrote: oops, changetoCode:filename = "Dashcam-" + strftime("%Y%m%d%H%M"),localtime + ".264"
Code:filename = "Dashcam-" + strftime("%Y%m%d%H%M", localtime()) + ".264"
But you still haven't defined length. As I say that is probably best done as a setting.
(2017-07-03, 00:27)nickr Wrote: Come on at some point you do have to do some research for yourself:
http://kodi.wiki/view/Add-on_settings
Quote: PiCameraValueError: Unable to determine type from filename /var/media/Samsung USB/Dashcam-201707022326.264
(2017-07-03, 02:32)nickr Wrote: Reading the docs, i think it should be .h264 not .264
(2017-07-03, 04:24)nickr Wrote: That is not a kodi error, but a problem in some way with the pi and/or the camera.
Google the error message.
Quote:The Raspberry Pi Camera Module uses the onboard GPU and its memory. Since your error message mentions being out of resources, consider adding at least (and possibly more than) the recommended minimum of 128MB to the GPU's allotment.
To change it:
sudo raspi-config
select: Advanced options -> Memory split -> and set at least 128MB
Some users report this message disappearing after changing the GPU memory allotment to 256MB from 128MB.
(2017-07-03, 06:19)nickr Wrote: Your GPU is set to 256M. You don't need to change that.
Libreelec doesn't need sudo as you are logged in as root anyway.
(2017-07-05, 04:45)nickr Wrote: That is a programming exercise for you.
# -*- coding: utf-8 -*-
import os
import sys
sys.path.append('/storage/.kodi/addons/virtual.rpi-tools/lib')
import picamera
from time import sleep,strftime,localtime
from resources.lib import kodiutils
from resources.lib import kodilogging
import logging
import xbmcaddon
import xbmcgui
import datetime as dt
ADDON = xbmcaddon.Addon()
logger = logging.getLogger(ADDON.getAddonInfo('id'))
# Save video in a specified folder
save_path = '/var/media/Samsung USB'
filename = "Dashcam-" + strftime("%Y%m%d%H%M", localtime()) + ".h264"
completed_video = os.path.join(save_path, filename)
# User inputs selected data
# Camera is on for a specified time
camera = picamera.PiCamera()
try:
camera.resolution = (1280, 720)
camera.framerate = (60)
camera.start_recording(completed_video)
camera.start_preview(fullscreen=False, window = (100, 20, 640, 480))
camera.annotate_background = picamera.Color('black')
camera.annotate_text = dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
start = dt.datetime.now()
camera.annotate_text = dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
camera.wait_recording(3600)
camera.stop_preview()
camera.stop_recording()
finally:
camera.close()