Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in HASS 0.56.1 #20

Closed
bachya opened this issue Oct 22, 2017 · 8 comments
Closed

Exception in HASS 0.56.1 #20

bachya opened this issue Oct 22, 2017 · 8 comments

Comments

@bachya
Copy link

bachya commented Oct 22, 2017

In the latest release of HASS, I'm getting this unhandled exception:

2017-10-22 15:00:17 ERROR (MainThread) [haffmpeg.core] FFmpeg fails program arguments must be a bytes or text string, not bool
Traceback (most recent call last):
  File "/config/deps/lib/python3.6/site-packages/haffmpeg/core.py", line 114, in open
    stderr=stderr
  File "/usr/lib/python3.6/asyncio/subprocess.py", line 225, in create_subprocess_exec
    stderr=stderr, **kwds)
  File "/usr/lib/python3.6/asyncio/base_events.py", line 1181, in subprocess_exec
    % type(arg).__name__)
TypeError: program arguments must be a bytes or text string, not bool

I'm using Arlo Cameras and a Yi Camera. Let me know if you have any questions.

@pvizeli
Copy link
Member

pvizeli commented Oct 23, 2017

I think your command argument will parse as bool and not as string. That was also your problem before...

@pvizeli pvizeli closed this as completed Oct 23, 2017
@bachya
Copy link
Author

bachya commented Oct 23, 2017

This is a boolean?

ffmpeg_arguments: '-vf scale=800:450'

@pvizeli
Copy link
Member

pvizeli commented Oct 24, 2017

Maybe a trouble inside component? I can only say that I become a boolean instead a string to ffmpeg-ha library

@pvizeli pvizeli reopened this Oct 24, 2017
@pvizeli
Copy link
Member

pvizeli commented Oct 24, 2017

Maybe I can help me to find the problem?

@bachya
Copy link
Author

bachya commented Oct 24, 2017

Happy to help in any way I can! As I mentioned in my previous bug, I'm dealing with raw MP4s, so if sending you one of those would help, I can certainly do that.

@arsaboo
Copy link

arsaboo commented Nov 18, 2017

I am also seeing these errors:

FFmpeg fails program arguments must be a bytes or text string, not bool
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/haffmpeg/core.py", line 114, in open
    stderr=stderr
  File "/usr/lib/python3.6/asyncio/subprocess.py", line 225, in create_subprocess_exec
    stderr=stderr, **kwds)
  File "/usr/lib/python3.6/asyncio/base_events.py", line 1182, in subprocess_exec
    % type(arg).__name__)
TypeError: program arguments must be a bytes or text string, not bool

My entire config is here. I am using Hikvision and Bloomsky cameras. I don't have any arguments specified for ffmpeg. Let me know if I can provide any more details.

@etsinko
Copy link

etsinko commented Nov 19, 2017

I'm having the same problem with Ring Doorbell camera:

2017-11-19 10:34:06 ERROR (MainThread) [haffmpeg.core] FFmpeg fails program arguments must be a bytes or text string, not bool
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/haffmpeg/core.py", line 114, in open
    stderr=stderr
  File "/usr/lib/python3.5/asyncio/subprocess.py", line 212, in create_subprocess_exec
    stderr=stderr, **kwds)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 1070, in subprocess_exec
    % type(arg).__name__)
TypeError: program arguments must be a bytes or text string, not bool
2017-11-19 10:34:06 WARNING (MainThread) [haffmpeg.tools] Error starting FFmpeg.

@etsinko
Copy link

etsinko commented Nov 19, 2017

Ok,
I've figured out what was going on in my case. Here it is:
ring camera component for HA was passing False as input_source to open() function:

    def open(self, cmd, input_source, output="-", extra_cmd=None,
             stdout_pipe=True, stderr_pipe=False):
        """Start a ffmpeg instance and pipe output."""
        stdout = asyncio.subprocess.PIPE if stdout_pipe\
            else asyncio.subprocess.DEVNULL
        stderr = asyncio.subprocess.PIPE if stderr_pipe\
            else asyncio.subprocess.DEVNULL

        if self.is_running:
            _LOGGER.warning("FFmpeg is allready running!")
            return

        # set command line
        self._generate_ffmpeg_cmd(cmd, input_source, output, extra_cmd)
....

Hence self._generate_ffmpeg_cmd() generated a parameter list with False in it. Here is my list for example:

['ffmpeg', '-i', False, '-an', '-frames:v', '1', '-c:v', 'mjpeg', '-f', 'image2pipe', '-']

And this caused the problem in asyncio.create_subprocess_exec as seen in the stacktrace earlier.

@pvizeli do you think it will be better to check for valid parameters and maybe throw more meaningful exception? I'm pretty sure others here have similar issues: the modules they use pass invalid parameter for input_source

@bachya bachya closed this as completed Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants