Tuesday, July 13, 2004

linux:: exporting audio and video

Suppose you want to export audio/video from system REMOTE (where you are unning your application say mplayer), to another system LOCAL (where you want to see it and hear it).
The scenerio is : you are working on system LOCAL. From there you logon to system REMOTE (say using ssh). You want to run mplayer on system REMOTE, and want to watch a movie. And obviously want to hear the audio.

exporting video ( called DISPLAY )
-----------------------------------
you want to open display of REMOTE on LOCAL.
LOCAL should allow REMOTE to open display on LOCAL
for that on local we do

LOCAL$ xhost +REMOTE_IP

REMOTE_IP is the ip of REMOTE system
+REMOTE_IP means you are adding REMOTE to the access list of exporting display
$xhost + means you are allowing eveyone to export display to your system

now you can export display from REMOTE to LOCAL by

REMOTE$ export DISPLAY=LOCAL_IP:0.0

LOCAL_IP is the ip of the LOCAL system
:0.0 means the display number of LOCAL system
the default display opened is 0, so works most of the times
if your display is something else then you need to give that ex
LOCAL_IP:2.0 for display 2
** i dont know what does .0 mean (why other 0 after dot)

now you can see the video of mplayer running on REMOTE system on your LOCAL system,

REMOTE$ mplayer movie.avi



expoting audio ( sound )
------------------------
unlike display there is no native way of exporting audio
so we export sound using arts, esd, etc, which sends the stream from remote using tcp on some port and is recieved by at the other end at that port, and played.
what audio modules do you have - arts/esd/oss/sdl/etc ??
exporting sound is dependent on what mode you want to use and what modes do you have

using arts
----------

start arts server on LOCAL system, in listening mode on port 5001

LOCAL$ artsd -u -n -p 5001

-u means public => no authentication => dangerous

now export arts sound from REMOTE to LOCAL

REMOTE$ export ARTS_SERVER=LOCAL_IP:5001

5001 is the port where arts server is running on LOCAL system
while running your application make sure that its using arts as sound output in your appplication (in mplayer we give -ao arts )

REMOTE$ mplayer movie.avi -ao arts


using esd
---------

start esd on LOCAL sysem, in listening mode on port 5001

LOCAL$ esd -public -tcp --port 5001

now export esd sound from REMOTE to LOCAL

REMOTE$ export ESPEAKER=LOCAL_IP:5001

5001 is the port where esd server is running on LOCAL system
while running your application make sure that its using esd as sound output in your appplication (in mplayer we give -ao esd )

REMOTE$ mplayer movie.avi -ao esd

Some applications don't speak esd.So we fools them into talking to esd when they think they're opening dsp. This is done using esddsp in the following way ( assume your mplayer does not supprt esd )

$ esddsp -v --server=LOCAL_IP:5001 mplayer movie.avi


i don't know how can sound be exported using other sound systems like oss,sdl etc.


--
pkill -9 pkill
http://students.iiit.ac.in/~sunilmohan/