FFMpeg Camera under Windows 10

I’m trying to get streams from my UniFi Cameras.

camera:
  - platform: ffmpeg
    name: Cam
    input: -rtsp_transport tcp -i rtsp://192.168.1.20:7447/58185d11e4b0b3ba83376c96_0

I’ve downloaded FFMpeg binaries and put the directory in the PATH.
Getting a bunch of errors and “Cam(Error loading Camera)” in the frontend.

17-01-04 23:33:38 rxv: Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_4><Volume><Mute>GetParam</Mute></Volume></Zone_4></YAMAHA_AV>: b''
Traceback (most recent call last):
  File "C:\Users\Owner\AppData\Roaming\.homeassistant\deps\rxv\rxv.py", line 131, in _request
    response = ET.XML(res.content)  # releases connection to the pool
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\xml\etree\ElementTree.py", line 1334, in XML
    return parser.close()
  File "<string>", line None
xml.etree.ElementTree.ParseError: no element found: line 1, column 0
17-01-04 23:33:38 homeassistant.components.media_player: Error while setting up platform yamaha
Traceback (most recent call last):
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\helpers\entity_component.py", line 150, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\futures.py", line 361, in __iter__
    yield self  # This tells Task to wait for completion.
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\tasks.py", line 296, in _wakeup
    future.result()
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\futures.py", line 274, in result
    raise self._exception
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\concurrent\futures\thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\media_player\yamaha.py", line 89, in setup_platform
    YamahaDevice(name, receiver, source_ignore, source_names)])
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\media_player\yamaha.py", line 108, in __init__
    self.update()
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\media_player\yamaha.py", line 125, in update
    self._muted = self._receiver.mute
  File "C:\Users\Owner\AppData\Roaming\.homeassistant\deps\rxv\rxv.py", line 443, in mute
    response = self._request('GET', request_text)
  File "C:\Users\Owner\AppData\Roaming\.homeassistant\deps\rxv\rxv.py", line 131, in _request
    response = ET.XML(res.content)  # releases connection to the pool
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\xml\etree\ElementTree.py", line 1334, in XML
    return parser.close()
  File "<string>", line None
xml.etree.ElementTree.ParseError: no element found: line 1, column 0
17-01-04 23:34:01 haffmpeg.core: FFmpeg fails [WinError 2] The system cannot find the file specified
Traceback (most recent call last):
  File "C:\Users\Owner\AppData\Roaming\.homeassistant\deps\haffmpeg\core.py", line 243, in open
    stderr=stderr
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\subprocess.py", line 212, in create_subprocess_exec
    stderr=stderr, **kwds)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\base_events.py", line 1079, in subprocess_exec
    bufsize, **kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\windows_events.py", line 373, in _make_subprocess_transport
    **kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\base_subprocess.py", line 40, in __init__
    stderr=stderr, bufsize=bufsize, **kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\windows_events.py", line 757, in _start
    bufsize=bufsize, **kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\windows_utils.py", line 204, in __init__
    stderr=stderr_wfd, **kwds)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
17-01-04 23:34:01 aiohttp.server: Error handling request
Traceback (most recent call last):
  File "C:\Users\Owner\AppData\Roaming\.homeassistant\deps\aiohttp\web_server.py", line 61, in handle_request
    resp = yield from self._handler(request)
  File "C:\Users\Owner\AppData\Roaming\.homeassistant\deps\aiohttp\web.py", line 249, in _handle
    resp = yield from handler(request)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\coroutines.py", line 209, in coro
    res = yield from res
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\coroutines.py", line 209, in coro
    res = yield from res
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\http\__init__.py", line 427, in handle
    result = yield from result
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\camera\__init__.py", line 186, in get
    response = yield from self.handle(request, camera)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\camera\__init__.py", line 204, in handle
    image = yield from camera.async_camera_image()
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\camera\ffmpeg.py", line 64, in async_camera_image
    extra_cmd=self._extra_arguments)
  File "C:\Users\Owner\AppData\Roaming\.homeassistant\deps\haffmpeg\tools.py", line 162, in get_image
    image, error = yield from self._proc.communicate()
AttributeError: 'NoneType' object has no attribute 'communicate'
17-01-04 23:34:06 haffmpeg.core: FFmpeg fails [WinError 2] The system cannot find the file specified
Traceback (most recent call last):
  File "C:\Users\Owner\AppData\Roaming\.homeassistant\deps\haffmpeg\core.py", line 243, in open
    stderr=stderr
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\subprocess.py", line 212, in create_subprocess_exec
    stderr=stderr, **kwds)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\base_events.py", line 1079, in subprocess_exec
    bufsize, **kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\windows_events.py", line 373, in _make_subprocess_transport
    **kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\base_subprocess.py", line 40, in __init__
    stderr=stderr, bufsize=bufsize, **kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\windows_events.py", line 757, in _start
    bufsize=bufsize, **kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\windows_utils.py", line 204, in __init__
    stderr=stderr_wfd, **kwds)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
17-01-04 23:34:06 aiohttp.server: Error handling request
Traceback (most recent call last):
  File "C:\Users\Owner\AppData\Roaming\.homeassistant\deps\aiohttp\web_server.py", line 61, in handle_request
    resp = yield from self._handler(request)
  File "C:\Users\Owner\AppData\Roaming\.homeassistant\deps\aiohttp\web.py", line 249, in _handle
    resp = yield from handler(request)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\coroutines.py", line 209, in coro
    res = yield from res
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\coroutines.py", line 209, in coro
    res = yield from res
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\http\__init__.py", line 427, in handle
    result = yield from result
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\camera\__init__.py", line 186, in get
    response = yield from self.handle(request, camera)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\camera\__init__.py", line 204, in handle
    image = yield from camera.async_camera_image()
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\camera\ffmpeg.py", line 64, in async_camera_image
    extra_cmd=self._extra_arguments)
  File "C:\Users\Owner\AppData\Roaming\.homeassistant\deps\haffmpeg\tools.py", line 162, in get_image
    image, error = yield from self._proc.communicate()
AttributeError: 'NoneType' object has no attribute 'communicate'
17-01-04 23:34:11 haffmpeg.core: FFmpeg fails [WinError 2] The system cannot find the file specified
Traceback (most recent call last):
  File "C:\Users\Owner\AppData\Roaming\.homeassistant\deps\haffmpeg\core.py", line 243, in open
    stderr=stderr
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\subprocess.py", line 212, in create_subprocess_exec
    stderr=stderr, **kwds)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\base_events.py", line 1079, in subprocess_exec
    bufsize, **kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\windows_events.py", line 373, in _make_subprocess_transport
    **kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\base_subprocess.py", line 40, in __init__
    stderr=stderr, bufsize=bufsize, **kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\windows_events.py", line 757, in _start
    bufsize=bufsize, **kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\asyncio\windows_utils.py", line 204, in __init__
    stderr=stderr_wfd, **kwds)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

Hi, I have the same error. I have solved it with a bat file that I call from a command line and manually execute ffmpeg by recording from rtsp to a jpg.
Then I created a camera from a local file with that jpg as the source.
It would be ideal to make it work with the ffmpeg component and a ffmpeg camera directly on windows 10 but I do not know how.

Can you please share your batch file and camera/configuration.yaml please.
I have ffmpeg command line working but no image in HASS.
Your solution sounds like a perfect work-around.

In the batch file:
start /min ffmpeg -i “rtsp://cameraip/streamurl” -f image2 -updatefirst 1 -vf -r 1 “C:\ffmpeg\test.jpg” -y

In the configuration file:
camera:
- platform: local_file
name: testcam
file_path: C:\ffmpeg\test.jpg

Thank Virualdo, I finally understand how it works :smiley:

I now have a batch file running that creates 1 frame every 30 seconds.

@echo off
cls
:start
ffmpeg.exe -i “rtsp://username:password@ip/live” -updatefirst 1 -an -vframes 1 “C:\Users\Username\AppData\Roaming.homeassistant\www\camera.bmp” -y
timeout /t 30
goto start