diff --git a/mediapy/__init__.py b/mediapy/__init__.py index a1b505e..41400f2 100644 --- a/mediapy/__init__.py +++ b/mediapy/__init__.py @@ -191,6 +191,17 @@ _T = typing.TypeVar('_T') _Path = typing.Union[str, 'os.PathLike[str]'] +# Raw PCM sample formats (as in `ffmpeg -formats`) for the audio dtypes that +# `VideoWriter` is able to feed to `ffmpeg`. Multi-byte formats lack the +# byte-order suffix ('le' or 'be'), which is appended for the native order. +_FFMPEG_AUDIO_FORMAT_FROM_DTYPE = { + np.uint8: 'u8', + np.int16: 's16', + np.int32: 's32', + np.float32: 'f32', + np.float64: 'f64', +} + _IMAGE_COMPARISON_HTML = """\