Project

General

Profile

WikiStart » History » Version 21

Niels Petter Rasch-Olsen, 11.05.2006 15:17

1 12 Niels Petter Rasch-Olsen
= Welcome to pylibdv 0.1 =
2 13 Niels Petter Rasch-Olsen
[[PageOutline]]
3 3 Niels Petter Rasch-Olsen
4
== Background ==
5 6 Niels Petter Rasch-Olsen
pylibdv is a project for one of my university courses; [http://www.uio.no/studier/emner/matnat/ifi/INF5660/index-eng.xml INF5660 - Advanced problem solving with high level languages].
6 3 Niels Petter Rasch-Olsen
7 1
pylibdv is a python wrapper for [http://libdv.sourceforge.net/ libdv].[[BR]]
8
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."
9 6 Niels Petter Rasch-Olsen
10 14 Niels Petter Rasch-Olsen
== Overview of package ==
11
{{{
12
pylibdv-0.1/src/pylibdv.c
13
pylibdv-0.1/src/pylibdv.h
14
pylibdv-0.1/frame_viewer/frame-viewer.py
15
pylibdv-0.1/example/parse_decode.py
16
pylibdv-0.1/dv/test.dv
17
pylibdv-0.1/testing.py
18
pylibdv-0.1/setup.py
19
pylibdv-0.1/README
20
}}}
21 15 Niels Petter Rasch-Olsen
22
== Setup ==
23
use setup.py to install package.
24 16 Niels Petter Rasch-Olsen
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.
25 15 Niels Petter Rasch-Olsen
{{{
26
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)
27
pylibdv-0.1/python setup.py install (requires root)
28
}}}
29 16 Niels Petter Rasch-Olsen
30 17 Niels Petter Rasch-Olsen
== Testing ==
31
To run the tests simply use pylibdv-0.1/python testing.py
32
33 21 Niels Petter Rasch-Olsen
Uses [http://docs.python.org/lib/module-doctest.html doctest]. 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 [https://dev.interhost.no/pylibdv/wiki/WikiStart#Knownbugs Known Bugs] for more information.
34 15 Niels Petter Rasch-Olsen
35 8 Niels Petter Rasch-Olsen
== Requirements ==
36 11 Niels Petter Rasch-Olsen
libdv 1.4 (works with debian package 0.104-2 from debian repository)[[BR]]
37 8 Niels Petter Rasch-Olsen
python >= 2.4 (testing.py won't work with 2.3, doctest will fail due to a bug in 2.3)[[BR]]
38
gcc[[BR]]
39 1
40 8 Niels Petter Rasch-Olsen
== Known bugs ==
41
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.
42 1
43 20 Niels Petter Rasch-Olsen
The doctest suite doesn't seem to find the two tests belonging to the Decoder, only the pylibdv tests are performed.
44
45 8 Niels Petter Rasch-Olsen
== Progress ==
46
So far the following is available:[[BR]]
47 1
48 10 Niels Petter Rasch-Olsen
pylibdv:
49
  Constants:
50 8 Niels Petter Rasch-Olsen
    DV_QUALITY_BEST[[BR]]
51
    DV_QUALITY_FASTEST[[BR]]
52
    DV_QUALITY_COLOR[[BR]]
53
    DV_QUALITY_DC[[BR]]
54
    DV_QUALITY_AC_1[[BR]]
55
    DV_QUALITY_AC_2[[BR]]
56
    DV_QUALITY_AC_MASK[[BR]]
57
    e_dv_color_rgb[[BR]]
58
    e_dv_color_yuv[[BR]]
59
    e_dv_color_bgr0[[BR]]
60 10 Niels Petter Rasch-Olsen
  Object:
61 8 Niels Petter Rasch-Olsen
    Decoder[[BR]]
62 10 Niels Petter Rasch-Olsen
      Methods:
63 8 Niels Petter Rasch-Olsen
        parse_header()[[BR]]
64
        decode_full_frame()[[BR]]
65 10 Niels Petter Rasch-Olsen
      Data:
66 8 Niels Petter Rasch-Olsen
        frame_size (read only)[[BR]]
67
        width (read only)[[BR]]
68
        length (read only)[[BR]]
69
        quality (read & write)[[BR]]
70 7 Niels Petter Rasch-Olsen
71
72 8 Niels Petter Rasch-Olsen
This project is ongoing and most functions will be wrapped by the end of the summer (depending on need).
73 7 Niels Petter Rasch-Olsen
74
75
76
== Simple example ==
77 8 Niels Petter Rasch-Olsen
{{{
78 7 Niels Petter Rasch-Olsen
import pylibdv
79
80
decoder = pylibdv.Decoder(ignored=1, clamp_luma=1, clamp_chroma=1) 
81
82 9 Niels Petter Rasch-Olsen
file = open("somedvfile.dv,"r")
83
framebuffer = file.read(120000) # Just enough to make sure
84 7 Niels Petter Rasch-Olsen
85 9 Niels Petter Rasch-Olsen
decoder.parse_header(framebuffer)
86 7 Niels Petter Rasch-Olsen
87 9 Niels Petter Rasch-Olsen
# Now we can get some information about the video
88
frame_size = decoder.frame_size
89
width = decoder.width
90
height = decoder.height
91 4 Niels Petter Rasch-Olsen
92 9 Niels Petter Rasch-Olsen
file.seek(0) #Back to start
93
framebuffer = file.read(frame_size)
94
rgb_buffer = decoder.decode_full_frame(framebuffer)
95
#Now the rgb buffer can be drawn to screen, check out gtk package
96 8 Niels Petter Rasch-Olsen
}}}
97 1
98
99
Enjoy! [[BR]]
100
[mailto:nielsr@ifi.uio.no Niels Petter Rasch-Olsen]