Prosjekt

Generell

Profil

WikiStart » Historikk » Versjon 17

Niels Petter Rasch-Olsen, 11.05.2006 15:13

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
Uses [http://docs.python.org/lib/module-doctest.html doctest]. It will searche for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work exactly as shown.
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 8 Niels Petter Rasch-Olsen
== Progress ==
44
So far the following is available:[[BR]]
45 1
46 10 Niels Petter Rasch-Olsen
pylibdv:
47
  Constants:
48 8 Niels Petter Rasch-Olsen
    DV_QUALITY_BEST[[BR]]
49
    DV_QUALITY_FASTEST[[BR]]
50
    DV_QUALITY_COLOR[[BR]]
51
    DV_QUALITY_DC[[BR]]
52
    DV_QUALITY_AC_1[[BR]]
53
    DV_QUALITY_AC_2[[BR]]
54
    DV_QUALITY_AC_MASK[[BR]]
55
    e_dv_color_rgb[[BR]]
56
    e_dv_color_yuv[[BR]]
57
    e_dv_color_bgr0[[BR]]
58 10 Niels Petter Rasch-Olsen
  Object:
59 8 Niels Petter Rasch-Olsen
    Decoder[[BR]]
60 10 Niels Petter Rasch-Olsen
      Methods:
61 8 Niels Petter Rasch-Olsen
        parse_header()[[BR]]
62
        decode_full_frame()[[BR]]
63 10 Niels Petter Rasch-Olsen
      Data:
64 8 Niels Petter Rasch-Olsen
        frame_size (read only)[[BR]]
65
        width (read only)[[BR]]
66
        length (read only)[[BR]]
67
        quality (read & write)[[BR]]
68 7 Niels Petter Rasch-Olsen
69
70 8 Niels Petter Rasch-Olsen
This project is ongoing and most functions will be wrapped by the end of the summer (depending on need).
71 7 Niels Petter Rasch-Olsen
72
73
74
== Simple example ==
75 8 Niels Petter Rasch-Olsen
{{{
76 7 Niels Petter Rasch-Olsen
import pylibdv
77
78
decoder = pylibdv.Decoder(ignored=1, clamp_luma=1, clamp_chroma=1) 
79
80 9 Niels Petter Rasch-Olsen
file = open("somedvfile.dv,"r")
81
framebuffer = file.read(120000) # Just enough to make sure
82 7 Niels Petter Rasch-Olsen
83 9 Niels Petter Rasch-Olsen
decoder.parse_header(framebuffer)
84 7 Niels Petter Rasch-Olsen
85 9 Niels Petter Rasch-Olsen
# Now we can get some information about the video
86
frame_size = decoder.frame_size
87
width = decoder.width
88
height = decoder.height
89 4 Niels Petter Rasch-Olsen
90 9 Niels Petter Rasch-Olsen
file.seek(0) #Back to start
91
framebuffer = file.read(frame_size)
92
rgb_buffer = decoder.decode_full_frame(framebuffer)
93
#Now the rgb buffer can be drawn to screen, check out gtk package
94 8 Niels Petter Rasch-Olsen
}}}
95 1
96
97
Enjoy! [[BR]]
98
[mailto:nielsr@ifi.uio.no Niels Petter Rasch-Olsen]