Prosjekt

Generell

Profil

WikiStart » Historikk » Versjon 23

Niels Petter Rasch-Olsen, 11.05.2006 16:15

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