Prosjekt

Generell

Profil

WikiStart » Historikk » Versjon 26

Christian Skarby, 07.04.2011 12:04

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