better-ffmpeg-progress
better-ffmpeg-progress copied to clipboard
Add support for passing arbitrary file descriptors to the log
This pull request improves the flexibility of how FFmpeg log output is handled in the better_ffmpeg_progress.py module. The main change allows the log destination to be either a file path or a file-like object, such as sys.stdout, making it easier to redirect FFmpeg logs for different use cases.
FFmpeg log output handling improvements:
- Updated the initialization of
self._ffmpeg_log_filein__init__to support bothos.PathLikeobjects and direct file-like objects, enabling the use of custom log destinations. - Modified the
runmethod to check the type ofself._ffmpeg_log_fileand handle writing to either a file path or a file descriptor (e.g.,sys.stdout). This ensures compatibility with various logging scenarios. [1] [2]