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

Support for URLs #161

Open
AdrianEddy opened this issue Sep 14, 2023 · 1 comment
Open

Support for URLs #161

AdrianEddy opened this issue Sep 14, 2023 · 1 comment

Comments

@AdrianEddy
Copy link
Contributor

Currently, all input and output wrappers take AsRef<Path> parameter. This restricts the usage to local files only, but ffmpeg actually supports a lot of other protocols, including remote urls like http or rtsp

It should be possible to pass a custom url to ffmpeg.

I started to work on a PR to add support for URLs, but not sure which option would be the best:

  • Replace AsRef<Path> to ToString - this breaks current usage if someone passes Path
  • Add new methods like open_url(url: &str... - there are a few open/input/output function variants and will lead to duplication of many functions
  • Since the Path is converted to string anyway right away, is there a way to make the function signature accept both Path and &str? I wasn't able to find a way to do that, Path doesn't implement ToString nor std::fmt::Display

Safest way would be to add open_url functions, but I would prefer not to duplicate all these functions

Thoughts?

encounter pushed a commit to encounter/rust-ffmpeg-zmwangx that referenced this issue Oct 30, 2023
@nununoisy
Copy link

What about a new trait entirely, like MediaSource? Then you could impl<P: AsRef<Path>> MediaSource for P to preserve the existing callsites, but also add new impls for other sources.

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

2 participants