Skip to content

Record and Retrieve Videos

Chris Reeves edited this page Jul 3, 2024 · 4 revisions

Home
Previous: Install Video Recording Scripts


Once a Raspberry Pi has been programmed with the scripts in this repository, recording videos over an SSH connection is a simple process. Retrieving videos is also easy, and there are many different methods to do so.

Recording videos remotely requires:

Retrieving videos may also require a flash drive, depending on the retrieval method.

Record a Video

  1. Connect to the Pi via SSH (with either Termius (easy SSH connection) or the ssh command (basic setup)).*
  2. Run a custom recording command by entering its name.
    • If a custom recording command has been set to run upon SSH connection, users can skip this step. If a user wants to run a command other than the one set to run upon SSH connection, they can cancel it by pressing ctrl + c and then run the desired command by entering its name.
    • All commands can be listed by entering sh RasPi-filming-code/listcommands.sh.
  3. For Subject:, enter a recognizable name for the video file. These scripts were originally created for filming behavioral subjects, hence the prompt "Subject".
  4. For Start? (Y/n), when ready, press enter to start recording. Enter n instead to cancel the recording script.
  5. Leave the SSH connection open until recording has finished and the script has output Recording Complete.

* - Note, a custom recording command can also be run locally from the Pi if a keyboard and monitor are connected. Just open Terminal on the Pi and run the command as described in steps 2-5 above.

Retrieve Videos

There are several ways to transfer videos from the Pi to another device, some via physical connections, others via remote connections. Physical connections transfer videos faster, and are more recommended for very large video files. Remote connections can be more convenient, especially if the IP address of the Pi is known.

Flash Drive - physical

  1. Connect the flash drive to the Pi
  2. Connect to the Pi via SSH (with either Termius (easy SSH connection) or the ssh command (basic setup)).
  3. Enter ls /media/<Pi username> to display the ID of the connected flash drive.
  4. Enter ls recordings, to display all video recordings currently stored on the Pi.
  5. Enter cp -r recordings /media/<Pi username>/<drive ID>/. to copy the recordings directory to the flash drive.
    • This may take a while when copying many files or large files.
  6. Enter ls /media/<Pi username>/<drive ID>/recordings to verify that all of the video recordings have been copied to the flash drive.
  7. Unplug the flash drive to disconnect it.
  8. Optionally, enter rm recordings/* in the SSH terminal to delete all of the video recordings from the Pi.

Secure Copy - wireless (over Wi-Fi) or physical (over Ethernet)

  1. On a PC, either connect to the same Wi-Fi network as the Pi or connect to the Pi directly via an Ethernet cable.
  2. Open a terminal (Command Prompt on Windows, Terminal on macOS and Linux) and navigate to a directory which the video recordings can be copied to.
  3. Enter scp -r <Pi username>@<Pi IP address>:~/recordings . and enter the Pi password when prompted.
    • This may take a while when copying many file or large files.
  4. Enter ls recordings to verify that all of the video recordings have been copied to the PC.
  5. Optionally, the video recordings can later be deleted from the Pi by connecting via SSH and entering rm recordings/*.

simpleServer - wireless (over Wi-Fi) or physical (over Ethernet)

  1. Connect to the Pi via SSH (with either Termius (easy SSH connection) or the ssh command (basic setup)).
  2. Enter python RasPi-filming-code/simpleServer.py to begin hosting a server from the Pi. Keep the SSH connection open until all desired video files have been copied.
  3. On a PC or mobile device connected either to the same Wi-Fi network as the Pi or connected directly to the Pi via an Ethernet cable, open a web browser and enter <Pi IP address>:8000 into the address bar. This should display the files and directories contained in the home directory of the Pi as clickable links.
  4. Select the recordings link to navigate into the directory where the video recordings are stored.
  5. Select the link of a file to begin downloading it from the Pi.
  6. After downloading all desired files, check the Downloads directory of the connecting device to ensure the video files have all been copied to the connected device.
  7. In the SSH terminal, press ctrl + c to shut down the server on the Pi.
  8. Optionally, enter rm recordings/* in the SSH terminal to delete all of the video recordings from the Pi.