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

[FR] Transport stream type argument (rtsp_transport) #37

Open
alryaz opened this issue Oct 1, 2021 · 0 comments
Open

[FR] Transport stream type argument (rtsp_transport) #37

alryaz opened this issue Oct 1, 2021 · 0 comments

Comments

@alryaz
Copy link

alryaz commented Oct 1, 2021

Issue description

In short, I am having issues with acquiring TCP-only streams using ffmpeg.async_get_image(...) from Home Assistant. The issue lies within the difference between the following commands:

This one works:
ffmpeg -rtsp_transport tcp -i '<stream_url>' -an -frames:v 1 -c:v mjpeg -f image2pipe -
This one does not work:
ffmpeg -i '<stream_url>' -an -frames:v 1 -c:v mjpeg -f image2pipe -
And this one does not work, either:
ffmpeg -i '<stream_url>' -rtsp_transport tcp -an -frames:v 1 -c:v mjpeg -f image2pipe -

I tried using the extra_cmd argument to pass -rtsp_transport tcp through to ImageFrame.get_image(...) (subsequently - to HAFFmpeg.open(...)), however it gets put right after the input stream URL by an internal HAFFmpeg._generate_ffmpeg_cmd(...) call, whereas it is required to be put in front of it (I am unaware why, however this is a solution I have stumbled upon while trying to debug a component I am working on).

To combat this, I have prepared a really shoddy diversion (see: my __init__.py of the pik_intercom integration), which monkey-patches the HAFFmpeg._generate_ffmpeg_cmd(...) method to generate a working request. I abstained from using a valid rtsp_transport argument in favor of a virtual input_rtsp_transport argument as not to break anything for any of my users.

Feature proposal

My proposal would be to add an extra prefix_cmd argument to the HAFFmpeg._generate_ffmpeg_cmd(...), HAFFmpeg.open(...), ImageFrame.get_image(...), and to Home Assistant's own ffmpeg.async_get_image(...) component method.

I may make pull requests to both repositories to implement the issue in question, however I am not well-acquainted with the library.

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

1 participant