Thinking about CherryTV and ways to turn it into a real application, I thought the worse piece of it was the reliance on v4lctl, and how really you just don't know if it works or not, and how you can't finetune, and whatever, and run into Python-v4l.
It has remained apparently untouched by two years, but I managed to build it with one edit and to make it work by switching a line to an alternate version (they are both there), and it's nice.
Here's the example TV viewing application using it:
#!/usr/bin/env python # Sample TV viewing application for pyv4l >= 0.3 - by Michael Dove #<email@example.com> # Note: this does the imaging in grab mode. Performance is limited. # I average 35 fps @ 320x240. Disabling the writes to the tk window yeilds 90+ fps. import v4l import Image import ImageChops WIDTH = 320 HEIGHT = 240 vid = v4l.video('/dev/video') cap = vid.getCapabilities() print "Device Name: %s" % cap print "Type: %d" % cap print "Channels: %d" % cap print "Audios: %d" % cap print "Maximum Width: %d" % cap print "Maximum Height: %d" % cap print "Minimum Width: %d" % cap print "Minimum Height: %d" % cap vid.setupImage(WIDTH, HEIGHT, v4l.VIDEO_PALETTE_YUYV) print vid.getChannel(0) # TV vid.setChannel(0) # set to TV vid.setFrequency(216250) import Tkinter tk=Tkinter.Tk() import ImageTk photo = ImageTk.PhotoImage("RGB",(WIDTH,HEIGHT)) label= Tkinter.Label(tk,text="mini TV",image=photo,width=WIDTH,height=HEIGHT) label.pack() vid.preQueueFrames() nextFrame = 0; vid.setVolume(5) vid.mute() try: while 1: output = vid.getImage(nextFrame) im = Image.fromstring("RGB", (WIDTH, HEIGHT), output) # update Tk label photo.paste(im) tk.update() nextFrame = vid.queueFrame() except Tkinter.TclError: print "something" pass vid.mute()
If you have seen the equivalent C app... well... nice job here!