Video is not working with the camera module


22 posts
by icementhols » Thu May 16, 2013 5:05 pm
Hi all

Any one having issues with recording video ?

Quick overview:

I got my camera module today from farnell.
Installed it into a newly installed and updated/upgraded R-pi (256mb)
Taking an image seem to work fine, though i noticed the light stays on for about 5 secs or so.
When taking a video:
+ if the usb wireless adapter is plugged in it can lose all network connectivity which requires a reboot.
+ if usb wireless is removed it records the video but seems to only capture the first frame of movement then freezes.. video still continues to play (using VLC player) but nothing moves.
+ 5 second file = 10mb

Removed it from the 256 pi and installed it in the 512 pi with memory set to 256 split.. same issues as above.

Anyone experiences similar issues? Anyone have any guidance on troubleshooting this?
--
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
User avatar
Posts: 8
Joined: Wed Sep 19, 2012 8:11 am
Location: Newcastle Upon Tyne
by pluggy » Thu May 16, 2013 5:55 pm
I put it down to me not having X on my Pi I'm testing the camera on. It does the same if I try to use Video. I haven't confirmed that by using one with X. You can lose the 5 second delay by using "-t 0" in the command line.

eg

raspistill -t 0 -o image.jpg -hf
Don't judge Linux by the Pi.......
User avatar
Posts: 2443
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by icementhols » Thu May 16, 2013 6:08 pm
Hmmm. do you mean by not having it running in run level 5?

My 256 install was fresh so im assuming it had X installed :/ puzzling indeed.

Thanks for the cli tips, i'll try those out.
--
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
User avatar
Posts: 8
Joined: Wed Sep 19, 2012 8:11 am
Location: Newcastle Upon Tyne
by pluggy » Thu May 16, 2013 6:19 pm
I have a script that strips out all the X and GUI related stuff from Raspdian to make it take less room on the card, nothing more. I work entirely from the command line. I thought I was an exception and they wouldn't release the camera without testing Video. My camera test bed is a 256 rev1 'B' headless with a wireless dongle. Haven't got round to trying it with X and a screen and stuff.....
Don't judge Linux by the Pi.......
User avatar
Posts: 2443
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by jamesh » Thu May 16, 2013 6:21 pm
The apps should run with or without X. All my testing was on the command line (no X).

The OP's problems may be power related. Running camera and video encode takes another 280mA or so, and that may be exceeding the power available.
Unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11686
Joined: Sat Jul 30, 2011 7:41 pm
by pluggy » Thu May 16, 2013 6:25 pm
Mmmm never thought of power, maybe its time to put a meter across the test points with the camera on. 280mA is a tad greedy.......
Don't judge Linux by the Pi.......
User avatar
Posts: 2443
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by jamesh » Thu May 16, 2013 6:33 pm
pluggy wrote:Mmmm never thought of power, maybe its time to put a meter across the test points with the camera on. 280mA is a tad greedy.......


Most camera are pretty power hungry - they need to do a lot of work - 1080pp0 is a lot of data to first get then throw around. It's interesting to note that the GPU encoder is extremely efficient, and takes less power than the camera itself....
Unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11686
Joined: Sat Jul 30, 2011 7:41 pm
by icementhols » Thu May 16, 2013 6:52 pm
After the comments about the power i checked the adapter that was being used:
output: DC5.2V 500mA max:650mA

Not great eh! so I've now tested it using two different adapters, both having outputs of:0.5V - 1.0A and still the same issue.

edit: also, no wireless adapter connected, just the power adapter, camera and ethernet cable and connecting via ssh to console.

I'm truly flummoxed here.
--
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
User avatar
Posts: 8
Joined: Wed Sep 19, 2012 8:11 am
Location: Newcastle Upon Tyne
by jamesh » Thu May 16, 2013 7:03 pm
icementhols wrote:After the comments about the power i checked the adapter that was being used:
output: DC5.2V 500mA max:650mA

Not great eh! so I've now tested it using two different adapters, both having outputs of:0.5V - 1.0A and still the same issue.

edit: also, no wireless adapter connected, just the power adapter, camera and ethernet cable and connecting via ssh to console.

I'm truly flummoxed here.


It's odd that removing the adapter means things change - there should be no interaction between the USB/networking and the camera code, which is why I thought it might be power related. Can you try a different USB cable with the more powerful supply, just in case one's a bit pants.
Unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11686
Joined: Sat Jul 30, 2011 7:41 pm
by pluggy » Thu May 16, 2013 7:32 pm
Having put a meter across the test points and trying another PSU. I'm convinced its power. My power supply of choice (happy enough to have bought 3 of 'em for Pis) dips fairly convincingly when the camera comes on. It restarts the Pi about half the time just doing stills with the standard preview. The genuine Samsung charger (700mA) which I was using originally doesn't restart doing stills and does video sometimes now I've moved it onto my desk (The wifi is probably using a little less current being nearer to the router). It drops to around 4.5 volts on the meter but usually survives. The other one was a healthy 5.07 volts dripping to 4.8 before it rises to 5.2 when the Pi restarts. The sluggishness of my DMM means there's a lot more to it, when I'm in the mood I'll dig my scope out and have a closer look. Another power supply I have behaves similarly, OK with stills, restarts when doing video. The DMM hints at wild voltage swings. Having got video to work a couple of times with the Samsung PSU with it on my bench, means I am sane, James is sane and its lacklustre power supplies and the high current consumption of the camera/GPU causing the issues.
Don't judge Linux by the Pi.......
User avatar
Posts: 2443
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by pluggy » Thu May 16, 2013 7:41 pm
The same power supplies (1 Amp on the label) are happy running Pis with wifi adaptors and Microsoft USB webcams so they aren't completely pants.
Don't judge Linux by the Pi.......
User avatar
Posts: 2443
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by jamesh » Thu May 16, 2013 7:53 pm
My bench power supply shows a jump of about 200mA when the preview starts, and 260 when recording video, so the camera takes about 200 and the H264 encode takes about 60mA*. I think that 60mA is a market leading figure for 1080p30 encode, and 180-200mA is not unusual for a camera of this type. With the best will in the world, the Raspi Foundation is not responsible for those numbers, no matter how you spin it.

IIRC - these number are approximate but close.
Unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11686
Joined: Sat Jul 30, 2011 7:41 pm
by pluggy » Thu May 16, 2013 8:20 pm
It does take the Pi power supply thing up another notch.....

I reckon the Pi 'B' uses around 380 mA doing average cpu type stuff. My wifi adaptors about 35mA average, shoving an extra 280 mA into the equation shifts the goalposts somewhat.

Time to fire up the 'A' with a camera module I think.....
Don't judge Linux by the Pi.......
User avatar
Posts: 2443
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by icementhols » Thu May 16, 2013 8:24 pm
I tried different cables to no avail. What power adapters are recommended?
--
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
User avatar
Posts: 8
Joined: Wed Sep 19, 2012 8:11 am
Location: Newcastle Upon Tyne
by pluggy » Thu May 16, 2013 8:37 pm
The ones I used to recommend are off Ebay, work perfectly with the Pi 'B' except if you put a camera module on......

I reckon some polyfuses are going to cause issues no matter what power supply / cable you use. Genuine Apple chargers and short thick cables are probably the way to go if you have a camera module (or you cheat like James and use a bench power supply and feed it through the GPIO pins).

I've tried the camera with my 'A' same wifi and power supplies - rock solid stable on video. The 'A' with the camera module will use about the same current as a 'B' without.
Don't judge Linux by the Pi.......
User avatar
Posts: 2443
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by jamesh » Thu May 16, 2013 8:40 pm
icementhols wrote:I tried different cables to no avail. What power adapters are recommended?


Anything with a decent ampage (I'd go for 1A although I get away with my Kindle charger at 0.85) that doesn't fade voltage as the current demand increases.

@The Plugster - I use a bench power supply through the uUSB connector at work and that Kindle charger at home
Unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11686
Joined: Sat Jul 30, 2011 7:41 pm
by tvjon » Thu May 16, 2013 8:41 pm
"280mA is a tad greedy......."

I thought it wasn't bad actually. My DVB-T2 USB tuner stick takes 500.

@OP.

Is this problem with any wifi stick you have, or do you only have 1 to test?

I've just unplugged the ethernet lead, plugged in a Realtech wifi, & recorded video ok. Network access is ok, as I'm posting this now....
Posts: 300
Joined: Mon Jan 07, 2013 9:11 am
by jamesh » Thu May 16, 2013 8:49 pm
I think, when you consider the amount of work being done by the camera and the encoder, 280m is pretty miraculous. Check out how H264 encoding works to get a real idea of the complexity involved!
Unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11686
Joined: Sat Jul 30, 2011 7:41 pm
by pluggy » Thu May 16, 2013 9:01 pm
I've two types of Wifi adaptor at hand I've been testing with a "Comfast" (read cheap no name) with a Realtek 8188CUS chipset. I havent tried the other type with the camera (I have 2 - they're both on Pis I don't want to shut down) but I know its power consumption is very close the Realtek (~35 mA). I could try my 'B' with an ethernet connection as a next step. The 35mA pales into insignificance along side the difference between an 'A' and a 'B' or what the camera module uses.

Its OK James, I'm not criticising how much the camera uses, it uses what it uses, its just going to up the spec/cost of the minimum power supply you can get away with. Other than the image defaulting to backwards (which I believe you've seen the light over ;) ) and issues with my cheap power supplies I think its a fabulous bit of kit.
Don't judge Linux by the Pi.......
User avatar
Posts: 2443
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by pluggy » Thu May 16, 2013 9:22 pm
The absence or otherwise of the wifi adaptor makes no difference to whether the video works or not. It sometimes works on the Samsung and never on the Ebay special. Stills are OK on both. The voltage across the the test points is only 0.03 volts lower with the wifi adaptor vs running on ethernet.
Don't judge Linux by the Pi.......
User avatar
Posts: 2443
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by swisstone » Fri May 17, 2013 7:41 pm
Hi..

I just got my camera and had EXACTLY the same problem... With the camera and a cisco n type wifi adapter I could take static images but the video just made the PI reboot after about 1 second.

The good news is that it was the power supply. I had been using a Nikon camera charger plug outputting .55A
I changed it for an old ipaq HP plug that outputs 1A - Suddenly everything is stable and working without issues.
:D Lets take some pictures......
Loads of Raspberry Pie for everyone @ http://www.rpie.co.uk
User avatar
Posts: 8
Joined: Fri May 17, 2013 7:36 pm
Location: Norfolk UK
by icementhols » Sat May 18, 2013 7:32 am
This is good news, I'll have a look at getting a new power supply / cable set and see if that does the trick.
--
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
User avatar
Posts: 8
Joined: Wed Sep 19, 2012 8:11 am
Location: Newcastle Upon Tyne