python - Recording video from raspberry pi and saving it to a external hard drive -
i have raspberry pi model b, , raspberry pi camera module
i have either 3tb external hard drive or apple time capsule
what want able record video remotely (via ssh issue commands) , want record unlimited time until issue command stop recording. want video streamed , saved directly time capsule if possible.
so easy way of explaining want
- i plug in raspberry pi , connect via ssh
- tell raspberry pi start recording video @ 1080p @ 30fps
- while video being recorded getting saved directly onto time capsual
- have live preview mac video getting recorded can see if need adjust anything
- issue stop command end recording.
storage space not issue me.
this have work with
- raspberry pi model b
- 8gb sd card
- something similar ( don't know if same 1 ) http://www.amazon.co.uk/time-capsule-500gb-hard-drive/dp/b00132b0mg
- a network card : edimax ew-7811un 150mbps wireless nano usb adapter
- mac or pc
this first real question , i've been searching answer please excuse me if have done wrong or haven't put enough detail
raspberry pi forums has info on how done (note, examples here ran on pi, assuming correct software installed, etc.)
you stream video following command live stream , use script on mac pull in , save data
raspivid -t -0 -w 1280 -h 720 -fps 25 -b 2000000 -o - | ffmpeg -i - -vcodec copy -an -f flv -metadata streamname=mystream tcp://0.0.0.0:6666
some investigation "tee" command camera piping file stream. this question has answer explains tee thusly:
echo "foo bar" | sudo tee -a /path/to/some/file
so, combining two, may work you:
raspivid -t -0 -w 1280 -h 720 -fps 25 -b 2000000 -o - |tee -a /home/pi/my_big_hard_drive/my_video.h264 | ffmpeg -i - -vcodec copy -an -f flv -metadata streamname=mystream tcp://0.0.0.0:6666
now, wrap line in script, can start remotely, (easier if transfer ssh keys on first, don't have enter passwords):
ssh -f pi@my_pi:/home/pi/bin/my_awesome_streamer.sh
another script can used kill raspivid & when necessary, simple such
sudo killall -quit raspivid
should kill program.
if want play stream directly on mac, can poke around ssh man page , find out cryptic flag combination allow stream data directly through ssh connection mac also.
Comments
Post a Comment