1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-23 01:39:27 +02:00
dockerfiles/rtmp
ImgBotApp 1c434b2d2e
[ImgBot] Optimize images
*Total -- 181.18kb -> 152.26kb (15.96%)

/krakend/data/krakend.png -- 32.27kb -> 23.93kb (25.84%)
/node-red/screenshot.png -- 80.86kb -> 61.85kb (23.51%)
/rtmp/server/html/img/cctv.jpg -- 60.20kb -> 58.80kb (2.33%)
/tesseract/data/chinese.jpg -- 7.84kb -> 7.67kb (2.19%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
2020-08-26 02:52:07 +00:00
..
client update rtmp 2016-07-04 12:27:24 +08:00
server [ImgBot] Optimize images 2020-08-26 02:52:07 +00:00
README.md add pptp-arm 2016-07-08 19:53:48 +08:00

rtmp

  • NGINX-based Media Streaming Server.
  • FFMPGE-based Media Streaming Client.

Directory Tree

~/fig/rtmp/
├── data/
│   └── video.mp4
└── docker-compose.yml

docker-compose.yml

server:
  image: vimagick/rtmp-server
  ports:
    - "1935:1935"
    - "9999:80"
  volumes:
    - ./data:/data
  restart: always

client:
  image: easypi/rtmp-client-arm
# command:
#   - ffmpeg -i $$RTMP_DEV -video_size 800x600 -vf "hflip,vflip" -f flv $$RTMP_URI
#   - ffmpeg -f alsa -ac 1 -ar 22050 -i hw:1 -i $$RTMP_DEV -c:a aac -c:v flv1 -f flv $$RTMP_URI
  devices:
#   - /dev/snd
    - /dev/video0
  environment:
#   - RTMP_DEV=rtsp://192.168.42.1/live
    - RTMP_URI=rtmp://easypi.info/live/webcam
  restart: always
  • You can run customized command. (It should be single item list!)
  • Input can be a stream instead of device. (It works as a relay!)

Server Setup

$ cd ~/fig/rtmp/
$ docker-compose up -d server
$ youtube-dl 'https://www.youtube.com/watch?v=lJZlz-WnXzU' -o data/video.mp4

Client Setup

# play remote video (remote -> local)
$ vlc rtmp://easypi.info/vod/video.mp4

# play local video (local -> remote -> local)
$ ffmpeg -re -i video.mp4 -f flv rtmp://easypi.info/live/video
$ vlc rtmp://easypi.info/live/video

# capture desktop (local -> remote)
$ ffmpeg -f avfoundation -pixel_format bgr0 -i 1:0 -f flv rtmp://easypi.info/live/webcam

# record webcam (local -> remote)
$ ffmpeg -f qtkit -i 0 -f flv rtmp://easypi.info/live/webcam

# record pi camera (pi -> remote)
$ ffmpeg -f video4linux2 -r 24 -i /dev/video0 -f flv rtmp://easypi.info/live/webcam

# record pi camera (pi -> remote)
$ /opt/vc/bin/raspivid -o - -t 0 -hf -w 640 -h 360 -fps 25 | ffmpeg -i - -f flv rtmp://easypi.info/live/webcam

# watch webcam (remote -> local)
$ vlc rtmp://easypi.info/live/webcam

# watch webcam (remote -> local)
$ firefox http://easypi.info:9999/

Optinally, you can run a docker container as RTMP client on raspberry pi.

$ cd ~/fig/rtmp/
$ docker-compose up -d client

OBS Setup

Stream Type: Custom Streaming Server
URL: rtmp://192.168.31.254/live/
Streaming key: webcam

Player Setup

References