0

I have a Raspberry pi model b, and a raspberry pi camera module

I also have either a 3TB external hard drive or a apple time capsule

What I want is to be able to record a video remotely (via ssh to issue commands) and then I want it to record for an unlimited time until I issue a command to stop the recording. I want the video to be streamed and saved directly to the time capsule if possible.

So easy way of explaining what i want

  1. I plug in the raspberry pi and connect to it via ssh
  2. Tell the raspberry pi to start recording a video at 1080p at 30fps
  3. while the video is being recorded it is getting saved directly onto the time capsual
  4. Have a live preview to my mac as the video is getting recorded so i can see if i need to adjust anything
  5. Issue a stop command to end the recording.

Storage space is not really an issue for me.

This is what i have to work with

  1. Raspberry Pi model B
  2. 8Gb SD card
  3. something similar to this ( i don't know if its the same one exactly ) http://www.amazon.co.uk/Time-Capsule-500GB-Hard-Drive/dp/B00132B0MG
  4. A Network card : Edimax EW-7811UN 150Mbps Wireless Nano USB Adapter
  5. Mac or PC

This is my first real question and i've been searching for an answer so please excuse me if i have done something wrong or haven't put enough detail

user3554141
  • 39
  • 2
  • 4
  • Not sure what your question is, but you can easily stream video from the pi with mjpg-streamer running a script. I am not sure how you can store the video. Don't think f.ex mjpg-streamer have any options for that. Have you found any solution for recoring video ? – Emil Sep 02 '14 at 17:48

1 Answers1

2

Raspberry Pi Forums has some info on how it could be done (note, all examples here are ran on the pi, assuming correct software installed, etc.)

You could stream the video with the following command to get a live stream and use a script on your mac to pull in and 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 into the "tee" command will get the camera piping to a file as well as the stream. This question has an answer which explains tee thusly:

echo "foo bar" | sudo tee -a /path/to/some/file

So, combining the two, this may work for 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, you wrap that line up in a script, so that you can start it remotely, like this (easier if you transfer your ssh keys over first, so you don't have to enter passwords):

ssh -f pi@my_pi:/home/pi/bin/my_awesome_streamer.sh

Another script can then be used to kill the raspivid as & when necessary, something simple such as

sudo killall -QUIT raspivid

Should kill the program.

If you want to play with the stream directly on the mac, you can poke around the ssh man page and find out the cryptic flag combination which will allow you to also stream the data directly through the ssh connection to the mac also.

Community
  • 1
  • 1
user3258790
  • 101
  • 5