Prosjekt

Generell

Profil

WikiStart » Historikk » Versjon 15

Niels Petter Rasch-Olsen, 11.05.2006 14:58

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
{{{
25
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)
26
pylibdv-0.1/python setup.py install (requires root)
27
}}}
28
29 8 Niels Petter Rasch-Olsen
== Requirements ==
30 11 Niels Petter Rasch-Olsen
libdv 1.4 (works with debian package 0.104-2 from debian repository)[[BR]]
31 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]]
32
gcc[[BR]]
33 1
34 8 Niels Petter Rasch-Olsen
== Known bugs ==
35
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.
36 1
37 8 Niels Petter Rasch-Olsen
== Progress ==
38
So far the following is available:[[BR]]
39 1
40 10 Niels Petter Rasch-Olsen
pylibdv:
41
  Constants:
42 8 Niels Petter Rasch-Olsen
    DV_QUALITY_BEST[[BR]]
43
    DV_QUALITY_FASTEST[[BR]]
44
    DV_QUALITY_COLOR[[BR]]
45
    DV_QUALITY_DC[[BR]]
46
    DV_QUALITY_AC_1[[BR]]
47
    DV_QUALITY_AC_2[[BR]]
48
    DV_QUALITY_AC_MASK[[BR]]
49
    e_dv_color_rgb[[BR]]
50
    e_dv_color_yuv[[BR]]
51
    e_dv_color_bgr0[[BR]]
52 10 Niels Petter Rasch-Olsen
  Object:
53 8 Niels Petter Rasch-Olsen
    Decoder[[BR]]
54 10 Niels Petter Rasch-Olsen
      Methods:
55 8 Niels Petter Rasch-Olsen
        parse_header()[[BR]]
56
        decode_full_frame()[[BR]]
57 10 Niels Petter Rasch-Olsen
      Data:
58 8 Niels Petter Rasch-Olsen
        frame_size (read only)[[BR]]
59
        width (read only)[[BR]]
60
        length (read only)[[BR]]
61
        quality (read & write)[[BR]]
62 7 Niels Petter Rasch-Olsen
63
64 8 Niels Petter Rasch-Olsen
This project is ongoing and most functions will be wrapped by the end of the summer (depending on need).
65 7 Niels Petter Rasch-Olsen
66
67
68
== Simple example ==
69 8 Niels Petter Rasch-Olsen
{{{
70 7 Niels Petter Rasch-Olsen
import pylibdv
71
72
decoder = pylibdv.Decoder(ignored=1, clamp_luma=1, clamp_chroma=1) 
73
74 9 Niels Petter Rasch-Olsen
file = open("somedvfile.dv,"r")
75
framebuffer = file.read(120000) # Just enough to make sure
76 7 Niels Petter Rasch-Olsen
77 9 Niels Petter Rasch-Olsen
decoder.parse_header(framebuffer)
78 7 Niels Petter Rasch-Olsen
79 9 Niels Petter Rasch-Olsen
# Now we can get some information about the video
80
frame_size = decoder.frame_size
81
width = decoder.width
82
height = decoder.height
83 4 Niels Petter Rasch-Olsen
84 9 Niels Petter Rasch-Olsen
file.seek(0) #Back to start
85
framebuffer = file.read(frame_size)
86
rgb_buffer = decoder.decode_full_frame(framebuffer)
87
#Now the rgb buffer can be drawn to screen, check out gtk package
88 8 Niels Petter Rasch-Olsen
}}}
89 1
90
91
Enjoy! [[BR]]
92
[mailto:nielsr@ifi.uio.no Niels Petter Rasch-Olsen]