2015-07-15 13:51:48 +02:00
|
|
|
ffserver - FFserver video server
|
|
|
|
================================
|
|
|
|
|
2016-07-04 21:33:59 +02:00
|
|
|
![](https://badge.imagelayers.io/vimagick/ffserver:latest.svg)
|
|
|
|
|
|
|
|
[FFserver][1] is a streaming server for both audio and video. It supports
|
2015-07-15 13:51:48 +02:00
|
|
|
several live feeds, streaming from files and time shifting on live
|
|
|
|
feeds (you can seek to positions in the past on each live feed,
|
|
|
|
provided you specify a big enough feed storage in `ffserver.conf`).
|
|
|
|
|
|
|
|
## docker-compose.yml
|
|
|
|
|
2016-07-04 21:33:59 +02:00
|
|
|
```yaml
|
2015-07-15 13:51:48 +02:00
|
|
|
ffserver:
|
|
|
|
image: vimagick/ffserver
|
|
|
|
ports:
|
2016-07-04 21:33:59 +02:00
|
|
|
- "554:554"
|
2015-07-15 13:51:48 +02:00
|
|
|
- "8090:8090"
|
|
|
|
volumes:
|
2016-07-04 21:33:59 +02:00
|
|
|
- ./ffserver.conf:/etc/ffserver.conf
|
|
|
|
- ./data:/data
|
2015-07-15 13:51:48 +02:00
|
|
|
restart: always
|
|
|
|
```
|
|
|
|
|
|
|
|
## ffserver.conf
|
|
|
|
|
|
|
|
```
|
|
|
|
HTTPPort 8090
|
|
|
|
HTTPBindAddress 0.0.0.0
|
|
|
|
|
2016-07-04 21:33:59 +02:00
|
|
|
RTSPPort 554
|
|
|
|
RTSPBindAddress 0.0.0.0
|
|
|
|
|
2015-07-15 13:51:48 +02:00
|
|
|
MaxClients 100
|
|
|
|
MaxBandwidth 100000
|
|
|
|
CustomLog -
|
|
|
|
|
|
|
|
<Feed feed.ffm>
|
2016-07-04 21:33:59 +02:00
|
|
|
File /data/feed.ffm
|
2015-07-15 13:51:48 +02:00
|
|
|
</Feed>
|
|
|
|
|
2016-07-04 21:33:59 +02:00
|
|
|
<Stream video.mp4>
|
|
|
|
Format rtp
|
2015-07-15 13:51:48 +02:00
|
|
|
Feed feed.ffm
|
2016-07-04 21:33:59 +02:00
|
|
|
VideoCodec libx264
|
|
|
|
VideoFrameRate 24
|
|
|
|
VideoBitRate 100
|
|
|
|
VideoSize 640x480
|
|
|
|
AVPresetVideo default
|
|
|
|
AVPresetVideo baseline
|
|
|
|
AVOptionVideo flags +global_header
|
|
|
|
NoAudio
|
|
|
|
#AudioCodec libmp3lame
|
|
|
|
#AudioBitRate 32
|
|
|
|
#AudioChannels 2
|
|
|
|
#AudioSampleRate 22050
|
|
|
|
#AVOptionAudio flags +global_header
|
2015-07-15 13:51:48 +02:00
|
|
|
</Stream>
|
|
|
|
|
|
|
|
<Stream status.html>
|
|
|
|
Format status
|
|
|
|
</Stream>
|
|
|
|
```
|
|
|
|
|
2016-07-04 21:33:59 +02:00
|
|
|
> :warning: I've not figured out how to stream video+audio yet!
|
2015-07-15 13:51:48 +02:00
|
|
|
|
2016-07-04 21:33:59 +02:00
|
|
|
## Server Setup
|
2015-07-15 13:51:48 +02:00
|
|
|
|
2016-07-04 21:33:59 +02:00
|
|
|
```bash
|
2015-07-15 13:51:48 +02:00
|
|
|
$ cd ~/fig/ffserver
|
|
|
|
$ tree
|
|
|
|
.
|
|
|
|
├── data
|
2016-07-04 21:33:59 +02:00
|
|
|
│ └── video.mp4
|
2015-07-15 13:51:48 +02:00
|
|
|
├── docker-compose.yml
|
|
|
|
└── ffserver.conf
|
|
|
|
|
|
|
|
$ docker-compose up -d
|
2016-07-04 21:33:59 +02:00
|
|
|
$ docker-compose exec ffserver ffmpeg -re -i video.mp4 http://localhost:8090/feed.ffm
|
2015-07-15 13:51:48 +02:00
|
|
|
```
|
|
|
|
|
2016-07-04 21:33:59 +02:00
|
|
|
> :hammer: `data/video.mp4` is for testing purposes only.
|
2015-07-15 13:51:48 +02:00
|
|
|
|
2016-07-04 21:33:59 +02:00
|
|
|
## Client Setup
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ ffmpeg -re -i video.mp4 http://easypi.info:8090/feed.ffm
|
2015-07-15 13:51:48 +02:00
|
|
|
```
|
|
|
|
|
2016-07-04 21:33:59 +02:00
|
|
|
## Player Setup
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ ffplay rtsp://easypi.info/video.mp4
|
|
|
|
$ vlc http://easypi.info:8090/video.rtsp
|
|
|
|
$ firefox http://easypi.info:8090/status.html
|
2015-07-15 13:51:48 +02:00
|
|
|
```
|
2016-07-04 21:33:59 +02:00
|
|
|
|
|
|
|
## References
|
|
|
|
|
|
|
|
- <http://ffmpeg.org/ffserver.html>
|
|
|
|
- <http://www.ffmpeg.org/sample.html>
|
|
|
|
- <https://trac.ffmpeg.org/wiki/ffserver>
|
|
|
|
|
|
|
|
[1]: https://www.ffmpeg.org/ffserver.html
|