[vdr] Building a streaming client

Niko Mikkila nm at phnet.fi
Mon Nov 28 01:52:26 CET 2005

On Sun, 27 Nov 2005 22:46:42 +0000
Simon Baxter <linuxtv at nzbaxters.com> wrote:

> > Simon Baxter <linuxtv at nzbaxters.com> wrote:
> > > What about using the streamdev device with an AniNET124 box?
> > 
> > Last time I looked the streamdev client / server combo wasn't very
> > stable... 
> What have you looked at?
> I've had some success with streamdev 0.3.3 (unicast) and was looking at
> adding VLC to do some multicast - but it's a bit kludgy.
> Really want some way to H.264 encode streams on the fly and mcast them
> out.  Then a small STB to pick them up (like the AmiNET)

Um, are you aware of the processing requirements for that?
For realtime encoding of SDTV at decent quality with x264, you would need
at least an A64 4000+, and preferably two cores. The bitrate savings
over XviD or libavcodec MPEG-4 ASP (that would require only half the CPU time
of x264) would be about 20%. So you could save 50% of the bandwidth compared
to MPEG-2 and end up with smoothed out video (re-encoding tightly packed
DVB broadcasts will make the picture quite bad no matter what bitrate used).
These are just educated guesses based on encoding experiences with x264 and
DVB sources, but this might give you an idea what you're up against if
you haven't tried it out yet. Perhaps re-encoding is worth it in your case,
perhaps not.

Anyway, it could be possible to build a streaming encoder with streamdev-server
and Mencoder. Just set mencoder to encode the http TS stream from streamdev and
output the result as MPEG-TS to a pipe. Then you'll need some kind of a
streaming server that can read the stream and send it out. It could be possible
to do this even with VLC. Channel switching would be a bit tricky though, but
you'd only need to restart Mencoder with another source address. The first
problem would be to get Mencoder write the H.264 video into MPEG-TS. This is
perhaps not even possible with the current implementation. Mencoder could
support H.264 output only as a raw stream and in the AVI container, which is
probably not suitable for streaming.

Mencoder is still your best bet for transcoding because it supports almost all
of the x264 encoding options (unlike VLC for example). If it doesn't work
directly, perhaps the resulting raw H.264 stream could be muxed on the fly
with some other program.

Personally I have tried this the other way around: re-encoding H.264 to MPEG-1
and streaming that out to be able to use lesser machines in the decoding end.
However, I gave up on it after trying out VLC and ffserver. Just couldn't
get the transcoding to work properly. Now I have a script that encodes
the played file on the fly with mencoder and writes the output to a file.
That file can then be simply accessed through NFS. Of course, this won't
help in your case.

Niko Mikkilä

More information about the vdr mailing list