Nenth
Posts: 4
Joined: Tue Feb 02, 2016 9:40 am

Saving a video stream on a USB device on boot

Thu Feb 18, 2016 3:00 pm

Hi,

I am trying to use the Pi NoIR camera to film on boot, as in I power the PI, and the camera starts recording.

I wrote this script to do so :

-----------------------------------------------------
#!/bin/sh
### BEGIN INIT INFO
# Provides: cameraStart
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Haha
# Description: BhBh
### END INIT INFO

sleep 10 ;
if [ -d /media/A83D-9CDC ]; then
sudo chown pi /media/A83D-9CDC ;
raspivid -o /media/A83D-9CDC/startupVideo2.h264 -t 10000 ;
fi
-------------------------------------------------

This script does start on boot (script in init.d and I used the update-rd.d command). But there is two problems : first the script is run on boot AND on shutdown, and I don't want it to run on shutdown. And the second problem is that the script does not save on the usb stick I am using (it's name is A83D-9CDC), but create a folder in the /media folder and save the camera feedback locally. It then open a file named A83D-9CDC_, which is this time the default folder for the USB device.

The line "raspivid -o /media/A83D-9CDC/startupVideo2.h264 -t 10000" is workig fine when run manually, it saves the file on the usb stick.

I did not really understand all of the stuff between ## but as I understood it was required for the script to run on boot.

If someone has any idea to solve my problems, any help will be greatly appreciated =)

Return to “Advanced users”