Ffmpeg live stream not work

Hi, I have a Yi Dome camera (1080p PTZ) and I’m trying to use it with live stream.
Live stream work prefect with all applications like vlc and others but NOT work on home assistant.
The stream window remain blank and not see any image in streaming.
My configuration is:

In configuration.yaml:

frontend:
  javascript_version: latest

stream:
ffmpeg:
  ffmpeg_bin: /usr/bin/ffmpeg
camera:
  - platform: ffmpeg
    name: camera
    input: rtsp://192.168.1.181/ch0_1.h264

in lovelace card:

camera_view: live
entity: camera.camera
type: picture-entity

Two suggestions:
include the username and password items

camera:
  - platform: ffmpeg
    name: Sunroom
    username: your_username
    password: your_password
    authentication: digest

and include appropriate ffmpeg options in your input: line

input: -x -y -z rtsp://192.168.1.181/cho_1.h264

It’s been a while since I used ffmpeg for cameras, so I don’t recall the actual command line options. :frowning: One last option may be to include the username:password in the rtsp: URL

input: rtsp://username:[email protected]/ch0_1.h264

Blockquote

input: -x -y -z rtsp://192.168.1.181/cho_1.h264

What the value to insert in -x -y -z ???

However the problem not is in login and password elements.

These are ffmpeg command-line arguments. They are whatever arguments you would need if using ffmpeg on your desktop to view the stream. Here is an example config from github:

- platform: ffmpeg
  name: IP camera oprit
  input: !secret ip_camera_oprit_stream
  extra_arguments: '-q:v 1 -r 25 -vf "scale=640:360"'

hope this helps! just in case it doesn’t, check out the FFMPEG troubleshooting page.

2 Likes

I tried with:

camera:
- platform: ffmpeg
  name: camera
  input: rtsp://192.168.1.181/ch0_1.h264
  extra_arguments: '-q:v 1 -r 25 -vf "scale=640:360"'

Unfortunately it doesn’t work on my yi dome camera
I tried to lunch:

time ffmpeg rtsp://192.168.1.181/ch0_1.h264 -an -frames:v 1 -y -c:v mjpeg -loglevel verbose test.jpg

and the result is:

libavutil      56. 22.100 / 56. 22.100
libavcodec     58. 35.100 / 58. 35.100
libavformat    58. 20.100 / 58. 20.100
libavdevice    58.  5.100 / 58.  5.100
libavfilter     7. 40.101 /  7. 40.101
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  3.100 /  5.  3.100
libswresample   3.  3.100 /  3.  3.100
libpostproc    55.  3.100 / 55.  3.100

Output #0, h264, to ‘rtsp://192.168.1.181/ch0_1.h264’:
Output file #0 does not contain any stream

Do not work till now? It must be ok now