Prosjekt

Generell

Profil

WikiStart » Historikk » Versjon 25

Niels Petter Rasch-Olsen, 11.05.2006 16:17

1 25 Niels Petter Rasch-Olsen
2
h1. Welcome to pylibdv-0.1
3
4 13 Niels Petter Rasch-Olsen
[[PageOutline]]
5 23 Niels Petter Rasch-Olsen
6 1
7
8
9 25 Niels Petter Rasch-Olsen
h2. Background
10
11
pylibdv is a project for one of my university courses; "INF5660 - Advanced problem solving with high level languages":http://www.uio.no/studier/emner/matnat/ifi/INF5660/index-eng.xml.
12
13
pylibdv is a python wrapper for "libdv":http://libdv.sourceforge.net/.
14
15 1
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."
16
17 25 Niels Petter Rasch-Olsen
18
h2. Download
19
20
You can find the project as pylibdv-0.1.tar.gz here: "download":https://dev.interhost.no/pylibdv/browser/download/pylibdv-0.1.tar.gz?format=raw
21
22
h2. Overview of package
23
24
<pre>
25 1
pylibdv-0.1/src/pylibdv.c
26
pylibdv-0.1/src/pylibdv.h
27
pylibdv-0.1/frame_viewer/frame-viewer.py
28 16 Niels Petter Rasch-Olsen
pylibdv-0.1/example/parse_decode.py
29 1
pylibdv-0.1/dv/test.dv
30 15 Niels Petter Rasch-Olsen
pylibdv-0.1/testing.py
31 1
pylibdv-0.1/setup.py
32
pylibdv-0.1/README
33 25 Niels Petter Rasch-Olsen
</pre>
34 1
35 25 Niels Petter Rasch-Olsen
36
h2. Setup
37
38 1
use setup.py to install package.
39
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.
40 25 Niels Petter Rasch-Olsen
<pre>
41 1
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)
42
pylibdv-0.1/python setup.py install (requires root)
43 25 Niels Petter Rasch-Olsen
</pre>
44 1
45 25 Niels Petter Rasch-Olsen
46
h2. Testing
47
48 1
To run the tests simply use pylibdv-0.1/python testing.py
49
50 25 Niels Petter Rasch-Olsen
Uses "doctest":http://docs.python.org/lib/module-doctest.html. 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 "Known Bugs":https://dev.interhost.no/pylibdv/wiki/WikiStart#Knownbugs for more information.
51 1
52
53 25 Niels Petter Rasch-Olsen
h2. Requirements
54
55
libdv 1.4 (works with debian package 0.104-2 from debian repository)
56
57
python >= 2.4 (testing.py won't work with 2.3, doctest will fail due to a bug in 2.3)
58
59
gcc
60
61
62
63
h2. Known bugs
64
65 1
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.
66
67
The doctest suite doesn't seem to find the two tests belonging to the Decoder, only the pylibdv tests are performed.
68
69
70 25 Niels Petter Rasch-Olsen
h2. Progress
71
72
So far the following is available:
73
74
75 1
pylibdv:
76
  Constants:
77 25 Niels Petter Rasch-Olsen
    DV_QUALITY_BEST
78
79
    DV_QUALITY_FASTEST
80
81
    DV_QUALITY_COLOR
82
83
    DV_QUALITY_DC
84
85
    DV_QUALITY_AC_1
86
87
    DV_QUALITY_AC_2
88
89
    DV_QUALITY_AC_MASK
90
91
    e_dv_color_rgb
92
93
    e_dv_color_yuv
94
95
    e_dv_color_bgr0
96
97 10 Niels Petter Rasch-Olsen
  Object:
98 25 Niels Petter Rasch-Olsen
    Decoder
99
100 8 Niels Petter Rasch-Olsen
      Methods:
101 25 Niels Petter Rasch-Olsen
        parse_header()
102
103
        decode_full_frame()
104
105 7 Niels Petter Rasch-Olsen
      Data:
106 25 Niels Petter Rasch-Olsen
        frame_size (read only)
107 8 Niels Petter Rasch-Olsen
108 25 Niels Petter Rasch-Olsen
        width (read only)
109 7 Niels Petter Rasch-Olsen
110 25 Niels Petter Rasch-Olsen
        length (read only)
111
112
        quality (read & write)
113
114
115
116 7 Niels Petter Rasch-Olsen
This project is ongoing and most functions will be wrapped by the end of the summer (depending on need).
117 9 Niels Petter Rasch-Olsen
118
119 7 Niels Petter Rasch-Olsen
120 25 Niels Petter Rasch-Olsen
121
h2. Simple example
122
123
<pre>
124 9 Niels Petter Rasch-Olsen
import pylibdv
125
126 4 Niels Petter Rasch-Olsen
decoder = pylibdv.Decoder(ignored=1, clamp_luma=1, clamp_chroma=1) 
127 9 Niels Petter Rasch-Olsen
128
file = open("somedvfile.dv,"r")
129
framebuffer = file.read(120000) # Just enough to make sure
130
131 8 Niels Petter Rasch-Olsen
decoder.parse_header(framebuffer)
132 1
133
# Now we can get some information about the video
134
frame_size = decoder.frame_size
135
width = decoder.width
136
height = decoder.height
137
138
file.seek(0) #Back to start
139
framebuffer = file.read(frame_size)
140
rgb_buffer = decoder.decode_full_frame(framebuffer)
141
#Now the rgb buffer can be drawn to screen, check out gtk package
142 25 Niels Petter Rasch-Olsen
</pre>
143 1
144
145 25 Niels Petter Rasch-Olsen
Enjoy! 
146
147 1
[mailto:nielsr@ifi.uio.no Niels Petter Rasch-Olsen]