User avatar
JBAnovling
Posts: 14
Joined: Sun May 19, 2013 6:22 am
Location: Denmark

My Quadcopter with Raspberry Pi Camera

Mon May 20, 2013 9:56 pm

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.
More of my videos on http://www.youtube.com/user/JBAnovling

User avatar
joan
Posts: 16159
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: My Quadcopter with Raspberry Pi Camera

Mon May 20, 2013 10:08 pm

Impressive!

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2876
Joined: Sat Mar 03, 2012 11:57 am
Location: UK

Re: My Quadcopter with Raspberry Pi Camera

Mon May 20, 2013 10:20 pm

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 :)
Alex Eames RasPi.TV, RasP.iO

User avatar
recantha2
Posts: 384
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire

Re: My Quadcopter with Raspberry Pi Camera

Tue May 21, 2013 3:33 am

Excellent stuff :-)
--
Michael Horne - @recantha on Twitter
Raspberry Pi Pod blog - http://www.recantha.co.uk/blog
Cambridge Raspberry Jam - https://camjam.me
Pi Wars - https://piwars.org

Hardware_man
Posts: 94
Joined: Tue Dec 04, 2012 6:28 pm

Re: My Quadcopter with Raspberry Pi Camera

Tue May 21, 2013 2:03 pm

How much compression were you using? Am I correct that you recorded this to the SD card on the Pi board?

Hardware_man

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 32227
Joined: Sat Jul 30, 2011 7:41 pm

Re: My Quadcopter with Raspberry Pi Camera

Tue May 21, 2013 2:46 pm

Looking at the youtube vid, I think the re-compression has really stuffed the picture quality - it should be much clearer than that.
Principal Software Engineer at Raspberry Pi Ltd.
Working in the Applications Team.

JeffR
Posts: 1
Joined: Tue May 21, 2013 6:16 pm

Re: My Quadcopter with Raspberry Pi Camera

Tue May 21, 2013 6:18 pm

Really nice. Have you posted more information on the hardware and software setup somewhere?

User avatar
JBAnovling
Posts: 14
Joined: Sun May 19, 2013 6:22 am
Location: Denmark

Re: My Quadcopter with Raspberry Pi Camera

Tue May 21, 2013 6:36 pm

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. :?
More of my videos on http://www.youtube.com/user/JBAnovling

Hardware_man
Posts: 94
Joined: Tue Dec 04, 2012 6:28 pm

Re: My Quadcopter with Raspberry Pi Camera

Wed May 22, 2013 2:38 pm

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

tvjon
Posts: 846
Joined: Mon Jan 07, 2013 9:11 am

Re: My Quadcopter with Raspberry Pi Camera

Wed May 22, 2013 3:27 pm

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?

cabe
Posts: 24
Joined: Sun Jan 08, 2012 2:54 pm

Re: My Quadcopter with Raspberry Pi Camera

Wed May 22, 2013 4:23 pm

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!

User avatar
JBAnovling
Posts: 14
Joined: Sun May 19, 2013 6:22 am
Location: Denmark

Re: My Quadcopter with Raspberry Pi Camera

Wed May 22, 2013 6:07 pm

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
More of my videos on http://www.youtube.com/user/JBAnovling

Hardware_man
Posts: 94
Joined: Tue Dec 04, 2012 6:28 pm

Re: My Quadcopter with Raspberry Pi Camera

Thu May 23, 2013 2:44 pm

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

User avatar
JBAnovling
Posts: 14
Joined: Sun May 19, 2013 6:22 am
Location: Denmark

Re: My Quadcopter with Raspberry Pi Camera

Thu Jun 06, 2013 2:37 pm

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...
More of my videos on http://www.youtube.com/user/JBAnovling

gordon77
Posts: 7134
Joined: Sun Aug 05, 2012 3:12 pm

Re: My Quadcopter with Raspberry Pi Camera

Thu Jun 06, 2013 3:26 pm

Does the focus need changing to improve the shots in the air ?

Gordon77

towolf
Posts: 421
Joined: Fri Jan 18, 2013 2:11 pm

Re: My Quadcopter with Raspberry Pi Camera

Thu Jun 06, 2013 3:45 pm

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.
Last edited by towolf on Thu Jun 06, 2013 3:51 pm, edited 2 times in total.

towolf
Posts: 421
Joined: Fri Jan 18, 2013 2:11 pm

Re: My Quadcopter with Raspberry Pi Camera

Thu Jun 06, 2013 3:47 pm

gordon77 wrote:Does the focus need changing to improve the shots in the air ?
I think that's motion blur.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 32227
Joined: Sat Jul 30, 2011 7:41 pm

Re: My Quadcopter with Raspberry Pi Camera

Thu Jun 06, 2013 3:58 pm

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!
Principal Software Engineer at Raspberry Pi Ltd.
Working in the Applications Team.

Hardware_man
Posts: 94
Joined: Tue Dec 04, 2012 6:28 pm

Re: My Quadcopter with Raspberry Pi Camera

Thu Jun 06, 2013 4:21 pm

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

towolf
Posts: 421
Joined: Fri Jan 18, 2013 2:11 pm

Re: My Quadcopter with Raspberry Pi Camera

Thu Jun 06, 2013 4:29 pm

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.

User avatar
JBAnovling
Posts: 14
Joined: Sun May 19, 2013 6:22 am
Location: Denmark

Re: My Quadcopter with Raspberry Pi Camera

Thu Jun 06, 2013 9:29 pm

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...
.
More of my videos on http://www.youtube.com/user/JBAnovling

towolf
Posts: 421
Joined: Fri Jan 18, 2013 2:11 pm

Re: My Quadcopter with Raspberry Pi Camera

Thu Jun 06, 2013 10:27 pm

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/.

User avatar
JBAnovling
Posts: 14
Joined: Sun May 19, 2013 6:22 am
Location: Denmark

Re: My Quadcopter with Raspberry Pi Camera

Mon Jun 17, 2013 9:16 am

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
More of my videos on http://www.youtube.com/user/JBAnovling

towolf
Posts: 421
Joined: Fri Jan 18, 2013 2:11 pm

Re: My Quadcopter with Raspberry Pi Camera

Mon Jun 17, 2013 10:22 am

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?

badgerpi
Posts: 9
Joined: Mon Jun 10, 2013 11:18 am

Re: My Quadcopter with Raspberry Pi Camera

Mon Jun 17, 2013 11:30 am

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.

Return to “Camera board”