birv2
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 115
Joined: Sat May 16, 2015 2:07 pm

Newbie can't get video to work

Thu Mar 09, 2017 1:45 pm

Using official camera module v2, Wheezy on PiNet.
RP3
Python3
Here's the code I'm using:

from picamera import PiCamera
camera = PiCamera()

camera. start_preview(alpha = 200)
camera.start_recording('video.h264')
time.sleep(10)
camera.stop_recording()
camera.stop_preview

Still pix work fine.

TIA,
Bob Irving

fruitoftheloom
Posts: 20194
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Newbie can't get video to work

Thu Mar 09, 2017 2:04 pm

Removed confusing response
Last edited by fruitoftheloom on Thu Mar 09, 2017 2:23 pm, edited 1 time in total.
adieu

Asus CS10 Chromebit / HP Envy 4500 Wireless Printer / Raspberry Pi Model 2B v1.1 / RealVNC Software...

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7026
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Newbie can't get video to work

Thu Mar 09, 2017 2:14 pm

birv2 wrote:Using official camera module v2, Wheezy on PiNet.
On Wheezy? Have you an even vaguely recent firmware? Support for the V2 camera was only added April 2016 so anything before that will fail.
"vcgencmd version" will report back the date.
"vcgencmd get_camera" will report back whether the GPU can find the camera. If it can't then it'll either be the firmware or the physical connection to the camera.

You probably also want to check that your userland repo (contains the raspistill and raspivid apps) is vaguely up to date.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

fruitoftheloom
Posts: 20194
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Newbie can't get video to work

Thu Mar 09, 2017 2:26 pm

PiNet is based of Wheezy, maybe you could try the Jessie based PiNet which is still in Testing Status ?

http://pinet.org.uk/articles/wheezy-jessie.html
adieu

Asus CS10 Chromebit / HP Envy 4500 Wireless Printer / Raspberry Pi Model 2B v1.1 / RealVNC Software...

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7026
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Newbie can't get video to work

Thu Mar 09, 2017 2:36 pm

If the PiNet distro is using https://github.com/PiNet/PiNet-Boot/tree/master/boot (linked from fruitoftheloom's link) as the boot directory, then the last firmware update was 8th April 2016 - ouch!
Sorry, you're not going to get the V2 camera working on that as it was released on 25th April 2016.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
waveform80
Posts: 303
Joined: Mon Sep 23, 2013 1:28 pm
Location: Manchester, UK

Re: Newbie can't get video to work

Thu Mar 09, 2017 2:37 pm

birv2 wrote:Using official camera module v2, Wheezy on PiNet.
RP3
Python3
Here's the code I'm using:

from picamera import PiCamera
camera = PiCamera()

camera. start_preview(alpha = 200)
camera.start_recording('video.h264')
time.sleep(10)
camera.stop_recording()
camera.stop_preview
Hi Bob,

Would I be right in thinking that you're using IDLE3 (the graphical Python interface)? In that case, there's one little bug in your code which won't prevent it recording video but will appear to make your script fail to end:

The last line is camera.stop_preview rather than camera.stop_preview(). The lack of parentheses just mean that you're effectively asking Python "is there a stop_preview method?" rather than "execute the stop_preview method". In the IDLE environment, the preview doesn't automatically terminate at the script end because the IDLE keeps the Python environment that the script ran in alive (which keeps the camera object alive, which keeps the preview alive).

So (assuming you're using IDLE): your script has recorded video, and it has terminated successfully, but the preview's still going (because stop_preview hasn't been called, just referenced) so you think it's hung.

Anyway, that's my best guess for now!

Dave.

birv2
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 115
Joined: Sat May 16, 2015 2:07 pm

Re: Newbie can't get video to work

Thu Mar 09, 2017 4:58 pm

Thanks for all the replies.

@waveform80 -- that was my fault on the parens. My original code has them.

Perhaps a Wheezy vs Jessie issue. My plan is to update PiNet to Jessie over the summer. Maybe I'll have to move that timeline up....

Bob

Return to “Camera board”