Discussion:
Any way to run mplayer continuously for analog rebroadcasting?
Brian Thompson
2006-05-09 19:41:06 UTC
Permalink
Hi, we're currently using mplayer to decode a video stream
from another university on a 24/7 basis and using the matrox
G550 tv-out to rebroadcast the stream in analog form to quite
a few locations over an existing CATV system. The stream
that is being provided to us is divided up by program/event.
This makes mplayer quit at the end of each event.

At the moment we just have a script which simply restarts
mplayer after the end of each event. This is causing several
minor problems though:

a) We're using "-cache 1024 -cache-min 40" which causes
a few seconds of delay before the matrox tv-out starts outputting
video at the start of each event. At the start of each event while
the buffer is filling to the 40% mark, the matrox tv-out doesn't
send out proper NTSC sync, which is seen as an unprofessional
glitch between each event.

b) It takes a while at the end of each event for the buffer to
empty. That amount of video is then lost at the beginning
of the next event since the next event has already started to
stream to us and we're still playing the buffered portion of the
previous event (the next mplayer process hasn't started yet
on our end).

It would be ideal if there was a way to keep mplayer from
quiting at the end of an event and try to reopen the same
stream, preferably while the remaining buffer is still playing
in order to avoid the loss of the first few seconds of the next
event. If no content is available or while it's trying to reopen
the URL and refill it's cache, the matrox card would output
a blank/black tv-out image with proper sync.

Does such a "continuous mode" exist and I'm just not able
to find it in the command line options, or is this something that
can be requested for a future release?

Thanks for any input/suggestions.

-Brian

Brian Thompson
College of Engineering
Wayne State University
Detroit, MI USA
brian [@] eng.wayne.edu
Attila Kinali
2006-05-09 19:53:07 UTC
Permalink
On Tue, 09 May 2006 15:41:06 -0400
Post by Brian Thompson
It would be ideal if there was a way to keep mplayer from
quiting at the end of an event and try to reopen the same
stream,
This can be done if you use -idle in combination with -fixed-vo
(I'm not sure whether -fixed-vo works correctly with (x)mga
as i cannot test it currently, if it doesn't let me know)
Post by Brian Thompson
preferably while the remaining buffer is still playing
in order to avoid the loss of the first few seconds of the next
event.
This can be solved using -slave interface. See the documentation
of the loadfile command in DOCS/tech/slave.txt.
Though i'm not sure whether MPlayer starts to buffer a stream
while another is still running.
Post by Brian Thompson
If no content is available or while it's trying to reopen
the URL and refill it's cache, the matrox card would output
a blank/black tv-out image with proper sync.
Hmm.. this is a bit more tricky. You'd have to manualy
insert a black image. Maybe using loadfile and a black
gif/jpeg could do the trick. Otherwise when using -fixed-vo
the last shown frame stays on, which is probably not what you want.
Post by Brian Thompson
Does such a "continuous mode" exist and I'm just not able
to find it in the command line options, or is this something that
can be requested for a future release?
I think you can hack something together with the above suggestions.
If it doesn't help or you encounter other problems, please let me know.

Attila Kinali
--
心をこめて聞け心をこめて話せ
Brian Thompson
2006-05-10 00:00:56 UTC
Permalink
Attila, thanks for the info. I'm trying to go in this direction but it
looks
like the -fixed-vo and -idle flags are only available in the CVS version
of mplayer and I've run into a new problem trying to use the CVS
version of mplayer instead of mplayer-1.0pre7try2. I can't seem to get
any audio from the CVS version. I've tried quite a few of the additional
audio filter flags over the past several hours but nothing seems to help.

I admit neither of the following outputs look perfect, but the first one
(mplayer-1.0pre7try2) does work. I'm using "-ao alsa" with no additional
audio parameters in both of the following cases. The sound card is a
USB Edirol UA-25. Anyone have any idea what I might be doing wrong?
Thanks in advance for any suggestions.

With mplayer-1.0pre7try2 I get the following and audio works fine:

Checking audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
[libaf] Adding filter dummy
[dummy] Was reinitialized: 48000Hz/2ch/s16le
AF_pre: 48000Hz/2ch/s16le
alsa-init: requested format: 48000 Hz, 2 channels, 9
alsa-init: compiled for ALSA-1.0.8
alsa-init: setup for 1/2 channel(s)
alsa-init: 1 soundcard found, using: default
alsa-init: pcm opend in block-mode
alsa-init: format s16le are not supported by hardware, trying default
alsa-init: unable to set format: Invalid argument
alsa-init: chunksize set to 1024
alsa-init: fragcount=16
alsa-init: got buffersize=65536
alsa: 44100 Hz/2 channels/4 bpf/65536 bytes buffer/Signed 16 bit Little
Endian
AO: [alsa] 44100Hz 2ch s16le (2 bps)
AO: Description: ALSA-0.9.x-1.x audio output
AO: Author: Alex Beregszaszi, Zsolt Barat <***@streamminister.de>
AO: Comment: under developement
Building audio filter chain for 48000Hz/2ch/s16le -> 44100Hz/2ch/s16le...
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[libaf] Adding filter resample
[resample] Changing sample rate to 44100Hz
[resample] Changing sample rate to 44100Hz
[resample] Using linear interpolation.
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[resample] Using linear interpolation.
Starting playback...
alsa-space: free space = 65536, prepared --
[libaf] Reallocating memory in module resample, old len = 0, new len = 60212


With the latest CVS version of mplayer I get the following and no audio:

Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...
[libaf] Adding filter dummy
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[dummy] Was reinitialized: 48000Hz/2ch/s16le
alsa-init: requested format: 48000 Hz, 2 channels, 9
alsa-init: using ALSA 1.0.8
alsa-init: setup for 1/2 channel(s)
alsa-init: using device default
alsa-init: pcm opend in blocking mode
alsa-init: format s16le are not supported by hardware, trying default
alsa-init: unable to set format: Invalid argument
Could not open/initialize audio device -> no sound.
Uninit audio filters...
[libaf] Removing filter dummy
Uninit audio: dmo
Audio: no sound
Freeing 0 unused audio chunks.
Starting playback...

-Brian
Post by Attila Kinali
On Tue, 09 May 2006 15:41:06 -0400
Post by Brian Thompson
It would be ideal if there was a way to keep mplayer from
quiting at the end of an event and try to reopen the same
stream,
This can be done if you use -idle in combination with -fixed-vo
(I'm not sure whether -fixed-vo works correctly with (x)mga
as i cannot test it currently, if it doesn't let me know)
Post by Brian Thompson
preferably while the remaining buffer is still playing
in order to avoid the loss of the first few seconds of the next
event.
This can be solved using -slave interface. See the documentation
of the loadfile command in DOCS/tech/slave.txt.
Though i'm not sure whether MPlayer starts to buffer a stream
while another is still running.
Post by Brian Thompson
If no content is available or while it's trying to reopen
the URL and refill it's cache, the matrox card would output
a blank/black tv-out image with proper sync.
Hmm.. this is a bit more tricky. You'd have to manualy
insert a black image. Maybe using loadfile and a black
gif/jpeg could do the trick. Otherwise when using -fixed-vo
the last shown frame stays on, which is probably not what you want.
Post by Brian Thompson
Does such a "continuous mode" exist and I'm just not able
to find it in the command line options, or is this something that
can be requested for a future release?
I think you can hack something together with the above suggestions.
If it doesn't help or you encounter other problems, please let me know.
Attila Kinali
Brian Thompson
2006-05-10 00:25:52 UTC
Permalink
Ok, audio is working again although the solution is ugly.
I copied ./libao2/ao_alsa.c from the mplayer-1.0pre7try2 source
tree to the CVS source tree and then recompiled the CVS version.
The output I'm now getting is the following and the audio works.

Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...
[libaf] Adding filter resample
[resample] Changing sample rate to 44100Hz
[resample] Using linear interpolation.
[resample] Using linear interpolation.
alsa-init: requested format: 44100 Hz, 2 channels, 9
alsa-init: compiled for ALSA-1.0.8
alsa-init: setup for 1/2 channel(s)
alsa-init: 1 soundcard found, using: default
alsa-init: pcm opend in block-mode
alsa-init: format s16le are not supported by hardware, trying default
alsa-init: unable to set format: Invalid argument
alsa-init: chunksize set to 1024
alsa-init: fragcount=16
alsa-init: got buffersize=65536
alsa: 44100 Hz/2 channels/4 bpf/65536 bytes buffer/Signed 16 bit Little
Endian
AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)
AO: Description: ALSA-0.9.x-1.x audio output
AO: Author: Alex Beregszaszi, Zsolt Barat <***@streamminister.de>
AO: Comment: under developement
Building audio filter chain for 48000Hz/2ch/s16le -> 44100Hz/2ch/s16le...
[resample] Using linear interpolation.
[resample] Using linear interpolation.
Starting playback...
alsa-space: free space = 65536, prepared --
[libaf] Reallocating memory in module resample, old len = 0, new len = 60212

-Brian
Post by Brian Thompson
Attila, thanks for the info. I'm trying to go in this direction but it
looks
like the -fixed-vo and -idle flags are only available in the CVS version
of mplayer and I've run into a new problem trying to use the CVS
version of mplayer instead of mplayer-1.0pre7try2. I can't seem to get
any audio from the CVS version. I've tried quite a few of the additional
audio filter flags over the past several hours but nothing seems to help.
I admit neither of the following outputs look perfect, but the first one
(mplayer-1.0pre7try2) does work. I'm using "-ao alsa" with no additional
audio parameters in both of the following cases. The sound card is a
USB Edirol UA-25. Anyone have any idea what I might be doing wrong?
Thanks in advance for any suggestions.
Checking audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
[libaf] Adding filter dummy
[dummy] Was reinitialized: 48000Hz/2ch/s16le
AF_pre: 48000Hz/2ch/s16le
alsa-init: requested format: 48000 Hz, 2 channels, 9
alsa-init: compiled for ALSA-1.0.8
alsa-init: setup for 1/2 channel(s)
alsa-init: 1 soundcard found, using: default
alsa-init: pcm opend in block-mode
alsa-init: format s16le are not supported by hardware, trying default
alsa-init: unable to set format: Invalid argument
alsa-init: chunksize set to 1024
alsa-init: fragcount=16
alsa-init: got buffersize=65536
alsa: 44100 Hz/2 channels/4 bpf/65536 bytes buffer/Signed 16 bit
Little Endian
AO: [alsa] 44100Hz 2ch s16le (2 bps)
AO: Description: ALSA-0.9.x-1.x audio output
AO: Comment: under developement
Building audio filter chain for 48000Hz/2ch/s16le -> 44100Hz/2ch/s16le...
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[libaf] Adding filter resample
[resample] Changing sample rate to 44100Hz
[resample] Changing sample rate to 44100Hz
[resample] Using linear interpolation.
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[resample] Using linear interpolation.
Starting playback...
alsa-space: free space = 65536, prepared --
[libaf] Reallocating memory in module resample, old len = 0, new len = 60212
Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...
[libaf] Adding filter dummy
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[dummy] Was reinitialized: 48000Hz/2ch/s16le
alsa-init: requested format: 48000 Hz, 2 channels, 9
alsa-init: using ALSA 1.0.8
alsa-init: setup for 1/2 channel(s)
alsa-init: using device default
alsa-init: pcm opend in blocking mode
alsa-init: format s16le are not supported by hardware, trying default
alsa-init: unable to set format: Invalid argument
Could not open/initialize audio device -> no sound.
Uninit audio filters...
[libaf] Removing filter dummy
Uninit audio: dmo
Audio: no sound
Freeing 0 unused audio chunks.
Starting playback...
-Brian
Post by Attila Kinali
On Tue, 09 May 2006 15:41:06 -0400
Post by Brian Thompson
It would be ideal if there was a way to keep mplayer from
quiting at the end of an event and try to reopen the same
stream,
This can be done if you use -idle in combination with -fixed-vo
(I'm not sure whether -fixed-vo works correctly with (x)mga
as i cannot test it currently, if it doesn't let me know)
Post by Brian Thompson
preferably while the remaining buffer is still playing
in order to avoid the loss of the first few seconds of the next
event.
This can be solved using -slave interface. See the documentation
of the loadfile command in DOCS/tech/slave.txt.
Though i'm not sure whether MPlayer starts to buffer a stream
while another is still running.
Post by Brian Thompson
If no content is available or while it's trying to reopen
the URL and refill it's cache, the matrox card would output
a blank/black tv-out image with proper sync.
Hmm.. this is a bit more tricky. You'd have to manualy
insert a black image. Maybe using loadfile and a black
gif/jpeg could do the trick. Otherwise when using -fixed-vo
the last shown frame stays on, which is probably not what you want.
Post by Brian Thompson
Does such a "continuous mode" exist and I'm just not able
to find it in the command line options, or is this something that
can be requested for a future release?
I think you can hack something together with the above suggestions.
If it doesn't help or you encounter other problems, please let me know.
Attila Kinali
_______________________________________________
MPlayer-matrox mailing list
http://mplayerhq.hu/mailman/listinfo/mplayer-matrox
Brian Thompson
2006-05-10 00:29:36 UTC
Permalink
Forgot to mention that I also had to add "-af resample=44100:0:0"
to the CVS version command line, where that wasn't necessary with
the on mplayer-1.0pre7try2 version command line.

-Brian
Post by Brian Thompson
Ok, audio is working again although the solution is ugly.
I copied ./libao2/ao_alsa.c from the mplayer-1.0pre7try2 source
tree to the CVS source tree and then recompiled the CVS version.
The output I'm now getting is the following and the audio works.
Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...
[libaf] Adding filter resample
[resample] Changing sample rate to 44100Hz
[resample] Using linear interpolation.
[resample] Using linear interpolation.
alsa-init: requested format: 44100 Hz, 2 channels, 9
alsa-init: compiled for ALSA-1.0.8
alsa-init: setup for 1/2 channel(s)
alsa-init: 1 soundcard found, using: default
alsa-init: pcm opend in block-mode
alsa-init: format s16le are not supported by hardware, trying default
alsa-init: unable to set format: Invalid argument
alsa-init: chunksize set to 1024
alsa-init: fragcount=16
alsa-init: got buffersize=65536
alsa: 44100 Hz/2 channels/4 bpf/65536 bytes buffer/Signed 16 bit
Little Endian
AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)
AO: Description: ALSA-0.9.x-1.x audio output
AO: Comment: under developement
Building audio filter chain for 48000Hz/2ch/s16le -> 44100Hz/2ch/s16le...
[resample] Using linear interpolation.
[resample] Using linear interpolation.
Starting playback...
alsa-space: free space = 65536, prepared --
[libaf] Reallocating memory in module resample, old len = 0, new len = 60212
-Brian
Post by Brian Thompson
Attila, thanks for the info. I'm trying to go in this direction but
it looks
like the -fixed-vo and -idle flags are only available in the CVS version
of mplayer and I've run into a new problem trying to use the CVS
version of mplayer instead of mplayer-1.0pre7try2. I can't seem to get
any audio from the CVS version. I've tried quite a few of the additional
audio filter flags over the past several hours but nothing seems to help.
I admit neither of the following outputs look perfect, but the first one
(mplayer-1.0pre7try2) does work. I'm using "-ao alsa" with no additional
audio parameters in both of the following cases. The sound card is a
USB Edirol UA-25. Anyone have any idea what I might be doing wrong?
Thanks in advance for any suggestions.
Checking audio filter chain for 48000Hz/2ch/s16le ->
48000Hz/2ch/s16le...
[libaf] Adding filter dummy
[dummy] Was reinitialized: 48000Hz/2ch/s16le
AF_pre: 48000Hz/2ch/s16le
alsa-init: requested format: 48000 Hz, 2 channels, 9
alsa-init: compiled for ALSA-1.0.8
alsa-init: setup for 1/2 channel(s)
alsa-init: 1 soundcard found, using: default
alsa-init: pcm opend in block-mode
alsa-init: format s16le are not supported by hardware, trying default
alsa-init: unable to set format: Invalid argument
alsa-init: chunksize set to 1024
alsa-init: fragcount=16
alsa-init: got buffersize=65536
alsa: 44100 Hz/2 channels/4 bpf/65536 bytes buffer/Signed 16 bit
Little Endian
AO: [alsa] 44100Hz 2ch s16le (2 bps)
AO: Description: ALSA-0.9.x-1.x audio output
AO: Comment: under developement
Building audio filter chain for 48000Hz/2ch/s16le ->
44100Hz/2ch/s16le...
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[libaf] Adding filter resample
[resample] Changing sample rate to 44100Hz
[resample] Changing sample rate to 44100Hz
[resample] Using linear interpolation.
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[resample] Using linear interpolation.
Starting playback...
alsa-space: free space = 65536, prepared --
[libaf] Reallocating memory in module resample, old len = 0, new len = 60212
Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...
[libaf] Adding filter dummy
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[dummy] Was reinitialized: 48000Hz/2ch/s16le
alsa-init: requested format: 48000 Hz, 2 channels, 9
alsa-init: using ALSA 1.0.8
alsa-init: setup for 1/2 channel(s)
alsa-init: using device default
alsa-init: pcm opend in blocking mode
alsa-init: format s16le are not supported by hardware, trying default
alsa-init: unable to set format: Invalid argument
Could not open/initialize audio device -> no sound.
Uninit audio filters...
[libaf] Removing filter dummy
Uninit audio: dmo
Audio: no sound
Freeing 0 unused audio chunks.
Starting playback...
-Brian
Post by Attila Kinali
On Tue, 09 May 2006 15:41:06 -0400
Post by Brian Thompson
It would be ideal if there was a way to keep mplayer from
quiting at the end of an event and try to reopen the same
stream,
This can be done if you use -idle in combination with -fixed-vo
(I'm not sure whether -fixed-vo works correctly with (x)mga
as i cannot test it currently, if it doesn't let me know)
Post by Brian Thompson
preferably while the remaining buffer is still playing
in order to avoid the loss of the first few seconds of the next
event.
This can be solved using -slave interface. See the documentation
of the loadfile command in DOCS/tech/slave.txt.
Though i'm not sure whether MPlayer starts to buffer a stream
while another is still running.
Post by Brian Thompson
If no content is available or while it's trying to reopen
the URL and refill it's cache, the matrox card would output
a blank/black tv-out image with proper sync.
Hmm.. this is a bit more tricky. You'd have to manualy
insert a black image. Maybe using loadfile and a black
gif/jpeg could do the trick. Otherwise when using -fixed-vo
the last shown frame stays on, which is probably not what you want.
Post by Brian Thompson
Does such a "continuous mode" exist and I'm just not able
to find it in the command line options, or is this something that
can be requested for a future release?
I think you can hack something together with the above suggestions.
If it doesn't help or you encounter other problems, please let me know.
Attila Kinali
_______________________________________________
MPlayer-matrox mailing list
http://mplayerhq.hu/mailman/listinfo/mplayer-matrox
_______________________________________________
MPlayer-matrox mailing list
http://mplayerhq.hu/mailman/listinfo/mplayer-matrox
Attila Kinali
2006-05-10 06:34:44 UTC
Permalink
Moin,

On Tue, 09 May 2006 20:00:56 -0400
Post by Brian Thompson
Attila, thanks for the info. I'm trying to go in this direction but it
looks
like the -fixed-vo and -idle flags are only available in the CVS version
of mplayer and I've run into a new problem trying to use the CVS
version of mplayer instead of mplayer-1.0pre7try2.
Yes, pre7 is an ancient release. pre8 should be released this
week.
Post by Brian Thompson
I can't seem to get
any audio from the CVS version. I've tried quite a few of the additional
audio filter flags over the past several hours but nothing seems to help.
I admit neither of the following outputs look perfect, but the first one
(mplayer-1.0pre7try2) does work. I'm using "-ao alsa" with no additional
audio parameters in both of the following cases. The sound card is a
USB Edirol UA-25. Anyone have any idea what I might be doing wrong?
Thanks in advance for any suggestions.
Hmm.. There is either a bug in MPlayer (most likely) or
one in your alsa system that MPlayer triggers. Can you
follow bugreports.html and send a proper bugerport to
mplayer-users?

As a workaround i suggest using oss emulation of alsa,
which is in a lot of cases more stable than the direct
alsa output. IIRC you need to load the snd_oss_pcm and
snd_oss_mixer modules, then user -ao oss

Attila Kinali

PS: please do not top post and use proper quoting
--
心をこめて聞け心をこめて話せ
Loading...