[MPlayer-dev-eng] [PATCH] using mplayer with ffmpeg asf stream

Philip Grove s973687 at com.dtu.dk
Thu Oct 30 15:23:48 CET 2003


I think the best thing to do based on the MSDN article is to wait and
see when Microsoft realizes that they have made a mistake and change the
MIME types once again. If you look over the MIME type you will realize
that even though .asf and .asx share MIME type, this is the only case
where a media file shares MIME type with its associated redirector file.

For those that are not strong in Windows Media file formats I suggest
reading this as a short introduction.
http://support.microsoft.com/default.aspx?scid=kb;en-us;316992

In the meantime I am not really sure what solution might be the best.
While trying to parse the URL gives you the knowledge before you receive
any data, it gives you a marginally longer delay before the file starts
playing. Deciding on the content of the file means the you have to be
prepared for both kind of data and react while receiving the data based
on the data type. Personally I would prefer neither but if I had to
choose I would go with deciding based on file content, mainly because
with todays fast computers processor power is a smaller thing to worry
about than network capacity.

Philip

-----Original Message-----
From: Dominique Andre Gunia
[mailto:Dominique.Gunia at schunter.etc.tu-bs.de] 
Sent: 30. oktober 2003 01:36
To: mplayer-dev-eng at mplayerhq.hu
Subject: Re: [MPlayer-dev-eng] [PATCH] using mplayer with ffmpeg asf
stream


Hi!

I found something: On 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/h
tml/webserver.asp
MS defines that one has to tell the webserver to associate
video/x-ms-asf with asf files as well as asx files. Therefore
application/octet-stream seems to be obsolete.

Since there is no difference in the Content-Type between a playlist and
a video, one should either decide from the URL or the content of the
stream if this is a URL or an ASF stream.

What do you suggest?

Regards,
Dominique

On Thu, 2003-10-30 at 00:54, Dominique Andre Gunia wrote:
> On Wed, 2003-10-29 at 22:42, Bertrand Baudet wrote:
> 
> Hi!
> 
> This stream can be played with MS WMP (WinXP) without any problems.
> Thats the reason why I though mplayer should be able to play this, too
> :)
> 
> I looked at the source code of asfrecorder.sf.net now. It also does
not
> work with this asf stream until I changed the code to recognize
> video/x-ms-asf as video stream, not as redirector.
> 
> That lets me believe, ffmpeg is wrong in sending it as Content-Type
for
> the asf stream, but then I do not understand how MS WMP can play this
> stream. 
> 
> I now have also found that ffmpeg changed the Content-Type from
> application/octet-stream to video/x-ms-asf in Dezember 2002:
> 
> > (File libavformat/asf.c)
> >  Revision 1.36 / (download) - annotate - [select for diffs] , Fri
Dec 
> > 20 23:10:58 2002 UTC (10 months, 1 week ago) by michaelni
> > Branch: MAIN
> > CVS Tags: release_0_4_6
> > Changes since 1.35: +2 -2 lines
> > Diff to previous 1.35
> > 
> > mimetype fixes patch by (Ryutaroh Matsumoto <ryutaroh at it dot ss
dot
> > titech dot ac dot jp>)
> 
> So probably there was a reason to change this. I will try to ask them
> why they changed it.
> 
> So probably something has to be changed in mplayer to behave like the
MS
> WMP?
> 
> Regards,
> Dominique
> 
> > Hi,
> > 
> > I'm not sure it's ok!
> > 
> > Did you try to connect to a server that redirect you by sending the
same mime 
> > type? I'm not sure it's going to work with your patch.
> > 
> > In addition, I haven't seen a MS WMS that is sending this mime type
for a live 
> > stream.
> > Did you try to connect a MS WMP to this stream? did it work?
> > 
> > Please verify that all cases are handled properly.
> > 
> > Bertrand
> > 
> > On Wednesday 29 October 2003 12:53, Dominique Andre Gunia wrote:
> > > Hi!
> > >
> > > I set up a stream with ffmpeg/ffserver (ffmpeg.sourceforge.net).
It
> > > creates an asf stream that I would like to view with mplayer. The
> > > problem is, that mplayer thinks the asf file would be a playlist
because
> > > of an unknown Content-Type. Details follow:
> > >
> > > When started, I get the following result
> > >
> > > > dom at tng:/tmp$ mplayer -nocache http://schuntille:8090/test.asf
> > > > [...]
> > > > Playing http://schuntille:8090/test.asf
> > > > Resolving schuntille ...
> > > > Connecting to server schuntille[134.169.169.6]:8090 ...
> > > > Resolving schuntille ...
> > > > Connecting to server schuntille[134.169.169.6]:8090 ...
> > > > =====> ASF Redirector
> > > > Connected to server: schuntille
> > > >
> > > >
> > > > MPlayer interrupted by signal 2 in module: handle_playlist
> > >
> > > The http-protocol is something like this:
> > > > dom at tng:/tmp/MPlayer-0.92$ telnet schuntille 8090
> > > > Trying 134.169.169.6...
> > > > Connected to schuntille.schunter.etc.tu-bs.de.
> > > > Escape character is '^]'.
> > > > GET /test.asf HTTP/1.0
> > > > Host: schuntille
> > > >
> > > > HTTP/1.0 200 OK
> > > > Pragma: no-cache
> > > > Server: Cougar 4.1.0.3923
> > > > Cache-Control: no-cache
> > > > Pragma: client-id=1908046342
> > > > Pragma: features="broadcast"
> > > > Content-Type: video/x-ms-asf
> > >
> > > As you can see the Content-Type is video/x-ms-asf but mplayer
expects
> > >
> > > one of these (defined in libmpdemux/asf_stream.c):
> > > > if(!strcasecmp(content_type, "application/octet-stream") ||
> > > > !strcasecmp(content_type, "application/vnd.ms.wms-hdr.asfv1") ||
> > > > !strcasecmp(content_type, "application/x-mms-framed") )
> > >
> > > Since this content type is not defined, it uses the default
behaviour,
> > > which thinks this is a redirector for some browser and tries to
parse it
> > > as playlist, which is simply wrong.
> > >
> > > When I patch the file like this:
> > >
> > > --- main/libmpdemux/asf_streaming.c     2003-09-25
02:36:04.000000000 +0200
> > > +++ main.patched/libmpdemux/asf_streaming.c     2003-10-29
> > > 12:44:32.000000000 +0100 @@ -421,7 +421,8 @@
> > >         if( content_type==NULL ) return ASF_Unknown_e;
> > >         if(     !strcasecmp(content_type,
"application/octet-stream") ||
> > >                 !strcasecmp(content_type,
> > > "application/vnd.ms.wms-hdr.asfv1") ||        // New in Corona,
first
> > > request -               !strcasecmp(content_type,
> > > "application/x-mms-framed") ) {               // New in Corana,
second
> > > request +               !strcasecmp(content_type,
> > > "application/x-mms-framed") ||                // New in Corana,
second
> > > request +               !strcasecmp(content_type,
"video/x-ms-asf")) {
> > >
> > >                 if( strstr(features, "broadcast") ) {
> > >                         mp_msg(MSGT_NETWORK,MSGL_V,"=====> ASF
Live
> > > stream\n");
> > >
> > >
> > > everything is fine. The output is
> > >
> > > > Playing http://schuntille:8090/test.asf
> > > > Resolving schuntille ...
> > > > Connecting to server schuntille[134.169.169.6]:8090 ...
> > > > Resolving schuntille ...
> > > > Connecting to server schuntille[134.169.169.6]:8090 ...
> > > > Resolving schuntille ...
> > > > Connecting to server schuntille[134.169.169.6]:8090 ...
> > > > Cache size set to 0 KBytes
> > > > Connected to server: schuntille
> > > > Stream not seekable!
> > > > ASF file format detected.
> > >
> > > Is this a bug in ffmpeg or in mplayer? If it is a bug in mplayer,
could
> > > you please use this patch for further versions? I found serveral
users
> > > having this problem and no one knew a solution.
> > >
> > > Thanks very much!
> > >
> > > Regards,
> > > Dominique
> > 
> > _______________________________________________
> > MPlayer-dev-eng mailing list
> > MPlayer-dev-eng at mplayerhq.hu
> > http://mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
> 
> 
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/mplayer-dev-eng


_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng at mplayerhq.hu
http://mplayerhq.hu/mailman/listinfo/mplayer-dev-eng



More information about the MPlayer-dev-eng mailing list