ormapper
Posts: 1
Joined: Tue Feb 04, 2014 1:53 pm

Re: Pure Python camera interface

Tue Feb 04, 2014 2:57 pm

I've got a project where I need to trigger my Pi camera using a GPS at 1hz. I'm new to Pi and pretty new to python but thought this interface looked nice and straightforward.I've been trying to do some testing without the GPS just to see how to initiate a capture every second but can't quite seem to figure it out. The existing methods for this interface don't quite seem to have what I need but are so close and are so accessible I'm hoping someone here can provide some guidance.

EDIT: I've tried to implement this using Threading but have run into an error "PiCameraMMALError: Failed to create connection: Port is already connected" after the code below has executed for about 40 seconds.

Code: Select all

def capture(): ##do the camera capture
        camera.capture('z_%s.jpg'% str(time.time()),format='jpeg',quality=100,thumbnail=None)

if __name__ == '__main__':
        with picamera.PiCamera() as camera:        
            camera.resolution = (1600,1200) # 2 MP
            #Give camera warm up time
            time.sleep(2)
            #simluate GPS trigger at 1hz 
            for i in range (0,60):
                Thread (target = capture).start()
                time.sleep(1)                
        print 'finished at: %s'% str(time.time())
I don't know exactly what that means but it seems like the capture hasn't completed yet or something so there is a conflict. What seems odd is that if I just run this:

Code: Select all

def camcapture():
    camera.capture('z_%s.jpg'% str(time.time()),format='jpeg',quality=100,thumbnail=None)
with picamera.PiCamera() as camera:
    camera.resolution = (1600,1200) # 2 MP
    for i in range (0,60):
        camcapture()
I can capture 60 frames and the timestamps on the images show that the capture start between frames is under 1sec. So I'm not sure why I get the error when trying to use threads to kick off a capture at 1sec intervals.

User avatar
Marcos.Scholl
Posts: 31
Joined: Wed Feb 05, 2014 7:12 pm
Location: Brasil

Re: Pure Python camera interface

Mon Feb 10, 2014 1:55 pm

Hello waveform80.
I have a problem that I believe can help me .

I bought a camera module and tried to make it work with OpenCV . Did not work , then discovered he needed V4L2 , I installed and ran my code in OpenCV .

Well, the camera image appeared , but not within a frame , and yes, "outside" the system.

Googled and found this your system, Picamera . I was pleased as punch that finally had a solution . I ran the code "Start a preview for 10 seconds with the default settings:" but is the same problem I saw with OpenCV .
Image
http://imageshack.com/a/img844/156/g1ch.jpg

This is outside the resolution of the screen RaspbianOS . I need the preview , stay within a frame that had its adjustable size. This is possible ?

Sorry for my English and for being beginner both Rasp as in Python .

Can you guide me? I'm totally lost as to technical factors .

What adjustments should I do to get a good view , something around 20 fps in 720p resolution and within a frame of a 740x620 .

Sorry abuse , but the saw you have a great knowledge about these factors . :D

[email protected]

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

Re: Pure Python camera interface

Mon Feb 10, 2014 2:28 pm

Hi Marcos,
Marcos.Scholl wrote:Hello waveform80.
This is outside the resolution of the screen RaspbianOS . I need the preview , stay within a frame that had its adjustable size. This is possible ?
This isn't (directly) possible with the camera's preview system. The preview doesn't appear within a frame in the GUI. For that matter, it has nothing to do with the GUI at all - you can run the preview from the command line environment before you ever start X-windows. In fact you can even start the preview when logged in remotely over SSH before a framebuffer is available!

What's actually going on (as I understand it, and I should stress I'm not the expert on this - that'd be jamesh) is that starting the preview causes the GPU to simply render the preview over whatever is on the screen. To the best of my knowledge there's no way to get the preview to sit within a window or frame in X-windows because the preview system doesn't even know X-windows is there.

Now, having said that, there are some things you can do to "fake it"...
Marcos.Scholl wrote:What adjustments should I do to get a good view , something around 20 fps in 720p resolution and within a frame of a 740x620 .
The picamera library (and the mmal library it's based upon) does provide ways to reposition and resize the area of the screen that the preview overlays. In the case of picamera, set the preview_fullscreen property to False, and then the preview_window property to the (x, y, width, height) that you wish to preview to cover. Those coordinates are in screen coordinates for the Pi, so if you're running at 1080p and you want the preview to be 740x620 in the middle of the screen, you'd do something like:

Code: Select all

camera.preview_fullscreen = False
camera.preview_window = (1920/2-740/2, 1080/2-620/2, 740, 620)
Obviously that's not exactly what you're asking for - i.e. it's not within an X-windows frame, but you could position an X-windows frame "around" the area set for the preview (hence why I say this is "faking it"). You can also adjust things like the preview opacity if you want to display things "behind" the preview.

I should also note in future releases, it *may* be possible to render things on top of the preview via OpenGL/ES - this is something I'm looking into, but at the moment only raspistill/raspivid offer these capabilities.

Dave.

User avatar
Marcos.Scholl
Posts: 31
Joined: Wed Feb 05, 2014 7:12 pm
Location: Brasil

Re: Pure Python camera interface

Mon Feb 10, 2014 8:31 pm

Big Dave !
You have just one form or another solving my problem later on.

Let me explain .

I would make a camera connected to a Rasp for an ROV , she would internally in ROV and she would communicate via network with other Rasp , where these images and send this Rasp who will be on the surface would display these images .

Well , I read your Picamera documentation and found the session "4.12. Recording to a network stream" First I want to tell you that I did not think it would be a solution for the simplicity of the code , but when I performed using VLC was like magic to my eyes !

It was exactly what I needed ! \ o /

I'll run longer and do some more testing , I found that since the console was returned with an error .

I can format the image coming from the camera, on the client while it is instantiated by the method "picamera.PiCamera() as camera" , using the methods available for "camera " ?

Can you tell me some other player besides VLC and MPlayer , which work well with streaming ?

Thank you very much . I will keep using the Picamera and pestering you when any questions arise ! : D
Won a Fan !

donde1
Posts: 6
Joined: Tue Feb 11, 2014 4:46 am

Re: Pure Python camera interface

Tue Feb 11, 2014 5:22 am

Using RPi Model A and latest Raspbian 2014-02-07. RPi Camera is attached and I know it works. Did Python 2.7+ Installation, and then Quick Start. I copied the 1st code example into IDLE. When I got to camera = picamera.PiCamera()
and hit Return, I saw error below. I then did sudo apt-get update and upgrade, then sudo rpi-update. I tried to enter the code again and got the same error below.
I don't know how to proceed.

Code: Select all

Python 2.7.3 (default, Jan 13 2013, 11:20:46) 
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> import time
>>> import picamera
>>> 
>>> camera = picamera.PiCamera()

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    camera = picamera.PiCamera()
  File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 245, in __init__
    self._init_camera()
  File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 276, in _init_camera
    prefix="Failed to create camera component")
  File "/usr/lib/python2.7/dist-packages/picamera/exc.py", line 112, in mmal_check
    raise PiCameraMMALError(status, prefix)
PiCameraMMALError: Failed to create camera component: Out of memory
>>> 

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

Re: Pure Python camera interface

Tue Feb 11, 2014 12:45 pm

Hi Marcos,
Marcos.Scholl wrote:I would make a camera connected to a Rasp for an ROV , she would internally in ROV and she would communicate via network with other Rasp , where these images and send this Rasp who will be on the surface would display these images .
That sounds like a fascinating project - certainly the first time I've heard of anyone putting a Pi in an ROV!
Marcos.Scholl wrote:Well , I read your Picamera documentation and found the session "4.12. Recording to a network stream" First I want to tell you that I did not think it would be a solution for the simplicity of the code , but when I performed using VLC was like magic to my eyes !

It was exactly what I needed ! \ o /

I'll run longer and do some more testing , I found that since the console was returned with an error .

I can format the image coming from the camera, on the client while it is instantiated by the method "picamera.PiCamera() as camera" , using the methods available for "camera " ?
I'm guessing you want to overlay some sort of information on the video feed? Technically this might be possible with the OpenGL/ES layers I mentioned in passing above, but note that there's no direct support for these in picamera (yet) - I think raspistill/raspivid and libmmal are the only ones that support it at the moment, although there was one guy who got something like this working with picamera.

That said, I suspect you'd be better off opening two network connections from the Pi to the surface, one for video, one for the other data you want to send, and then doing the overlay on the surface where you'll doubtless have a much more powerful machine than a Pi.
Marcos.Scholl wrote:Can you tell me some other player besides VLC and MPlayer , which work well with streaming ?
Erm - not off the top of my head, unless you count XBMC (but that's more for streaming pre-recorded stuff - I'm not sure it'd be of much use in this scenario). Any particular reason you need something different to VLC or mplayer? Or is there something you're finding neither will do?


Dave.

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

Re: Pure Python camera interface

Tue Feb 11, 2014 12:49 pm

donde1 wrote:Using RPi Model A and latest Raspbian 2014-02-07. RPi Camera is attached and I know it works. Did Python 2.7+ Installation, and then Quick Start. I copied the 1st code example into IDLE. When I got to camera = picamera.PiCamera()
and hit Return, I saw error below. I then did sudo apt-get update and upgrade, then sudo rpi-update. I tried to enter the code again and got the same error below.
I don't know how to proceed.

Code: Select all

Python 2.7.3 (default, Jan 13 2013, 11:20:46) 
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> import time
>>> import picamera
>>> 
>>> camera = picamera.PiCamera()

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    camera = picamera.PiCamera()
  File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 245, in __init__
    self._init_camera()
  File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 276, in _init_camera
    prefix="Failed to create camera component")
  File "/usr/lib/python2.7/dist-packages/picamera/exc.py", line 112, in mmal_check
    raise PiCameraMMALError(status, prefix)
PiCameraMMALError: Failed to create camera component: Out of memory
>>> 
Hmm, I'm not certain what the problem is here as I can't replicate it on my Model A under IDLE (even with Midori running in the background). Can you check the GPU memory split and make sure it's set to 128Mb? From the command line, run "sudo raspi-config", go to "Advanced Options", then "Memory Split" and make sure it's 128.

If that's set correctly, can you try running firstly under IDLE with nothing else running at all, and if that still doesn't work, from the command line outside X? (i.e. just run "python" before running "startx" and try some of the examples there).

Thanks,

Dave.

User avatar
Marcos.Scholl
Posts: 31
Joined: Wed Feb 05, 2014 7:12 pm
Location: Brasil

Re: Pure Python camera interface

Tue Feb 11, 2014 1:08 pm

donde1 wrote:Using RPi Model A and latest Raspbian 2014-02-07. RPi Camera is attached and I know it works. Did Python 2.7+ Installation, and then Quick Start. I copied the 1st code example into IDLE. When I got to camera = picamera.PiCamera()
and hit Return, I saw error below. I then did sudo apt-get update and upgrade, then sudo rpi-update. I tried to enter the code again and got the same error below.
I don't know how to proceed.
Friend, tried to run the code using any IDE?
I already had a problem using the terminal, after I started using the IDE, the problems are gone!

Advise you to use the Spyder IDE.
apt-get install spyder

Spyde is a powerful interactive development environment for the Python language with advanced editing, interactive testing, debugging and introspection features

Install and see if it resolves.

Ketta
Posts: 9
Joined: Mon Feb 10, 2014 2:18 pm

Re: Pure Python camera interface

Tue Feb 11, 2014 3:00 pm

Hello Dave!

First of all, I would just like to say, thank you so much for all the work you have put forth in this project. I cannot even imagine how exhausting and troublesome all of this work and troubleshooting has been for you. I am sure I speak for all of us who use it when I express how deeply grateful I am that gentlemen such as yourself are here to make everyone else's lives easier.

I have to say, I am a newbie to both Python and Linux OS's like Raspbian/Debian in general. I do have a little bit of background in C++, but only ~ a year, so every day is of course a new adventure!

I have a few questions for you, and probably many more to come in the future, so of course if you don't want or don't have time to ever look at or answer them, but I figure this is probably the best place for me to put them for now.

One such question I will ask today:
In the documentation for picamera, I see under the "capture_continuous" section of the reference that there are options to enable things like timestamps and indexing of photos created. Is this functionality included or possible in, say, the start and split recording functions? I have a project that I am working on that requires this kind of record-keeping, so this is one of the first problems that I would like to solve.

So yes, is there a way to add timestamps and indices to video files instead of simple images? As I think about it, I wouldn't be surprised if there is some kind of command in Python or from the system that could be input as a string and concatenated with the filename.. I am not yet sure how to do such a thing though, so I might as well wait for any input you may or may not have.

EDIT: Aha! I have figured out how to concatenate this thing, using strftime. I assume I can do the same thing with an index in a loop for a counter, but going as far as seconds on the timestamp will probably be enough for my needs for now.
Last edited by Ketta on Tue Feb 11, 2014 6:34 pm, edited 1 time in total.

donde1
Posts: 6
Joined: Tue Feb 11, 2014 4:46 am

Re: Pure Python camera interface

Tue Feb 11, 2014 3:13 pm

Well, this time I logged into RPi and typed python and got the >>> and typed the code again.
Same problem. Hitting return at end of 3rd line, I get the big error as before. I did check the 128 split and look OK. Is it possible a conflict exists with the latest wheezy?

Added:
I notice just typing idle at the prompt shows no IDE except Traceback and 6 lines of bad code.
Last edited by donde1 on Tue Feb 11, 2014 3:28 pm, edited 1 time in total.

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

Re: Pure Python camera interface

Tue Feb 11, 2014 3:22 pm

donde1 wrote:Well, this time I logged into RPi and typed python and got the >>> and typed the code again.
Same problem. Hitting return at end of 3rd line, I get the big error as before. I did check the 128 split and look OK. Is it possible a conflict exists with the latest wheezy?
I'd be rather surprised if it was such a thing; I've been writing an article on picamera for a magazine and last night was testing the code on a brand new Raspbian install (straight from NOOBS) just to make sure it all worked "out of the box". I take it your camera works fine with raspistill and raspivid? i.e. you can run raspistill -o test.jpg and you see a preview, then it captures an image successfully?

The only other thing I can think of at the moment is what resolution you're running at. What do you get if you do the following at the python prompt:

Code: Select all

[email protected] ~ $ python
Python 2.7.3 (default, Jan 13 2013, 11:20:46) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import picamera
>>> camera = picamera.PiCamera()
>>> camera.resolution
(1280L, 720L)
>>> 
(as you can see, I'm running at 720p)

I've happily used the preview all the way up to 1080p but I haven't tried any resolutions beyond that, and I wonder if you're running one of them?


Dave.

donde1
Posts: 6
Joined: Tue Feb 11, 2014 4:46 am

Re: Pure Python camera interface

Tue Feb 11, 2014 3:42 pm

No! a bunch mmal errors.
Let me put the other SD back in with TFT Pi CAM from Adafruit and see what happens.

Added:
Removed SD, put in TFT Pi Cam SD, put TFT unit on top of RPi, fired it up. No problem camera works fine. I'm lost. Going to breakfast, about 8am now in LA. Be back!
Last edited by donde1 on Tue Feb 11, 2014 3:56 pm, edited 1 time in total.

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

Re: Pure Python camera interface

Tue Feb 11, 2014 3:50 pm

donde1 wrote:No! a bunch mmal errors.
Let me put the other SD back in with TFT Pi from Adafruit and see what happens.
Ahh ... when you originally said "RPi Camera is attached and I know it works" I assumed that meant you'd got it working with raspistill/raspivid. If it doesn't work with either of those, it certainly won't work with picamera (they're all just mmal clients under the hood). Given we've established it's not working with any mmal stuff at all I'm guessing your camera isn't enabled under your raspbian install (when the camera isn't enabled it returns ENOMEM on init). Do the errors you get when running raspistill look like this?

Code: Select all

[email protected] ~ $ raspistill -o test.jpg
mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
mmal: Failed to create camera component
mmal: main: Failed to create camera component
mmal: Camera is not enabled in this build. Try running "sudo raspi-config" and ensure that "camera" has been enabled
If so, just follow the instructions in the last line :)


Dave.

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

Re: Pure Python camera interface

Tue Feb 11, 2014 4:38 pm

donde1 wrote:Added:
Removed SD, put in TFT Pi Cam SD, put TFT unit on top of RPi, fired it up. No problem camera works fine. I'm lost. Going to breakfast, about 8am now in LA. Be back!
In that case it definitely sounds like the camera isn't enabled in your raspbian install. Enabling the camera is a per-installation thing (as I understand it, what "enabling" actually does is swap out the kernel for one which supports the camera - so your current card is booting a kernel which supports the camera, while your raspbian install isn't)


Dave.

donde1
Posts: 6
Joined: Tue Feb 11, 2014 4:46 am

Re: Pure Python camera interface

Tue Feb 11, 2014 6:28 pm

camera isn't enabled
Dave, you're right! I have always enabled the camera in raspi-config. I can't believe I missed it this time! I'll now continue with the python script that "didn't work". Sorry for the time I wasted. One more question. We mostly see sudo apt-get update should before a new program is installed. We now see to do upgrade, and rpi-update. Lately I'm thinking, doing any one upxxxx(x) can harm a working program when installing another add on program. Is there any rule about when and when not to do these upxxxx(x) ? In fact, there ought to be a "sudo apt-get remove upgrade ! :D
Don

User avatar
Marcos.Scholl
Posts: 31
Joined: Wed Feb 05, 2014 7:12 pm
Location: Brasil

Re: Pure Python camera interface

Tue Feb 11, 2014 6:32 pm

Hello Dave .

I have a problem as the resolution using the following technique of Raspicam : " 4:12 Recording to a network stream . " .

With the configuration of the client entered into parameter resolution ( " camera.resolution = ( 640,480 ) " ) it does the streaming smoothly . But if I do not set a resolution , assuming the default screen that here is fullhd or by setting a resolution for the camera above 900x800 when running the client, simply lock the transmission . She is frozen in both the server and the client, requiring the reboot of the Rasp.

I found the reason , it falls the network Rasp ( "network is unreachable " ) , requiring the ifup / down eth0 back to the network .
The following warning sometimes returns to the console :

Code: Select all

Cache empty , consider increase increasing - cache and / or- cache - min . [ performance issue ]
How can I make this broadcast in 1920x1080 for MPlayer using this approach ( " 4.12. " ) ?

I would remove the image cache so there is no delay Is. It possible to do this?

So here comes me to another question for you. Being that I want to convey this image of Rasp , by another Rasp by network that will view it with MPlayer on a 10 "screen , this is the correct way to do this ? I Saw that Raspicam also speaks ( " circular stream " ) .

Hug .

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

Re: Pure Python camera interface

Tue Feb 11, 2014 7:56 pm

donde1 wrote:
camera isn't enabled
Dave, you're right! I have always enabled the camera in raspi-config. I can't believe I missed it this time! I'll now continue with the python script that "didn't work". Sorry for the time I wasted. One more question. We mostly see sudo apt-get update should before a new program is installed. We now see to do upgrade, and rpi-update. Lately I'm thinking, doing any one upxxxx(x) can harm a working program when installing another add on program. Is there any rule about when and when not to do these upxxxx(x) ? In fact, there ought to be a "sudo apt-get remove upgrade ! :D
Don
Hi Don,

It probably helps to understand exactly what each of these commands does. I'll stick on my server-admin hat and run through them:

"sudo apt-get update" simply pulls down the list of available packages and their versions from the Raspbian repository servers. In and of itself it does nothing to upgrade any software on your machine.

"sudo apt-get upgrade" uses the list obtained by "sudo apt-get update" to determine which installed packages (if any) can be upgraded and, if anything can be upgraded, prompts you to upgrade them. This step may well break stuff if it's interrupted, or if any of the upgraded packages contain new bugs (though the latter is hopefully rare!). You can also selectively upgrade packages (and their dependencies) by specifying them on the command line after "upgrade".

"sudo rpi-update" is something rather specific to the Pi. It upgrades (bits of? all of?) the kernel running on the Pi. On most (non-Pi) platforms this sort of thing is usually handled by apt-get but I'm guessing there's some logistical problem with doing that on Pi (probably because the bits updated by rpi-update are changing quite rapidly, and packaging stuff for apt-get is a relatively non-trivial affair). So, I think of "sudo rpi-update" as a combined "update & upgrade" for the kernel only.

My general rule for upgrading stuff on the servers I look after at work is:

"If there's a security vulnerability, upgrade. If there's a bug fix we're specifically affected by, upgrade. Otherwise, don't bother."

However, that's a rule for enterprise servers running business critical stuff and is probably waaay too conservative for a hobbyist platform like the Pi. For the Pi (and my home linux boxes) I use a rule more like:

"Run apt-get upgrade whenever you like, but don't bother with rpi-update unless there's a specific bug fix you're affected by (which there may well be given the rate it's evolving)"

In general, I find breakage involving apt-get upgrade to be extremely rare (it's much more common to find user/admin error at fault). I have encountered it, but only a handful of times in a fairly long career of looking after Linux boxen (there are ways of downgrading packages to older revisions but sometimes it can get a bit hairy so I won't go into that here!).


Dave.

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

Re: Pure Python camera interface

Tue Feb 11, 2014 8:24 pm

Hi Ketta,
Ketta wrote: EDIT: Aha! I have figured out how to concatenate this thing, using strftime. I assume I can do the same thing with an index in a loop for a counter, but going as far as seconds on the timestamp will probably be enough for my needs for now.
Sorry for the late reply - yup, strftime (on a datetime instance) is exactly what I'd advocate for this sort of thing. That should enable you to generate filenames containing dates, times, all the way down to milliseconds if you require (basically it's what capture_continuous uses internally).

I had debated doing something similar to capture_continuous for start_recording and split_recording originally, but I couldn't come up with as nice an API as for capture_continuous (largely because there's necessarily a distinction between starting, splitting, and stopping the recording). I might have another run at implementing something nicer in future, but at the moment I'm trying to concentrate on the OpenGL overlay stuff.

Good luck!

Dave.

donde1
Posts: 6
Joined: Tue Feb 11, 2014 4:46 am

Re: Pure Python camera interface

Wed Feb 12, 2014 12:33 am

It probably helps to understand
Dave,
Thanks for the helpful info about update....
I think the frustration of a problem not fixed gets some, me included, to grasp at straws. As you saw in my case, it was merely forgetting to set an option, not doing update/upgrades. Doing an rpi-update is crazy looking: 1000's of lines of code whizzing by near the end. The Quick Start of Pure Python now works fine.
Onward!
Don

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

Re: Pure Python camera interface

Wed Feb 12, 2014 3:00 am

Marcos.Scholl wrote:So here comes me to another question for you. Being that I want to convey this image of Rasp , by another Rasp by network that will view it with MPlayer on a 10 "screen , this is the correct way to do this ? I Saw that Raspicam also speaks ( " circular stream " ) .
Ahh ... I hadn't realized you were attempting to stream between two Pi's (I'd assumed it was a Pi streaming to something like a laptop/ordinary PC). The best player for H.264 video on the Pi is probably omxplayer (which supports GPU decoding of streams and so should handle 1080p video happily). However, I've spent some time playing with omxplayer tonight and I haven't yet managed to get it streaming video via picamera (it doesn't like reading video from stdin, although it seems to from a named pipe - there also seems to be some issue with shutting it down, and it definitely doesn't like running under byobu/tmux which I usually use!). Anyway, I'll see if I can get it working and post an updated recipe to support it if I do.


Dave.

User avatar
Marcos.Scholl
Posts: 31
Joined: Wed Feb 05, 2014 7:12 pm
Location: Brasil

Re: Pure Python camera interface

Wed Feb 12, 2014 3:27 am

waveform80 wrote:Ahh ... I hadn't realized you were attempting to stream between two Pi's (I'd assumed it was a Pi streaming to something like a laptop/ordinary PC). The best player for H.264 video on the Pi is probably omxplayer (which supports GPU decoding of streams and so should handle 1080p video happily). However, I've spent some time playing with omxplayer tonight and I haven't yet managed to get it streaming video via picamera (it doesn't like reading video from stdin, although it seems to from a named pipe - there also seems to be some issue with shutting it down, and it definitely doesn't like running under byobu/tmux which I usually use!). Anyway, I'll see if I can get it working and post an updated recipe to support it if I do. Dave.
Dave, I'm actually currently trabalhanndo of Pi for a notebook, but for my second Pi has not arrived yet!
This problem occurred using video with my notebook.
I appreciate all your effort.
I do not know if you already thought of some sort of donation to the project Picamera, but even with my small monthly gain a scholarship, would be happy to help you with some value! ;)

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

Re: Pure Python camera interface

Wed Feb 12, 2014 10:54 am

donde1 wrote:
It probably helps to understand
Dave,
Thanks for the helpful info about update....
I think the frustration of a problem not fixed gets some, me included, to grasp at straws. As you saw in my case, it was merely forgetting to set an option, not doing update/upgrades. Doing an rpi-update is crazy looking: 1000's of lines of code whizzing by near the end. The Quick Start of Pure Python now works fine.
Onward!
Don
Heh - no worries - I'm sure we've all been there at one time or another. As for 1000s of lines of code whizzing by - try installing Gentoo sometime! Actually, if you're on a Pi, don't - it's a distro for crazy people which involves compiling everything from scratch ... including the compiler. Despite being slightly mad, it did teach me a lot back when I got started with Linux (the final lesson one learns with Gentoo is that life is too short to re-compile KDE again, and that it's time to look for a pre-compiled distro! :)


Dave.

donde1
Posts: 6
Joined: Tue Feb 11, 2014 4:46 am

Re: Pure Python camera interface

Wed Feb 12, 2014 4:01 pm

Gentoo is that life is too short
Dave, I remember! A friend in Northern Cal and I decided to follow pages of instructions to do a Gentoo distro. install. We had to wait all weekend for the compiling to quit. But, it quit too early! The Internet glitched and download froze. At 1 meg speed the download was about 23 hours in, and then we lost it all. Of course us machos decided to try again. We finally made it. But then the instruction manual became very confusing of what choice to select. We were new to Linux and the terms kept us arguing over the phone. Sometimes I was right, other times he was. I think we gave up after another frozen download during the next bad weekend! :D But we learned a lot, I think.
Don

User avatar
Marcos.Scholl
Posts: 31
Joined: Wed Feb 05, 2014 7:12 pm
Location: Brasil

Re: Pure Python camera interface

Thu Feb 13, 2014 12:29 pm

Hey Dave, I got one second Pi and tested the streaming between the two, using the MPlarer, and to my surprise as I had tested via PC, the result was terrible in Pi. Extremely slow with MPlayer above 50% CPU.
Any tips? Thanks.

Marcos.

User avatar
jbeale
Posts: 3491
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Pure Python camera interface

Thu Feb 13, 2014 3:11 pm

omxplayer and hello-video use the GPU hardware acceleration for playback. I don't think any other program does. Software decode on the ARMv6 is slow.

Return to “Camera board”