Page 1 of 2

My Quadcopter with Raspberry Pi Camera

Posted: Mon May 20, 2013 9:56 pm
by JBAnovling
I just finished my new Quadcopter and on the first flight I tested the Raspberry Pi Camera (1080p @ 30fps) vs my old 808 keychain cam.
( Sorry for the shaky video! The quad is not "PID tuned" yet. (My first flight with this quad). )

http://youtu.be/-dReyGvzAQw

:) Can't wait to get the quad PID tuned :) Then the shakiness will go away.

Re: My Quadcopter with Raspberry Pi Camera

Posted: Mon May 20, 2013 10:08 pm
by joan
Impressive!

Re: My Quadcopter with Raspberry Pi Camera

Posted: Mon May 20, 2013 10:20 pm
by alexeames
Nice one. You could strip the sound from the keychain cam and use that with the video from the PiCam. You're the first I've seen to put one in a quad. I plan to do it later in the year, but I don't have a quad yet. I do have planes though, but I reckon a quad will be ideal for AV :)

Re: My Quadcopter with Raspberry Pi Camera

Posted: Tue May 21, 2013 3:33 am
by recantha2
Excellent stuff :-)

Re: My Quadcopter with Raspberry Pi Camera

Posted: Tue May 21, 2013 2:03 pm
by Hardware_man
How much compression were you using? Am I correct that you recorded this to the SD card on the Pi board?

Hardware_man

Re: My Quadcopter with Raspberry Pi Camera

Posted: Tue May 21, 2013 2:46 pm
by jamesh
Looking at the youtube vid, I think the re-compression has really stuffed the picture quality - it should be much clearer than that.

Re: My Quadcopter with Raspberry Pi Camera

Posted: Tue May 21, 2013 6:18 pm
by JeffR
Really nice. Have you posted more information on the hardware and software setup somewhere?

Re: My Quadcopter with Raspberry Pi Camera

Posted: Tue May 21, 2013 6:36 pm
by JBAnovling
Thanks for the reply's :-)

Your right about the re-compression. The original looks better than the youtube edition.
Especially if I play it on a full HD television :-)
I have uploaded the original file here:
http://www.filedropper.com/20130520081721
( I don't know where else to put a 119 MB file...... )

Keep in mind that the video is very shaky during the flight!
The quad struggling to stay in the air because of bad/non PID-tuning. :?

Re: My Quadcopter with Raspberry Pi Camera

Posted: Wed May 22, 2013 2:38 pm
by Hardware_man
Three quick things:

1. In audio work, the $20 word is “tandem coder artifacts”. That’s when you compress an audio file with a “perceptual” coder, expand the file back to PCM and then compress it again with a different perceptual coder. The results are never good.

2. What advice for “big dummies” do you have to view your 119MB file? I clicked on the link and it instantly wanted to download new XP drivers. I certainly don’t want to do that! How do I download your file without the download site screwing with my computer?

3. What flight board are you using?

Hardware_man

Re: My Quadcopter with Raspberry Pi Camera

Posted: Wed May 22, 2013 3:27 pm
by tvjon
You need a mpeg4 codec for media player, or whatever you use on your pc. No "driver" as such.

Why not play it via omxplayer on your RPi?

Re: My Quadcopter with Raspberry Pi Camera

Posted: Wed May 22, 2013 4:23 pm
by cabe
VLC is the defacto media player of choice.

http://www.videolan.org/index.html

Gimmie a bout 5 mins and I will tell you if it plays in that :)

Stupid slow work internet.

UPDATE : works a charm, the file is good here.

Hop.....Hop.....Hop.....AIRBORNE!

Re: My Quadcopter with Raspberry Pi Camera

Posted: Wed May 22, 2013 6:07 pm
by JBAnovling
Hardware_man wrote:How much compression were you using? Am I correct that you recorded this to the SD card on the Pi board?
Yes it was recorded to the SD card (class 6 sanDisk 8 GB) using the this command:
(Added in the /etc/rc.local file, to get the recording to start automatically)
raspivid -o $(date +"%Y%m%d%H%M%S").h264 -t 60000 -vf -fps 30
Hardware_man wrote:3. What flight board are you using?
I'm using the HobbyKing MultiWii Mega Board WITH MTK 3329 GPS.
More info on this hardware in this forum:
http://www.rcgroups.com/forums/showthread.php?t=1726790
The software is Arduino-code called Multiwii:
http://code.google.com/p/multiwii/
My future goal is to transfer data from the MultiWii Mega Board via the UART to the Raspberry Pi, so I can add some GPS-data and other info direct to the video recored from the Pi Cam :D
More on that issue here: (How to add text-overlay with raspivid?)
http://www.raspberrypi.org/phpBB3/viewt ... 43&t=44474
cabe wrote:Hop.....Hop.....Hop.....AIRBORNE!
He he :D I'm a total beginner in flying a Quad :D

Re: My Quadcopter with Raspberry Pi Camera

Posted: Thu May 23, 2013 2:44 pm
by Hardware_man
Thanks,

I fly an MK based Quad and am very interested in what you are doing.

What is the trick to downloading your video file without the site trying to download new XP drivers?

Hardware_man

Re: My Quadcopter with Raspberry Pi Camera

Posted: Thu Jun 06, 2013 2:37 pm
by JBAnovling
Just adding my new quad video recorded with the Raspberry Pi Camera :)

http://youtu.be/rU4-ysROEDw

I need some form of vibration damping for my Raspberry Pi Camera. The video quality is super on the ground and bad i the air. I also guess that if the camera was more wide angle, the video wouldn't suffer as much from vibrations... :idea: I will try to stick a ebay 180° Fish Eye Lens to the Camera next time...

Re: My Quadcopter with Raspberry Pi Camera

Posted: Thu Jun 06, 2013 3:26 pm
by gordon77
Does the focus need changing to improve the shots in the air ?

Gordon77

Re: My Quadcopter with Raspberry Pi Camera

Posted: Thu Jun 06, 2013 3:45 pm
by towolf
In addition to physically damping the module you could look into image based stabilization. Did you try clicking that button on Youtube? Their algorithm is very good, in particular at canceling rolling shutter effects. Then raspivid has an option --vstab that does the same thing, but perhaps less sophisticated.

Finally if you want to fine-tune stabilization there's deshaker plugin for VirtualDub and vid.stab for Linux.

Of course all those tend to make the FoV even smaller by cropping away the undefined parts of the image. What would help a lot is the fabled 2x2 binned imaging mode that uses the whole sensor and not a central 1080 crop (compare stills to video to see how striking the difference is).

You could also try to increase the video bitrate because a bitrate that is sufficient for highly static images may not be enough to encode highly jerky video where every frame differs from the previous one.

Re: My Quadcopter with Raspberry Pi Camera

Posted: Thu Jun 06, 2013 3:47 pm
by towolf
gordon77 wrote:Does the focus need changing to improve the shots in the air ?
I think that's motion blur.

Re: My Quadcopter with Raspberry Pi Camera

Posted: Thu Jun 06, 2013 3:58 pm
by jamesh
The VS option only does left right up down stabilisation, not rotation, and I think uses about 5% of the image at the edges - I'd need to check the numbers. Assuming it's turned on in the tuning of course - I never checked!

Re: My Quadcopter with Raspberry Pi Camera

Posted: Thu Jun 06, 2013 4:21 pm
by Hardware_man
This is why I was asking specifically about the H.264 parameters you are using. I don’t know how to relate the command line you posted above to the exact H.264 parameters.

Some parameters tell H.264 to interpolate. In other words, it only sends a few actual frames per second and creates the other frames by interpolating. I think it is called I frames and P frames (or something like that). This is how H.264 gets high compression ratios. But you can tell H.264 to specifically not do that, send each frame. You will of course get lower compression ratios.

But you are limited by the flight time of the battery capacity. So I would play with lower compression ratios and fill up the SD card in one flight. I think that would make the video look less shaky. And as JamesH said, you recompress when you upload to You Tube.

Hardware_man
www.linkedin.com/pub/martin-risso/71/599/a09

Re: My Quadcopter with Raspberry Pi Camera

Posted: Thu Jun 06, 2013 4:29 pm
by towolf
Hardware_man wrote:I think that would make the video look less shaky.
It would still be shaky but more crisp. And a stabilization algorithm will work much better with crisp frames.

You can get faithful video even with P frames. It's just a matter of throwing more bits at it. So if this is recorded in 1080p, try going with -b 20000000 to -b 30000000.

Re: My Quadcopter with Raspberry Pi Camera

Posted: Thu Jun 06, 2013 9:29 pm
by JBAnovling
I have just tested some of your suggestions while I was practicing flying my quad in the sunset. :)
I'm now using raspivid with the following command:
raspivid -o testvideo.h264 -t 240000 -vf -fps 30 -vs -b 30000000 -ex antishake -awb sun

(-vs -b 30000000 -ex antishake -awb sun) is the new parameters in this video.

http://youtu.be/5_YGPzjwymU (The Youtube antishake is not tuned on in this video.(I'm not a big fan of it))

I now think that the raw h264 looks better when I play it in VLC on my computer. When I pause the video in VLC the image isn't as shaken as it was before.
Snapshot from the video here: Image :D I Can See My House From Here :lol:
http://www.element14.com/community/serv ... 58s230.png

Another thing is that i'm flying in the sunset... I think that the camera will have at better chance capturing video on a sunny midday...
.

Re: My Quadcopter with Raspberry Pi Camera

Posted: Thu Jun 06, 2013 10:27 pm
by towolf
Looks quite good. So I know people say the Youtube stabilizer makes them sick due to the warping, but would you mind uploading that same source video again and then enabling the Youtube stabilizer?

I’m really curious how it will deal with this video. See these examples. Would be fun to see both versions side-by-side using http://www.youtubedoubler.com/.

Re: My Quadcopter with Raspberry Pi Camera

Posted: Mon Jun 17, 2013 9:16 am
by JBAnovling
towolf wrote:Looks quite good. So I know people say the Youtube stabilizer makes them sick due to the warping, but would you mind uploading that same source video again and then enabling the Youtube stabilizer?

I’m really curious how it will deal with this video. See these examples. Would be fun to see both versions side-by-side using http://www.youtubedoubler.com/.
Here is the same video with Youtube anti shake.
http://youtu.be/yBDNF9ajUzA

I was forced to paste another video at the end of it, using ffmpeg, to get youtube to approve the video.
Otherwise Youtube rejected the video as a duplicate of the original video.
I do not think that Youtube's anti shake works very well in this test.... It also seems that youtube has changed something about lighting

Re: My Quadcopter with Raspberry Pi Camera

Posted: Mon Jun 17, 2013 10:22 am
by towolf
Interesting, here’s them playing side-by-side: http://youtubedoubler.com/8FwK

So the vibrations and resonance frequencies defeated the rolling shutter compensation, it’s even more wobbly than before. That is something that damping might fix maybe.

But in some places it certainly stabilizes better, like when it is hovering and moving towards the pilot.

What happened to the colors? Did you click the other autofix button as well?

Re: My Quadcopter with Raspberry Pi Camera

Posted: Mon Jun 17, 2013 11:30 am
by badgerpi
Have you tried balancing the rotors ?

I have a Parrot AR Drone, and have seen a good improvement in video footage quality by balancing all 4 rotors.
Some others on the Parrot forums have taken a bit more time to get their balancing 100% perfect, and the video quality is superb - no vibration at all.