From 7bded15bc55f4a9dd71aecfeb7e6604c5665772d Mon Sep 17 00:00:00 2001 From: kev Date: Tue, 5 Jul 2016 03:33:59 +0800 Subject: [PATCH] update ffserver --- ffserver/Dockerfile | 13 +++---- ffserver/README.md | 74 +++++++++++++++++++++++++------------ ffserver/docker-compose.yml | 1 + ffserver/ffserver.conf | 27 ++++++++++---- red5/README.md | 24 ++++++++++++ 5 files changed, 101 insertions(+), 38 deletions(-) diff --git a/ffserver/Dockerfile b/ffserver/Dockerfile index 8b0cf1c..34c0f54 100644 --- a/ffserver/Dockerfile +++ b/ffserver/Dockerfile @@ -1,14 +1,13 @@ # -# Dockerfile for ffmpeg +# Dockerfile for ffserver # -FROM alpine +FROM vimagick/ffmpeg + MAINTAINER kev -RUN apk add -U ffmpeg +COPY ffserver.conf /etc/ -ADD ffserver.conf /etc/ +EXPOSE 554 8090 -EXPOSE 8090 - -CMD ["ffserver"] +ENTRYPOINT ["ffserver"] diff --git a/ffserver/README.md b/ffserver/README.md index 3890b30..878f39e 100644 --- a/ffserver/README.md +++ b/ffserver/README.md @@ -1,21 +1,24 @@ ffserver - FFserver video server ================================ -`FFserver` is a streaming server for both audio and video. It supports +![](https://badge.imagelayers.io/vimagick/ffserver:latest.svg) + +[FFserver][1] is a streaming server for both audio and video. It supports 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 -``` +```yaml ffserver: image: vimagick/ffserver ports: + - "554:554" - "8090:8090" volumes: - - ffserver.conf:/etc/ffserver.conf - - data:/data + - ./ffserver.conf:/etc/ffserver.conf + - ./data:/data restart: always ``` @@ -25,22 +28,33 @@ ffserver: HTTPPort 8090 HTTPBindAddress 0.0.0.0 +RTSPPort 554 +RTSPBindAddress 0.0.0.0 + MaxClients 100 MaxBandwidth 100000 CustomLog - -File /tmp/feed.ffm +File /data/feed.ffm - + +Format rtp Feed feed.ffm -Format mp2 -AudioCodec libmp3lame -AudioBitRate 64 -AudioChannels 1 -AudioSampleRate 44100 -NoVideo +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 @@ -48,29 +62,43 @@ Format status ``` -> WARNING: I've not figured out how to stream video yet! +> :warning: I've not figured out how to stream video+audio yet! -## server +## Server Setup -``` +```bash $ cd ~/fig/ffserver - $ tree . ├── data -│ └── feed.mp3 +│ └── video.mp4 ├── docker-compose.yml └── ffserver.conf $ docker-compose up -d - -$ docker exec ffserver_ffserver_1 ffmpeg -i /data/feed.mp3 http://localhost:8090/feed.ffm +$ docker-compose exec ffserver ffmpeg -re -i video.mp4 http://localhost:8090/feed.ffm ``` -## client +> :hammer: `data/video.mp4` is for testing purposes only. -``` -$ firefox http://server:8090/status.html +## Client Setup -$ firefox http://server:8090/feed.mp3 +```bash +$ ffmpeg -re -i video.mp4 http://easypi.info:8090/feed.ffm ``` + +## Player Setup + +```bash +$ ffplay rtsp://easypi.info/video.mp4 +$ vlc http://easypi.info:8090/video.rtsp +$ firefox http://easypi.info:8090/status.html +``` + +## References + +- +- +- + +[1]: https://www.ffmpeg.org/ffserver.html diff --git a/ffserver/docker-compose.yml b/ffserver/docker-compose.yml index c99b978..0b59323 100644 --- a/ffserver/docker-compose.yml +++ b/ffserver/docker-compose.yml @@ -1,6 +1,7 @@ ffserver: image: vimagick/ffserver ports: + - "554:554" - "8090:8090" volumes: - ./ffserver.conf:/etc/ffserver.conf diff --git a/ffserver/ffserver.conf b/ffserver/ffserver.conf index 0809c32..5113b0c 100644 --- a/ffserver/ffserver.conf +++ b/ffserver/ffserver.conf @@ -1,22 +1,33 @@ HTTPPort 8090 HTTPBindAddress 0.0.0.0 +RTSPPort 554 +RTSPBindAddress 0.0.0.0 + MaxClients 100 MaxBandwidth 100000 CustomLog - -File /tmp/feed.ffm +File /data/feed.ffm - + +Format rtp Feed feed.ffm -Format mp2 -AudioCodec libmp3lame -AudioBitRate 64 -AudioChannels 1 -AudioSampleRate 44100 -NoVideo +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 diff --git a/red5/README.md b/red5/README.md index c96549f..c5399e8 100644 --- a/red5/README.md +++ b/red5/README.md @@ -17,8 +17,32 @@ red5: restart: always ``` +## Server Setup + +```bash +$ docker-compose up -d +``` + +## Client Setup + +```bash +$ ffmpeg -i /dev/video0 -video_size 800x600 -f flv rtmp://easypi.info/live/webcam +``` + +## Player Setup + +```bash +# kodi +$ echo 'rtmp://easypi.info/live/webcam live=1' > ~/Movies/webcam.strm + +# ffplay +$ brew reinstall ffmpeg --with-ffplay --with-rtmpdump +$ ffplay 'rtmp://easypi.info/live/webcam live=1' +``` + ## references - +- [1]: https://github.com/Red5/red5-server