ffmpeg_utils.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import torch
  2. def get_log_level() -> int:
  3. """Get the log level of FFmpeg.
  4. See :py:func:`set_log_level` for the detailo.
  5. """
  6. return torch.ops.torchaudio.ffmpeg_get_log_level()
  7. def set_log_level(level: int):
  8. """Set the log level of FFmpeg (libavformat etc)
  9. Arguments:
  10. level (int): Log level. The larger, the more verbose.
  11. The following values are common values, the corresponding ``ffmpeg``'s
  12. ``-loglevel`` option value and desription.
  13. * ``-8`` (``quiet``):
  14. Print no output.
  15. * ``0`` (``panic``):
  16. Something went really wrong and we will crash now.
  17. * ``8`` (``fatal``):
  18. Something went wrong and recovery is not possible.
  19. For example, no header was found for a format which depends
  20. on headers or an illegal combination of parameters is used.
  21. * ``16`` (``error``):
  22. Something went wrong and cannot losslessly be recovered.
  23. However, not all future data is affected.
  24. * ``24`` (``warning``):
  25. Something somehow does not look correct.
  26. This may or may not lead to problems.
  27. * ``32`` (``info``):
  28. Standard information.
  29. * ``40`` (``verbose``):
  30. Detailed information.
  31. * ``48`` (``debug``):
  32. Stuff which is only useful for libav* developers.
  33. * ``56`` (``trace``):
  34. Extremely verbose debugging, useful for libav* development.
  35. """
  36. torch.ops.torchaudio.ffmpeg_set_log_level(level)