eroji / rtsp2mjpg

RTSP to MJPEG stream conversion using FFmpeg and FFserver
99 stars 41 forks source link

No Stream #24

Open SomebodySysop opened 3 years ago

SomebodySysop commented 3 years ago

Git cloned latest version of rtsp2mjpg, modified docker-compose.yaml:

version: '3'
services:
  rtsp2mjpg:
    image: eroji/rtsp2mjpg
    restart: always
    expose:
      - "8090"
    volumes:
      - /etc/localtime:/etc/localtime:ro
      # Uncomment below if you want to override default ffserver.conf
      # - ./ffserver.conf:/etc/ffserver.conf:ro
    environment:
      # Override the env vars below as needed
      RTSP_URL: rtsp://192.168.1.116:8554/unicast
      FFSERVER_LOG_LEVEL: error
      FFMPEG_LOG_LEVEL: warning
      FFMPEG_INPUT_OPTS: -use_wallclock_as_timestamps 1
      FFMPEG_OUTPUT_OPTS: -async 1 -vsync 1
    healthcheck:
      test: ["CMD-SHELL", "curl -f http://localhost:8090/still.jpg --max-time 1 --outpu      interval: 15s
      timeout: 1s
      retries: 3
    logging:
      options:
        max-size: "10m"
        max-file: "3"
  nginx:
    image: nginx:alpine
    restart: always
    links:
      - rtsp2mjpg
    ports:
      - "8082:8082"
    volumes:
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
#     - ./nginx/default.conf:/etc/nginx/nginx.conf:ro

I changed "ports" to 8082 because at 80 kept getting this error:

_ERROR: for nginx Cannot start service nginx: driver failed programming external connectivity on endpoint rtsp2mjpg_nginx1 (fec7b0b159d1b48ea6db91d705266526e52642f61c8ac0997de657f19052e6d6): Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use ERROR: Encountered errors while bringing up the project.

Also tried to modify nginx/default.conf because /etc/nginx/nginx.conf is actually where my nginx.conf file is located. This generated errors so switched back to default.

root@ToshibaWin7-Ubuntu:/home/ron/docker/rtsp2mjpg# docker-compose up Starting rtsp2mjpg_rtsp2mjpg_1 ... done Recreating rtsp2mjpg_nginx_1 ... done Attaching to rtsp2mjpg_rtsp2mjpg_1, rtsp2mjpg_nginx_1 nginx_1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration nginx_1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh nginx_1 | 10-listen-on-ipv6-by-default.sh: info: can not modify /etc/nginx/conf.d/default.conf (read-only file system?) nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh nginx_1 | /docker-entrypoint.sh: Configuration complete; ready for start up nginx_1 | 2021/07/12 21:17:02 [notice] 1#1: using the "epoll" event method nginx_1 | 2021/07/12 21:17:02 [notice] 1#1: nginx/1.21.1 nginx_1 | 2021/07/12 21:17:02 [notice] 1#1: built by gcc 10.3.1 20210424 (Alpine 10.3.1_git20210424) nginx_1 | 2021/07/12 21:17:02 [notice] 1#1: OS: Linux 5.8.0-59-generic nginx_1 | 2021/07/12 21:17:02 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 nginx_1 | 2021/07/12 21:17:02 [notice] 1#1: start worker processes nginx_1 | 2021/07/12 21:17:02 [notice] 1#1: start worker process 24 nginx_1 | 2021/07/12 21:17:02 [notice] 1#1: start worker process 25 rtsp2mjpg_1 | Past duration 0.691490 too large rtsp2mjpg_1 | Past duration 0.720833 too large rtsp2mjpg_1 | Past duration 0.629829 too large rtsp2mjpg_1 | Past duration 0.859993 too large rtsp2mjpg_1 | Past duration 0.990318 too large

The "past duration too large" warning just repeats itself without end.

Project appears to be running, but cannot access stream via browser. Also tried these commands:

root@ToshibaWin7-Ubuntu:/home/ron/docker/rtsp2mjpg# curl -f http://localhost:8090/still.jpg curl: (7) Failed to connect to localhost port 8090: Connection refused

root@ToshibaWin7-Ubuntu:/home/ron/docker/rtsp2mjpg# curl -f http://localhost:8082/still.jpg curl: (56) Recv failure: Connection reset by peer

Tested rtsp://192.168.1.116:8554/unicast in vlc and it is up and running.

Any suggestions?

gleep52 commented 2 years ago

Did you figure yours out? Mine is similiar. I even tried default ports and it still doesn't work - but I can stream my rtsp directly from my camera in VLC.

In my nginx logs I can see my browser try to hit the server on 8090, but nothing is displayed using the URL http://192.168.1.12:8090/live.mjpg (where 192.168.1.12 is the IP of my ubuntu box/docker-host.

In my rtsp2mjpg container I have this for logs: One line: Guessed Channel Layout for Input Stream #0.1 : mono

docker ps -a shows both containers are launched, but the rtsp2mjpg is unhealthy. I cannot access /still.jpg either.

You ever figure this out?

SomebodySysop commented 2 years ago

No, never figured it out. Abandoned the project and went with docker-wyze-bridge.

gleep52 commented 2 years ago

I already have Wyze bridge running - how do you get a HTTP mjpg feed out of that?

SomebodySysop commented 2 years ago

I already have Wyze bridge running - how do you get a HTTP mjpg feed out of that?

I don't.

I used VLC transcode for a while: https://support.actiontiles.com/en/communities/12/topics/3033-using-vlc-transcode-video-rtsp-stream-to-mjpeg

docker-wyze-bridge --rtsp--> HTPC/vlc --mjpeg--> video surveillance system (ContaCam)

But it turned out to be too cumbersome as I had to use a Windows machine for the vlc (couldn't get cvlc to work properly).

I was able to get this to work:

https://stackoverflow.com/questions/68368511/how-to-convert-rtsp-stream-to-mjpeg-http-using-ffmpeg/68471166#68471166

https://stevethemoose.blogspot.com/2021/07/converting-rtsp-to-mjpeg-stream-on.html

But the CPU hit for each stream was way to extreme. So, I just gave up on the notion of producing an http stream. At least for now.