Parsing Real Media .ram files

Nils Kassube kassube at gmx.net
Sat Sep 22 09:12:33 UTC 2007


Peter Garrett wrote:
> The problem I am having with my attempts is that I always get
> apparently "invisible" characters at the end of the URL, which stop
> mplayer from accessing the URL correctly. For example:
>
> $ cat classicfm.ram
> rtsp://202.6.74.108/broadcast/classicfm.rm
> rtsp://202.6.74.108/broadcast/classicfm2.rm
>
>  mplayer $(head -n 1 ~/classicfm.ram)
>
> [snipped output from mplayer]
>
> STREAM_LIVE555, URL: rtsp://202.6.74.108/broadcast/classicfm.rm
> Stream not seekable!
>  file format detected.
> Failed to get a SDP description from URL
> "rtsp://202.6.74.108/broadcast/classicfm.rm%0D": cannot handle DESCRIBE
> response: RTSP/1.0 404 Not Found
>
> The puzzle to me is - where is the "%0D" at the end coming from, and
> how do I get rid of it?
>
> I have tried, for example, adding "cut -d '%' -f 1 " :
>
> mplayer $(head -n 1 ~/classicfm.ram | cut -d '%' -f 1)
>
>  but this doesn't make any difference...

The "%0D" is the mplayer's display of the invisible ASCII 
character "Carriage Return" or "\r" for C programmers. For several 
internet protocols it is quite usual to use "\r\n" as line delimiter, 
while for Unix only "\n" (= ASCII character for "Line Feed") is used.

There is no "%" character in your string. Therefore you can't use it as 
delimiter for cut. Try this instead:

mplayer $(head -1 ~/classicfm.ram|cut -f1 -d$(echo -ne '\r'))


Nils




More information about the ubuntu-users mailing list