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