Docker USB camera "Resource busy" error

Hello,
I’m trying to setup a usb camera inside docker container using ffmpeg platform. I have this config

camera:
  - platform: ffmpeg
    name: Corridor Camera 1
    input: /dev/video0

When I run ffmpeg -i /dev/video1 -codec:v libx264 -qp 0 lossless.mp4 just after container restart, it makes a recording from this camera just fine, but when I add Picture Entity card with this camera it shows “Unavailable” and I have this errors in logs

homeassistant  | 2022-06-09 20:34:51 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.corridor_camera_1] Error from stream worker: Error opening stream (ERRORTYPE_16, Resource busy) /dev/video0
homeassistant  | 2022-06-09 20:35:41 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.corridor_camera_1] Error from stream worker: Error opening stream (ERRORTYPE_16, Resource busy) /dev/video0
homeassistant  | 2022-06-09 20:36:01 WARNING (MainThread) [libav.video4linux2,v4l2] Some buffers are still owned by the caller on close.
homeassistant  | 2022-06-09 20:36:01 ERROR (MainThread) [libav.generic] ioctl(VIDIOC_QBUF): Bad file descriptor
homeassistant  | 2022-06-09 20:36:42 ERROR (stream_worker) [root] Uncaught thread exception
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner
homeassistant  |     self.run()
homeassistant  |   File "/usr/local/lib/python3.9/threading.py", line 910, in run
homeassistant  |     self._target(*self._args, **self._kwargs)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/stream/__init__.py", line 360, in _run_worker
homeassistant  |     stream_worker(
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 539, in stream_worker
homeassistant  |     muxer.reset(start_dts)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 209, in reset
homeassistant  |     ) = self.make_new_av(
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 192, in make_new_av
homeassistant  |     output_vstream = container.add_stream(template=input_vstream)
homeassistant  |   File "av/container/output.pyx", line 82, in av.container.output.OutputContainer.add_stream
homeassistant  | ValueError: 'mp4' format does not support None codec

Picture Entity config:

show_state: true
show_name: true
camera_view: live
type: picture-entity
entity: camera.corridor_camera_1
image: https://demo.home-assistant.io/stub_config/bedroom.png

I wasn’t able to make my camera work with HA directly, so I just set up a motionEYE instance and using it’s integration. Seems to be working fine now.