code: async def close(self, timeout=5) -> None:
          
          if not self.is_running:
              _LOGGER.warning("FFmpeg isn't running!")
              return
  
          # Can't use communicate because we attach the output to a streamreader
          def _close():
              """Close ffmpeg."""
              self._proc.stdin.write(b"q")
              self._proc.wait(timeout=timeout)
  
          # send stop to ffmpeg
          try:
              await self._loop.run_in_executor(None, _close)
              _LOGGER.debug("Close FFmpeg process")
  
          except (subprocess.TimeoutExpired, ValueError):
              _LOGGER.warning("Timeout while waiting of FFmpeg")
              self.kill()
  
          finally:
              self._clear()
docs: Stop a ffmpeg instance.