[Ffmpeg-devel] Re: HTTP/1.1 Breaks ffserver/ffmpeg combo

Ronald S. Bultje rbultje
Mon Jan 15 15:42:11 CET 2007


Hi,

On Mon, 2007-01-15, Michael Niedermayer wrote:
> On Mon, Jan 15, 2007 at 10:19:12AM +0100, Guillaume POIRIER wrote:
> > Hi,
> > 
> > On 1/15/07, C.Ren Boca <crboca32 at yahoo.com> wrote:
> > >I think the problem is in libavformat/http.c
> > >
> > >I diffed the files between the two svn revisions that I have,   7486, and 
> > >7529, and there are major differences. ffserver and ffmpeg show no diff.
> > >
> > >I really like the ffmpeg/ffserver combo. At one point I had it working 
> > >pretty damn good.
> > 
> > Please use binary search to find the exact revision that broke it. You
> 
> my guess would be that it was the http seeking patch which broke it ...
> if so maybe ronald has a clue why?

I never really looked at HTTP writing. So, since we're doing streaming
here, the very first thing that should be done is to not send out
Content-Range and set is_stream=1 for write-HTTP streams. But I'm not
sure if that's the issue here.

The whole of ffserver currently sends out HTTP/1.0 headers. At least the
OK reply should become HTTP/1.1 (line 1527 in ffserver.c), but we don't
really check that in http.c, so I still don't think that's the problem.
Besides, line 1196 already appears to have basic awareness of the fact
that a client may, in fact, ask for HTTP/1.1.
Somehow, I get the feeling that other parts inside ffserver will still
reject it (although a quick read doesn't really make it obvious to me
where those checks are done yet). I would need to test that to make
sure.

So, I've tried setting up a ffserver locally for testing (i.e. I
transcoded a mp3 to /tmp/gl.ffm using "./ffmpeg
-i /tmp/gl.mp3 /tmp/gl.ffm" and then use the resulting .ffm file for
recorded streaming), but I can't really get it to stream (it segfaulted
when I did a wget http://localhost:8090/gl.mp3 :-), see attached
ffserver.conf), does anyone know how to make this work?

Backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x0806a157 in ffm_set_write_index (s=0x0, pos=0, file_size=6172966)
    at ffm.c:740
740         ffm->write_index = pos;
(gdb) print ffm
$1 = (FFMContext *) 0x0
(gdb) bt
#0  0x0806a157 in ffm_set_write_index (s=0x0, pos=0, file_size=6172966)
    at ffm.c:740
#1  0x08057467 in http_server () at ffserver.c:2045
#2  0x080588bc in main (argc=3, argv=0xbfa02a84) at ffserver.c:4596

Also, "P." (sorry, I can't find your name), things like
commandline-output of ffserver would be useful. With a bit of luck, it
spits out errors so we can find where the problem really is.

Cheers,
Ronald
-------------- next part --------------
# Port on which the server is listening. You must select a different
# port from your standard HTTP web server if it is running on the same
# computer.
Port 8090

# Address on which the server is bound. Only useful if you have
# several network interfaces.
BindAddress 0.0.0.0

# Number of simultaneous requests that can be handled. Since FFServer
# is very fast, it is more likely that you will want to leave this high
# and use MaxBandwidth, below.
MaxClients 1000

# This the maximum amount of kbit/sec that you are prepared to
# consume when streaming to clients.
MaxBandwidth 1000

# Access log file (uses standard Apache log file format)
# '-' is the standard output.
CustomLog -

# Suppress that if you want to launch ffserver as a daemon.
NoDaemon


##################################################################
# Definition of the live feeds. Each live feed contains one video
# and/or audio sequence coming from an ffmpeg encoder or another
# ffserver. This sequence may be encoded simultaneously with several
# codecs at several resolutions.

<Feed feed1.ffm>

# You must use 'ffmpeg' to send a live feed to ffserver. In this
# example, you can type:
#
# ffmpeg http://localhost:8090/feed1.ffm

# ffserver can also do time shifting. It means that it can stream any
# previously recorded live stream. The request should contain:
# "http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify
# a path where the feed is stored on disk. You also specify the
# maximum size of the feed, where zero means unlimited. Default:
# File=/tmp/feed_name.ffm FileMaxSize=5M
File /tmp/gl.ffm
FileMaxSize 5M

# You could specify
ReadOnlyFile /tmp/gl.mp3
# This marks the file as readonly and it will not be deleted or updated.

# Specify launch in order to start ffmpeg automatically.
# First ffmpeg must be defined with an appropriate path if needed,
# after that options can follow, but avoid adding the http:// field
#Launch ffmpeg

# Only allow connections from localhost to the feed.
ACL allow 127.0.0.1

</Feed>


<Stream test.mp3>
Feed feed1.ffm
Format mp2
AudioCodec mp3
AudioBitRate 0
AudioChannels 2
AudioSampleRate 44100
NoVideo
</Stream>

# Server status
<Stream stat.html>
Format status

# Only allow local people to get the status
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255

#FaviconURL http://pond1.gladstonefamily.net:8080/favicon.ico
</Stream>


# Redirect index.html to the appropriate site

<Redirect index.html>
URL http://www.ffmpeg.org/
</Redirect>



More information about the ffmpeg-devel mailing list