Home        Store        Docs        Blog

Raspivid tutorial please?


(undersearobotics.com) #1

Could you post a simple, step by step, tutorial for changing the “raspivid” parameters please? I’d like to adjust the frame size and bitrate to minimize video lag. Found some info here but I think a tutorial (for Windows, etc.) would be very helpful.


Bit rate of camera or video
(undersearobotics.com) #2

Found a more complete list of Raspberry Pi camera parameters here.

Still looking for a simple tutorial on how to set these parameters (from a Windows computer)…


(undersearobotics.com) #3

In case anyone else needs help with this, here are the steps taken from notes I took a few months ago:

  1. SSH into the Raspberry Pi with Putty. Host is 192.168.2.2, port is 22, then click connect, then username is ‘pi’, password is ‘raspberry’.

  2. Once you’re in, stop the currently running video stream by typing ‘sudo screen -r video’. Then press Ctrl-C to cancel it. This will bring you back to the command prompt.

  3. Next, type the following command to get to the folder with the video streaming script: ‘cd companion/RPI2/Raspbian/’

  4. You can type ‘ls’ in this folder to list the files. The “start_video.sh” script is used to start the video streaming.

  5. Open that file with the text editor, nano, by typing ‘nano start_video.sh’. Once that opens you can modify the parameters. I’ll describe that later.

  6. Once you are done editing the file, press Ctrl-X to close nano. It will ask if you want to save and you can say yes.

  7. You can restart the video stream for testing by entering ‘./start_video.sh’ to start the script. Press Ctrl-C to stop it and go back to step 5 to re-edit it.

  8. Once you’re done, restart the system and it will automatically re-launch. Let me know what you change if you can find a fix.

Here’s what I’d try changing, in order. Make sure you change the part of the script near the end of the file, which is uncommented.

A. Change the “intra” parameter from 1 to something higher, like 5 or 10. This is how many frames go between keyframes.

B. Change the “mode” from 5 (HD) to 6 (720p cropped) and 7 (480p cropped).

C. Change the “bitrate” from 15000000 to lower, say 5000000.


(Rusty) #4

Hi Paul,

Thanks for posting this and sorry we didn’t get back to it a bit sooner. There’s actually an easier way to do this now in the new ArduSub Companion web interface. If your ROV is fully updated, you should be able to navigate to http://192.168.2.2:2770/camera and see the list of Raspberry Pi camera parameters. You can change them there and relaunch the camera.

That said, the SSH method you learned is incredibly valuable to know so I’m glad you did that!

-Rusty


(undersearobotics.com) #5

@rjehangir - Since the topic has come up several times I think a tutorial (both through the web interface and SSH) would be really helpful.


(Rusty) #6

Paul,

I completely agree. We’ll work on that. The web interface is still in “beta” so we haven’t created much support material for it yet.

-Rusty


(Julian Hancock) #7

Thanks for posting that Paul.


(Jacob) #8

Thanks Paul, I’ll try to put something together. A few notes about your instructions:

They apply to an older version of companion, before the big update a couple months ago. If you are using the newer version, then the command to get to the screen session will be ‘screen -r video’ instead of ‘sudo screen -r video’. The script is now located at ~/companion/scripts/start_video.sh.

In the newer version of companion, there is a webpage that will let you change the camera settings in much fewer steps.

The webpage is at 192.168.2.2:2770/camera. There, you may change the options, then click a button to restart the camera stream with the new options. The options are not persistent between boots when edited through the webpage. W will have an update soon that will make the settings persistent.


(Jacob) #9

The available options for the raspivid command used to operate the raspberry pi camera are documented here.