Start and Stop Recording - Raspberry Pi Forums
does know if it's possible pause , resume recording using camera module? i'm building project mimics functionality of vine app, camera needs record in segments based on how long 1 of gpio pins held high. don't know if possible using raspivid library exists.
here code. appreciated!
here code. appreciated!
code: select all
#!/usr/bin/env python import rpi.gpio gpio subprocess import call time import sleep import urllib2, json, os #setup gpio pins gpio.setmode(gpio.bcm) gpio.setup(25, gpio.in, pull_up_down=gpio.pud_down) gpio.setup(23, gpio.out) vid_count = 1; #get prompt json json_url = "http://testurl.com/data" json_string = urllib2.urlopen(json_url).read() the_data = json.loads(json_string) data = the_data["data"] in data: video = i['video'] prompt = i['prompt'] #upload function def upload(file): url = "http://testurl.com/add" try: call(["curl -f name=img -f img=@" + file + " " + url], shell=true) except: print 'fail' #record video function def video(vid_count, file): strvideo= str(vid_count) call(["raspivid -t 15000 -w 200 -h 200 -o video" + strvideo + ".h264"], shell = true) #convert mp4 if necessary #call(["mp4box -add video" + strvideo + ".h264 video" + strvideo + ".mp4"],shell=true) while true: if gpio.input(25): gpio.output(23, gpio.high) file = "video" + str(vid_count) + ".h264" video(vid_count, file) upload(file) vid_count = vid_count + 1 sleep(2) else: gpio.output(23, gpio.low) #cleanup gpio pins gpio.cleanup()
interesting point, it's technically possible (done on mobile phones using same firmware), haven't written in app code yet.
i'm thinking of allowing specification of gpio on command line in raspistill take images - sort of shutter button whilst in timelapse mode. , in raspivid start , stop recording. need specify whether pause or message start new file guess.
anyway, it's on list, bit busy not going soon.
i'm thinking of allowing specification of gpio on command line in raspistill take images - sort of shutter button whilst in timelapse mode. , in raspivid start , stop recording. need specify whether pause or message start new file guess.
anyway, it's on list, bit busy not going soon.
raspberrypi
Comments
Post a Comment