[MPlayer-users] Segmented streaming and mplayer

Kristian R. Evensen kristrev at simula.no
Sat Sep 10 11:33:54 CEST 2011


Hi,

I am currently playing around with segmented streaming (HTTP Live
Streaming) and mplayer. Each segment is encoded in different rates and
is independent. That is, there are no decoding dependencies between
the segments. Mpeg2ts is used as the container. Because I would like
to evaluate the performance of different data retrieval techniques, my
plan was to implement these in a separate application and then pass
the data along to mplayer. However, I have not been successful in
achieving the latter. I have tried the following three techniques,
which were the ones I was able to design based on my knowledge of
mplayer:

- The retrieval application writes each segment to a separate file,
while mplayer is running in slave mode. These are then added to a
playlist using "loadfile <filename> 1". This works, however, there is
a large gap in between each segment, which seems to be caused by
mplayer having to restart playback entirely. Using -fixed-vo (this tip
was found here: http://zmei.jeox.com/wordpress/?p=62) seems to improve
the situation, however, I suspect this is just an illusion caused by
the playback window not being closed.

- The retrieval application writes the received data to stdout and the
output is piped into mplayer. This also works, however, there is a gap
between each segment here as well. The length of the gap is reduced by
using -autosync 30, but it is still there. Without autosync, mplayer
outputs the "Your computer is too slow ..." message and the audio
plays in the background, while the video does not appear before after
a long while and only a few frames are played.

- The retrieval application writes each segment to the same file and
this file is monitored using inotify. The file is added to a playlist
using "loadfile <filename> 1", and if the application detects that the
file is closed (i.e., data was not received fast enough for mplayer),
a new file is opened. This works, however, it adds a significant
overhead and is not very reliable.

What I would like, is for mplayer to, for example, treat a file as a
continuous buffer and keep reading from it even if EOF is reached
(using a timeout to avoid 100% CPU usage). My questions are:

- Is it possible to make mplayer just keep (attempting to) reading
from a file using command line parameters or does the mplayer code
have to be patched? Would this be difficult to add?
- Is it possible to tell mplayer to start preloading (including
decoding) the segments added to the playlist? This should hopefully
remove the gap between segments.
- Are there any other techniques or tricks I could try? Or does anyone
have any experience with mplayer and segmented streaming?

Thanks in advance,
Kristian


More information about the MPlayer-users mailing list