2

After many attempts using pygame, or OpenCV to capture and display pictures from a standard USB-camera I decided to ask this question.

Mplayer worked with all cameras I have tested (a=Logitech, b=Creative, c=SPEEDLink). Mplayer works from commandline; I found no python adaptation.

The other libraries did not even recognize the camera or found a non existing format of the video stream. Solutions from the internet describe older Raspbian OSs, maybe that's the problem. I am using 'Stretch' now and certainly will go on to 'Buster'.

so:

  • can I use Mplayer from Python?

Other hints are welcome.

Thanks for help.

peets
  • 131
  • 5
  • 1
    Raspbian Stretch is oldstable. If you start a new project you really should use the latest version Raspbian Buster. – Ingo Feb 13 '20 at 08:53
  • @ingo: the question was closed with good reasons - so I worked it over, hoping it is ok now. Can you open it again, or do I have to put it as a new question? – peets Feb 14 '20 at 09:48
  • 1
    @peets I still don't understand how you plan to use Mplayer to "capture and display pictures from python". It's a video player, not a webcam library. Could you concentrate on what you want to do, not on how you imagine doing it? Maybe you just need to look at a capture library, such as pyv4l2. – Dmitry Grigoryev Feb 14 '20 at 12:16
  • @peets I'm not a moderator so I cannot reopen it. I only can vote to reopen it (I've done) but you need 5 votes to reopen. Please note the comment from @DmitryGrigoryev above to improve your question. – Ingo Feb 14 '20 at 12:30
  • @Dimitry, Ingo: Thanks for your help. My first attempt was describing the needs for my project but it was not well set to understand it. I'll try to follow the pyv4l2 hint. – peets Feb 15 '20 at 18:39
  • @Dimitry: I want to mount a USB-camera on a CNC machine in place of the motor or laser head. The picture shall be displayed on a remote monitor using a RPi headless installation. A cross-hair points to a position of interest, e.g. a hole, a via, a pad on a PCB. Its coordinates shall be recorded pressing a key. While video capture worked well on my Ubuntu Linux a few years ago I ran into trouble using the RPi. Many examples from the Internet do not work. I am experienced in programming C/C++, a bit in Python now, and hardware in my well equipped lab. Inst. OpenCV drove me nuts -> post here – peets Feb 15 '20 at 18:49
  • @Dimitry 2: Using 'mplayer' showed me, that the camera in question is working. – peets Feb 15 '20 at 18:53
  • @Dimitry 2: Using 'mplayer' showed me, that the camera in question is working. I found another post somewhere who finally mentioned to use 'mplayer' for picture grabbing in a subprocess as a workaround. I have no experience in doing so. Of course I would prefer using a webcam library, especially OpenCV. To reduce my original question as requested by five members I tried this part. Helpful would be e.g. a short piece of working code on Buster (which is now installed). Thanks again for your help. – peets Feb 15 '20 at 19:10
  • very helpful in finding cameras: https://raspberrypi.stackexchange.com/a/81776/86998 – peets Feb 17 '20 at 06:01

0 Answers0