Prosjekt

Generell

Profil

WikiStart » Historikk » Versjon 22

Niels Petter Rasch-Olsen, 11.05.2006 15:55

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