WikiStart » Historikk » Revisjon 26
Revisjon 25 (Niels Petter Rasch-Olsen, 11.05.2006 16:17) → Revisjon 26/27 (Christian Skarby, 07.04.2011 12:04)
h1. Welcome to pylibdv-0.1 [[PageOutline]] h2. Background pylibdv is a project for one of my university courses; "INF5660 - Advanced problem solving with high level languages":http://www.uio.no/studier/emner/matnat/ifi/INF5660/index-eng.xml. pylibdv is a python wrapper for "libdv":http://libdv.sourceforge.net/. From libdv home page: "libdv is a software codec for DV video, the encoding format used by most digital camcorders, typically those that support the IEEE 1394 Firewire or i.Link) interface. Libdv was developed according to the official standards for DV video: IEC 61834 and SMPTE 314M." h2. Download You can find the project as pylibdv-0.1.tar.gz here: "download":https://dev.interhost.no/pylibdv/browser/download/pylibdv-0.1.tar.gz?format=raw h2. Overview of package <pre> pylibdv-0.1/src/pylibdv.c pylibdv-0.1/src/pylibdv.h pylibdv-0.1/frame_viewer/frame-viewer.py pylibdv-0.1/example/parse_decode.py pylibdv-0.1/dv/test.dv pylibdv-0.1/testing.py pylibdv-0.1/setup.py pylibdv-0.1/README </pre> h2. Setup use setup.py to install package. Please note! If you can't get root acces, but want to build, and try the examples (frame-viewer.py and parse_decode.py) simply copy the .so file into those folder after building. <pre> pylibdv-0.1/python setup.py build (will create a build directory, inside the arcitecthure directory you will find the shared object file pylibdv.so) pylibdv-0.1/python setup.py install (requires root) </pre> h2. Testing To run the tests simply use pylibdv-0.1/python testing.py Uses "doctest":http://docs.python.org/lib/module-doctest.html. It will search for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work exactly as shown. See "Known Bugs":https://dev.interhost.no/pylibdv/wiki/WikiStart#Knownbugs for more information. h2. Requirements libdv 1.4 (works with debian package 0.104-2 from debian repository) python >= 2.4 (testing.py won't work with 2.3, doctest will fail due to a bug in 2.3) gcc h2. Known bugs libdv seg-faults on some versions of the libdv library. There seems to be a bug in the asm-optimization, so a quick work-around if this occurs is to turn off asm-optimization. The doctest suite doesn't seem to find the two tests belonging to the Decoder, only the pylibdv tests are performed. h2. Progress So far the following is available: pylibdv: Constants: DV_QUALITY_BEST DV_QUALITY_FASTEST DV_QUALITY_COLOR DV_QUALITY_DC DV_QUALITY_AC_1 DV_QUALITY_AC_2 DV_QUALITY_AC_MASK e_dv_color_rgb e_dv_color_yuv e_dv_color_bgr0 Object: Decoder Methods: parse_header() decode_full_frame() Data: frame_size (read only) width (read only) length (read only) quality (read & write) This project is ongoing and most functions will be wrapped by the end of the summer (depending on need). h2. Simple example <pre> import pylibdv decoder = pylibdv.Decoder(ignored=1, clamp_luma=1, clamp_chroma=1) file = open("somedvfile.dv,"r") framebuffer = file.read(120000) # Just enough to make sure decoder.parse_header(framebuffer) # Now we can get some information about the video frame_size = decoder.frame_size width = decoder.width height = decoder.height file.seek(0) #Back to start framebuffer = file.read(frame_size) rgb_buffer = decoder.decode_full_frame(framebuffer) #Now the rgb buffer can be drawn to screen, check out gtk package </pre> Enjoy! "Niels [mailto:nielsr@ifi.uio.no Niels Petter Rasch-Olsen":mailto:nielsr@ifi.uio.no Rasch-Olsen]