[Deprecated] Streaming workflow with FFserver

Warning: ffserver has been removed on 2018-01-06

https://trac.ffmpeg.org/wiki/ffserver

FFserver is being dropped on July 10th, 2016. But it is still useful for me to learn the whole workflow from capture, streaming to playback.

Prepare configuration file

I can find the official sample configuration on ffserver web page. And save it toffserver.conf.

Its structure looks like below:

Port 8090
BindAddress 0.0.0.0

...

<Feed feed1.ffm>
...
</Feed>

<Stream test1.mpg>
...
</Stream>

<Stream stat.html>
...
</Stream>

<Redirect index.html>
...
</Redirect>

Feed element is used to associate one input source from ffmpeg encoder.

Stream element is used to define specific stream with file name. I would like to modify file name tolive.tsandFormattag tompegts. I only want to record stream without audio, so I remove all audio setting and addNoAudiotag.

<Stream live.ts>
    Format mpegts
    Feed feed1.ffm
...
    NoAudio
</Stream>

Use following command to start server:

ffserver -d -f ffserver.conf

Then there are the warning:

ffserver2.conf:1: Port option is deprecated. Use HTTPPort instead.
ffserver2.conf:2: BindAddress option is deprecated. Use HTTPBindAddress instead.

I can modify the first and second lines to fix them.

HTTPPort 8090
HTTPBindAddress 0.0.0.0
...

<Feed feed1.ffm>
...

And the final configuration looks like below:

HTTPPort 8090
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 10
MaxBandwidth 100000
CustomLog -
#NoDaemon

<Feed feed1.ffm>
    File ./feed1.ffm
    FileMaxSize 20M
    ACL allow 127.0.0.1
</Feed>

<Stream live.ts>
    Format mpegts
    Feed feed1.ffm

    VideoCodec libx264
    VideoFrameRate 30
    VideoBitRate 512
    VideoSize 1280x720
    AVOptionVideo crf 23
    AVOptionVideo preset medium

    NoAudio
</Stream>

<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
</Stream>

# Redirect index.html to the appropriate site
<Redirect index.html>
    URL http://www.ffmpeg.org/
</Redirect>

Then start ffserver:

Fri Dec 16 14:54:26 2016 FFserver started.

Capture webcam and push to server

ffmpeg -f avfoundation -i "0" http://localhost:8090/feed1.ffm
Fri Dec 16 15:04:01 2016 FFserver started.
Fri Dec 16 15:04:05 2016 127.0.0.1 - - New connection: GET /feed1.ffm
Fri Dec 16 15:04:05 2016 [ffm @ 0x7ffb59806d50]Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Fri Dec 16 15:04:05 2016 127.0.0.1 - - [GET] "/feed1.ffm HTTP/1.1" 200 4175
Fri Dec 16 15:04:05 2016 127.0.0.1 - - New connection: POST /feed1.ffm

Playback with ffplay

ffplay -v debug http://localhost:8090/live.ts

[FFServer](https://trac.ffmpeg.org/wiki/ffserver\

results matching ""

    No results matching ""