Prosjekt

Generell

Profil

WikiStart » Historikk » Versjon 11

Niels Petter Rasch-Olsen, 11.05.2006 14:23

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 11 Niels Petter Rasch-Olsen
libdv 1.4 (works with debian package 0.104-2 from debian repository)[[BR]]
12 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]]
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 10 Niels Petter Rasch-Olsen
pylibdv:
22
  Constants:
23 8 Niels Petter Rasch-Olsen
    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 10 Niels Petter Rasch-Olsen
  Object:
34 8 Niels Petter Rasch-Olsen
    Decoder[[BR]]
35 10 Niels Petter Rasch-Olsen
      Methods:
36 8 Niels Petter Rasch-Olsen
        parse_header()[[BR]]
37
        decode_full_frame()[[BR]]
38 10 Niels Petter Rasch-Olsen
      Data:
39 8 Niels Petter Rasch-Olsen
        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 9 Niels Petter Rasch-Olsen
file = open("somedvfile.dv,"r")
56
framebuffer = file.read(120000) # Just enough to make sure
57 7 Niels Petter Rasch-Olsen
58 9 Niels Petter Rasch-Olsen
decoder.parse_header(framebuffer)
59 7 Niels Petter Rasch-Olsen
60 9 Niels Petter Rasch-Olsen
# Now we can get some information about the video
61
frame_size = decoder.frame_size
62
width = decoder.width
63
height = decoder.height
64 4 Niels Petter Rasch-Olsen
65 9 Niels Petter Rasch-Olsen
file.seek(0) #Back to start
66
framebuffer = file.read(frame_size)
67
rgb_buffer = decoder.decode_full_frame(framebuffer)
68
#Now the rgb buffer can be drawn to screen, check out gtk package
69 8 Niels Petter Rasch-Olsen
}}}
70 1
71
72
Enjoy! [[BR]]
73
[mailto:nielsr@ifi.uio.no Niels Petter Rasch-Olsen]