Commit 635d8cff authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

Add get_build_config ffmpeg utility function (#3014)

Summary:
We often need to look at which FFmpeg was found and linked when debugging an issue.

Version number is often not enough but there is no easy way to find where the library was found either.

This commit adds utility function that prints the build time configuration.

It helps to distinguish if the linked FFmpeg is the one from binary distribution built in CI or locally built.

Pull Request resolved: https://github.com/pytorch/audio/pull/3014

Reviewed By: hwangjeff

Differential Revision: D42794952

Pulled By: mthrok

fbshipit-source-id: 91ed358fde8cfe9d6d950f34742b1722e729cf4e
parent 51aae466
......@@ -92,6 +92,10 @@ std::vector<std::string> get_protocols(bool output) {
return ret;
}
std::string get_build_config() {
return avcodec_configuration();
}
TORCH_LIBRARY_FRAGMENT(torchaudio, m) {
m.def("torchaudio::ffmpeg_get_versions", &get_versions);
m.def("torchaudio::ffmpeg_get_muxers", []() { return get_muxers(false); });
......@@ -100,6 +104,9 @@ TORCH_LIBRARY_FRAGMENT(torchaudio, m) {
m.def("torchaudio::ffmpeg_get_input_devices", []() {
return get_demuxers(true);
});
m.def("torchaudio::ffmpeg_get_build_config", []() {
return get_build_config();
});
m.def("torchaudio::ffmpeg_get_output_devices", []() {
return get_muxers(true);
});
......
......@@ -225,3 +225,16 @@ def get_output_protocols() -> List[str]:
... ['file', 'ftp', 'http', 'https', 'md5', 'pipe', 'prompeg', 'rtmp', 'tee', 'tcp', 'tls', 'udp', 'unix']
"""
return torch.ops.torchaudio.ffmpeg_get_output_protocols()
def get_build_config() -> str:
"""Get the FFmpeg build configuration
Returns:
str: Build configuration string.
Example
>>> print(get_build_config())
--prefix=/Users/runner/miniforge3 --cc=arm64-apple-darwin20.0.0-clang --enable-gpl --enable-hardcoded-tables --enable-libfreetype --enable-libopenh264 --enable-neon --enable-libx264 --enable-libx265 --enable-libaom --enable-libsvtav1 --enable-libxml2 --enable-libvpx --enable-pic --enable-pthreads --enable-shared --disable-static --enable-version3 --enable-zlib --enable-libmp3lame --pkg-config=/Users/runner/miniforge3/conda-bld/ffmpeg_1646229390493/_build_env/bin/pkg-config --enable-cross-compile --arch=arm64 --target-os=darwin --cross-prefix=arm64-apple-darwin20.0.0- --host-cc=/Users/runner/miniforge3/conda-bld/ffmpeg_1646229390493/_build_env/bin/x86_64-apple-darwin13.4.0-clang # noqa
"""
return torch.ops.torchaudio.ffmpeg_get_build_config()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment