Raspivid tutorial please?

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.

1 Like

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)…

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.

3 Likes

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

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

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

Thanks for posting that Paul.

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.

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

Hello everyone,
I came to this post because I need to rotate the raspberry camera 180 degrees.
But the first problem I have is that I can’t connect to the companion computer via ssh. I am using putty but it denies me access with the password “raspberry”, could it be that the companion has another password? it is version 0.0.31. The connection is good, I can arm and disarm, and control the motors.
It is important to say that I had never done the ssh.
I would like to be able to fix the ssh issue and on the other hand rotate the image. Regarding the latter, is there any way to do it from http://192.168.2.2:2770/camera?
Thanks a lot!

Hi @pmn,

More recent versions of the Companion software use the password companion.

raspivid does seem to have a rotation command, so I would suggest trying to add --rotation 180 to see if it achieves your aim :slight_smile:


Note that this is specific to the Raspberry Pi camera - raspivid is not used when streaming from a USB camera, and this kind of image manipulation would need to be supported directly by the camera to function.

Eliot, thank you very much for the help!!!

Hello,
I share the tests I did in case they are useful.
I modified rpicamera.param with --rotation 180 ( supposedly identical to --hflip --vflip according to Raspberry Pi Documentation - Camera ). But after a reset this did not work. So I don’t know if the rpicamera.param file will actually be used in the companion setup.
rpicam

But finally I was able to rotate the image simply at http://192.168.2.2:2770/camera, setting Horizontal Flip and Vertical Flip to on.
flip

Thank you and good luck!

1 Like