Prosjekt

Generell

Profil

WikiStart » Historikk » Versjon 8

Niels Petter Rasch-Olsen, 11.05.2006 14:18

1 2 Niels Petter Rasch-Olsen
= Welcome to pylibdv 0.0.1 =
2 1
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 8 Niels Petter Rasch-Olsen
== Requirements ==
11
libdv 1.4 (works with debian package 0.104-2 from debian reository)[[BR]]
12
python >= 2.4 (testing.py won't work with 2.3, doctest will fail due to a bug in 2.3)[[BR]]
13
gcc[[BR]]
14 1
15 8 Niels Petter Rasch-Olsen
== Known bugs ==
16
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.
17 1
18 8 Niels Petter Rasch-Olsen
== Progress ==
19
So far the following is available:[[BR]]
20 1
21 8 Niels Petter Rasch-Olsen
pylibdv:[[BR]]
22
  Constants:[[BR]]
23
    DV_QUALITY_BEST[[BR]]
24
    DV_QUALITY_FASTEST[[BR]]
25
    DV_QUALITY_COLOR[[BR]]
26
    DV_QUALITY_DC[[BR]]
27
    DV_QUALITY_AC_1[[BR]]
28
    DV_QUALITY_AC_2[[BR]]
29
    DV_QUALITY_AC_MASK[[BR]]
30
    e_dv_color_rgb[[BR]]
31
    e_dv_color_yuv[[BR]]
32
    e_dv_color_bgr0[[BR]]
33
  Object:[[BR]]
34
    Decoder[[BR]]
35
      Methods:[[BR]]
36
        parse_header()[[BR]]
37
        decode_full_frame()[[BR]]
38
      Data:[[BR]]
39
        frame_size (read only)[[BR]]
40
        width (read only)[[BR]]
41
        length (read only)[[BR]]
42
        quality (read & write)[[BR]]
43 7 Niels Petter Rasch-Olsen
44
45 8 Niels Petter Rasch-Olsen
This project is ongoing and most functions will be wrapped by the end of the summer (depending on need).
46 7 Niels Petter Rasch-Olsen
47
48
49
== Simple example ==
50 8 Niels Petter Rasch-Olsen
{{{
51 7 Niels Petter Rasch-Olsen
import pylibdv
52
53
decoder = pylibdv.Decoder(ignored=1, clamp_luma=1, clamp_chroma=1) 
54
55 8 Niels Petter Rasch-Olsen
file = open("somedvfile.dv,"r")[[BR]]
56
framebuffer = file.read(120000) # Just enough to make sure[[BR]]
57 7 Niels Petter Rasch-Olsen
58 8 Niels Petter Rasch-Olsen
decoder.parse_header(framebuffer)[[BR]]
59 7 Niels Petter Rasch-Olsen
60 8 Niels Petter Rasch-Olsen
# Now we can get some information about the video[[BR]]
61
frame_size = decoder.frame_size[[BR]]
62
width = decoder.width[[BR]]
63
height = decoder.height[[BR]]
64 4 Niels Petter Rasch-Olsen
65 8 Niels Petter Rasch-Olsen
file.seek(0) #Back to start[[BR]]
66
framebuffer = file.read(frame_size)[[BR]]
67
rgb_buffer = decoder.decode_full_frame(framebuffer)[[BR]]
68
#Now the rgb buffer can be drawn to screen, check out gtk package[[BR]]
69
}}}
70 1
71
72
Enjoy! [[BR]]
73
[mailto:nielsr@ifi.uio.no Niels Petter Rasch-Olsen]