Saving video stream to sd card in Beaglebone?


#1

Hello everybody,

I was wondering if its possible to record video using the usb camera and save it on the Beaglebone's sd card. I know this topic has been discussed before, but its been a while since then and I was wondering if there are any updates.

This is what I've tried so far:

- I tried running OpenCV using Derek Molloy's tutorial on how to record video using the beaglebone, but I get a response saying "Device or Resource Busy" even when the camera was not streaming.

- I tried using other OpenCV codes, but I get the "Can not open display" error, which I guess is because we have no display connected to the Beaglebone.

What I am currently trying:

- I have installed VLC on the OpenROV image, but I am still getting errors because of no display available. I have looked over the internet and have not found any way to record a video stream without a display.

Any help would be appreciated. I need to be able to record video using the OpenROV for my research, and I'm running out of time. Thank you.


#2

Checkout the output_file.so option of mjpeg_streamer. http://skillfulness.blogspot.com/2010/03/mjpg-streamer-documentation.html


#3

Thank you for your reply. I have tried issuing the following command:

./mjpg_streamer -o "/usr/local/lib/output_http.so -w `pwd`/www" -o "/usr/local/lib/output_file.so -f pics -d 15000"

But I get the following output:

MJPG Streamer Version: svn rev:
o: www-folder-path...: /usr/local/bin/www/
o: HTTP TCP port.....: 8080
o: username:password.: disabled
o: commands..........: enabled
o: ERROR: the 0 input_plugin number is too much only 0 plugins loaded
output_init() return value signals to exit

Also, when I run other commands such as ./mjpg_streamer -o "output_http.so -w ./www" I get the following response:

MJPG Streamer Version: svn rev:
o: www-folder-path...: ./www/
o: HTTP TCP port.....: 8080
o: username:password.: disabled
o: commands..........: enabled
bind: Address already in use

I get this error even when the cockpit is closed and I am not streaming video (unless the streaming is still running on the background).

Any ideas?


#4

You still need the -i part of the mjpegstreamer options. I'll be firing up an ROV later today and will verify the command if that does not do it for you.

The input part of the command:

-i "/usr/local/lib/input_uvc.so -d /dev/video0 -r 1900x1080 -f 10"


#5

Ok, I finally got it. I used the following command:

sudo wget -O slime$i.mjpg --user rov --password OpenROV http://IP.ADDRESS:8090/?action=stream &

I replaced IP.ADDRESS with the IP Address of the OpenROV.

The problem with this is that it creates a mjpg file that is huge in size for just a few seconds of video. Any suggestions to make the filze size smaller? Or were you able to use mjpg_streamer to record the video?


#6

So it turns out mjpeg streamer plugins that ship with the product can only generate the individual jpeg images at the specified time interval. So the following command will put the image in the pics folder once every 15 seconds:

sudo mjpg_streamer -i "/usr/local/lib/input_uvc.so -d /dev/video0 -r 1900x1080 -f 10" -o "/usr/local/lib/output_http.so -p 8090" -o "/usr/local/lib/output_file.so -f pics -d 15000"

You can then use a tool to turn those back in to a mjpeg video stream. I have not used these yet myself so I recommend a google search, but this is a link to one of those sort of tools: http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-enc-images.html

As for your concern on size. How big is big? Each jpeg image is roughly 1.4MB. The system be default is streaming at 10fps. So 14MB/s should be about right.

-Brian


#7

Hey Patrick,

On making smaller video. At the moment my suggestion is to cut back on the frame rate to reduce video size. I suppose you can experiment with using ffmpeg to compress the mjpeg images in to a video compression format. Longer term, we are working on integrating cameras that do hardware based compression that will make capturing video onboard the ROV a lot easier.

Let us know if you find a better solution!

-Brian


#8

Hey Brian,

A 2 second capture is roughly 12MB, . I was able to reduce the size of the file by half by using the --wait=5 (which I believe makes wget wait 5 seconds between each retrieval), but I haven't checked how the video looked yet.

And yes, I did use ffmpeg and/or avconv to convert the file to an mp4 which reduces the size to 5MB for the 2 second video, but the beaglebone takes really long to make this compression. I will run some more tests later this week and see if I can come up with something better.

-Patrick


#9

This reply is probably way too late to be of use, but couldn't you record from your topside browser? There's a free Chrome plugin:

https://chrome.google.com/webstore/detail/screencastify-screen-vide/mmeijimgabbpbgpdklnllpncmdofkcpn?hl=en


#10

Nice! I'd be curious to see if that Chrome plug-in works. It looks like a video screen capture.


#11

Thank you for your reply Andrew! That sounds like a good idea, but what we want is to record and store the files locally (on the Beaglebone itself). We are trying to make the OpenROV autonomous, so in other words we wouldn't have access to the stream.


#12

?

Why would you not want to access the stream? Surprise value?


#13

Haha the surprise value is an added bonus. But our idea for an autonomous OpenROV means getting rid of the tethered cable, which would also mean getting rid of the stream.

It's not that we don't want access to the stream, but without the tethered cable, we can't have access to it.


#14

Understood.

I am new to this whole ROV thing, but I am not new to drones. I understand the differences, but if I was able to put a wire on a drone that would hold it in the air for me, I'd do it in a minute. Neither a drone nor an ROV are cheap and that tether is just good insurance. Juss sayin'...


#15

How the recording works in new image? how to save mjpeg streamer to video file?