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

Allow to specify a path for ffmpeg binary #265

Open
gdippolito opened this issue Oct 16, 2024 · 2 comments
Open

Allow to specify a path for ffmpeg binary #265

gdippolito opened this issue Oct 16, 2024 · 2 comments

Comments

@gdippolito
Copy link

🚀 The feature

Hello! Thanks for the project.

It would be nice to be able to specify a different path for the ffmpeg binary that will be loaded by torchcodec. If a different binary is provided we could perhaps avoid some system checks to libavutil to also allow users to use static builds of ffmpeg.

Motivation, pitch

I think this feature will provide the following benefit:

  • Allow to use ffmpeg binary that are not in the system path.
  • Allow users to quickly validate the performance difference of different ffmpeg versions without uninstall/install differnet versions
  • Allow users to use static builds of ffmpeg.
@ahmadsharif1
Copy link
Contributor

There are multiple .so files that libtorchcodec.so needs. avutil, avcodec, etc. are all libraries that libtorchcodec.so needs.

You could probably try LD_PRELOAD= python <script that uses torchcodec>

to test out different versions of specific .so files. Let me know if that doesn't work.

Torchcodec dynamically links against ffmpeg .so files because of licensing reasons. You could probably change the build rules in CMakeLists.txt to statically link against your ffmpeg archives if you want to do that.

@scotts
Copy link
Contributor

scotts commented Oct 25, 2024

Seconded that LD_PRELOAD is probably the best option here.

TorchCodec itself is not looking for FFmpeg in specific locations. Rather, TorchCodec is dynamically loading its C++ code from a shared library that itself was linked against a specific version of FFmpeg at compile time. Which FFmpeg libraries to use at runtime is determined by the system calls that load our library. These system calls have a predetermined set of locations it's going to look for libraries on your system that match what our library was compiled for. The standard way to make a particular library file to be loaded instead of what's installed in the standard locations on your system is LD_PRELOAD.

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

3 participants