LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-01-2011, 04:42 PM   #1
gary_in_springhill
Member
 
Registered: Mar 2008
Posts: 136

Rep: Reputation: 21
how to stream a webcam with python


I'm trying to stream/view a webcam via a python app. I've tried pygame and it works great with an actual pci capture card but v4l complains with even a well known can like logitech. Xawtv works fine with the logitech though.

In pygame I get

SystemError: ioctl(VIDIOC_S_FMT) failure: no supported formats

for the logitech cam.

Other than using an external app like xawtv is there any known ways to view via a python app? I don't want to record just view in 2 sizes 320x240 and 640x480 hopefully with command line switches.
here is the small view app using pygame

Code:
#!/usr/bin/env python

import pygame, sys
import pygame.camera
from pygame.locals import *
pygame.init()
pygame.camera.init()
screen = pygame.display.set_mode((320,240))
cam = pygame.camera.Camera("/dev/video4",(320,240))

cam.start()
while 1:
	image = cam.get_image()
	screen.blit(image,(0,0))
	pygame.display.set_caption(str("TUX PLOT CAM"))
	pygame.display.update()
	for event in pygame.event.get():
	  if event.type == pygame.QUIT:
	     sys.exit()
 
Old 10-01-2011, 06:47 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Hello,

I came across this for you - http://webcamspy.sourceforge.net/
Would that help? Let me know man.

Cheers,

Josh
 
Old 10-01-2011, 08:17 PM   #3
gary_in_springhill
Member
 
Registered: Mar 2008
Posts: 136

Original Poster
Rep: Reputation: 21
mplayer

I just decided to use mplayer as a subproc. it works fine and quality is good.

thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stream a webcam in real-time? hunternet93 Linux - General 4 02-15-2014 05:04 PM
Anyone Tried To Stream A Webcam? masonm Slackware 4 09-15-2008 08:28 AM
stream webcam to websiteI Packrat Linux - Software 1 03-24-2008 06:14 PM
First Post - Grandpa wants to stream a webcam georget LinuxQuestions.org Member Intro 2 12-07-2007 06:39 AM
Can you play this webcam stream? acid_kewpie Linux - Software 4 07-18-2006 11:25 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration