Annotation of libsoftmpeg/README, revision 1.5
1.1 hunold 1: libsoftmpeg
2: ===========
3:
4: 1) The idea
5: -----------
6:
1.2 hunold 7: Many people have recently decided to work on software only mpeg
8: decoderes. The goal is to have a cheap DVB x86 box with vdr or MythTV
9: on it, but only using a so-called budget DVB card without onboard mpeg
10: decoder.
1.1 hunold 11:
12: 2) The problems
13: ---------------
14:
1.2 hunold 15: The "linuxtv-softmpeg" project tries to provide the "libsoftmpeg"
16: library, a thin library on top of existing technologies that adresses
17: the following problems:
1.1 hunold 18:
19: - low-delay buffering (for fast channel switches)
20: - mpeg audio decoding
21: - audio and video syncronization
22: - audio rendering
23: - video rendering
24: - long term playback stability
25:
26: 3) Existing "solutions"
27: -----------------------
28:
1.2 hunold 29: In the past, there have been different approaches to solve these
30: problems, but they are not quite satisfying yet.
1.1 hunold 31:
1.2 hunold 32: For example, while "mplayer" and "xine" are excellent movie players,
33: they use huge buffers for buffering and therefore make channel
34: switching nearly unbearable. Additionally, they lack long-term
35: stability, because they don't synchronize to the incoming stream and
36: buffer over- and underrums quite frequently occur. (see below for
37: details)
38:
39: The "softdevice" plugin from VDR is on the right way, but unfortunately
40: it is bound to VDR. Other projects like "mythtv" and the like need to
41: duplicate the code or invent the wheel again,
1.1 hunold 42:
43: 4) libsoftmpeg
44: --------------
45:
1.2 hunold 46: In order to use this project, you need:
47:
1.5 ! hunold 48: - DirectFB and a supported gfx adapter (cle266 or Matrox G200/4x0/5x0
! 49: is fine, vesafb is only enough if you have a horibbly fast machine ;-)
1.2 hunold 50:
51: - FusionSound, which needs OSS or ALSA (with oss emulation) sound
52: drivers
53:
1.1 hunold 54: - libavcodec, version 0.4.8 from http://ffmpeg.sf.net is fine
55:
56: "libsoftmpeg" already does the following:
57:
1.2 hunold 58: - low-delay buffering for audio and video, adjustable audio
59: prebuffering (currently 500ms, channel switching is usually done in
60: less than a second)
1.1 hunold 61:
62: - mpeg audio decoding via libavcodec from "ffmpeg" project
63:
64: - mpeg video decoding via libavcodec from "ffmpeg" project
65:
1.2 hunold 66: - audio and video synchronization using a "sync-to-audio-pts" approach
67: and "free flowing video display" (see below for a detailed description
68: of my ideas)
69:
70: - video rendering using DirectFB (http://www.directfb.org), a thin
71: library ontop of the Linux framebuffer device. DirectFB hosts a
72: "cle266" driver which drives the tv out of the EPIA/cle266 boards very
73: well
74:
75: - audio rendering using FusionSound
76: (http://www.directfb.org/fusionsound.xml), a thin library on top of
77: DirectFB and Fusion (fast interprocess communication), which supports
78: sound mixing, pitch adjustment and other neat features. Sound mixing is
79: very important, other applications can overlay system sounds onto the
80: live tv audio.
1.1 hunold 81:
82: 4) How to get it to work
83: ------------------------
84:
1.5 ! hunold 85: Currently, there is
1.4 hunold 86:
1.5 ! hunold 87: - a demonstration application called "dfb_ts" that reads from the
! 88: DVR device or a recorded transport stream (.TS file) from a file
! 89: and displays that using DirectFB and FusionSound
1.4 hunold 90:
1.5 ! hunold 91: - a vdr plugin called "softmpeg".
1.4 hunold 92:
1.5 ! hunold 93: Most likely you'll get warnings like this when using "libsoftmpeg":
! 94: (!!!) *** CAUTION [device buffer underrun?] *** core_sound.c (354)
1.2 hunold 95:
96: Please apply the "fusionsound_realtimepriority_reset_on_flush.diff"
1.5 ! hunold 97: patch to FusionSound and compile again.
! 98:
! 99: > cd ../FusionSound
! 100: > patch -p0 < ../libsoftmpeg/fusionsound_realtimepriority_reset_on_flush.diff
! 101: > make && make install
! 102:
! 103: This adds realtime priority to the audio feeding thread. If you omit
! 104: this, the audio thread might starve and sound will be jerky.
1.2 hunold 105:
1.3 hunold 106: Before you proceed, make sure that your framebuffer device is set
107: to 720x576 at 50Hz refresh rate. A suitable fb modes entry looks like
108: this:
109: mode "720x576-50"
110: geometry 720 576 720 576 16
111: timings 31208 144 40 32 10 128 3
112: endmode
113:
114: Make sure to use "fbset -a 720x576-50" after each startup -- the sync code
115: currently relies on this.
116:
1.4 hunold 117: 4a) "dfb_ts"
118: ------------
119:
120: If you do a "./autogen.sh ; make install" you'll get a demo application
1.2 hunold 121: called "dfb_ts", which reads a transport stream from the DVB dvr
122: device. You need to tune your frontend with "szap" for example and
1.4 hunold 123: redirect the data to the dvr device with the "-r" switch.
124:
125: For example:
1.1 hunold 126:
127: > szap -r "Das Erste"
1.2 hunold 128:
129: Then you can start the demo application and provide the video and audio
130: pids for the service you like to watch (have a look at "szap", it tells
131: you the correct pids):
132:
1.1 hunold 133: > ./dfb_ts /dev/dvb/adapter0/dvr0 0x7ff 0x800
134:
1.4 hunold 135: 4b) The vdr plugin "softmpeg"
136: -----------------------------
137:
138: There is a vdr plugin called "softmpeg" in the "softmpeg" directory,
139: which basically works (osd is supported, too) but is in very alpha
140: stage.
141:
142: First copy the whole directory the source directory of you vdr installation:
143: (Substitute <vdr-dir> with the name of your main vdr directory)
144:
145: > cp -r softmpeg <vdr-dir>/PLUGINS/SRC/
146:
147: Then you need to rebuild all plugins:
148:
149: > cd <vdr-dir>
150: > make plugins
151:
152: Then you can run vdr and tell it to use the softmpeg plugin to display
153: the output:
154:
155: > ./vdr -P"softmpeg"
156:
157: If you cannot see any overlay windows, try to set the environment variable
158: DIRECTFB_VIDEO_IS_OVERLAY like this and start again:
159:
160: > export DIRECTFB_VIDEO_IS_OVERLAY=1
161:
1.1 hunold 162: 4) The future
163: ------------------------
164:
1.2 hunold 165: What's currently completely missing is long-term playback stability. As
166: you probably know, the problem arises due to the different clocks used
167: for dvb encoding and decoding. See below for a detailed description of
168: the problem and my ideas on how it can be solved on x86.
169:
170: The next major step would be to add the ideas of long-term playback
171: stability and the cle266 mpeg decoder stuff to the library, so that
172: EPIA users can use the hardware acceleration.
173:
174: "IDEAS" contains a description of the concepts currently implemented
175: for audio/video synchronization and the ideas for long-term playback
176: stability.
1.1 hunold 177:
178: 5) If you want to participate
179: -----------------------------
180:
1.2 hunold 181: There is a mailing list for this project. Write a mail to
182: <ecartis@linuxtv.org> with "subscribe linuxtv-softmpeg" in the subject
183: to subscribe.
LinuxTV legacy CVS <linuxtv.org/cvs>