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

Fix .m4a support in some setups (possibly for other formats not supported by libsndfile) #1427

Merged
merged 4 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lhotse/audio/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,10 @@ def handles_special_case(self, path_or_fd: Union[Pathlike, FileObject]) -> bool:
return False

def is_applicable(self, path_or_fd: Union[Pathlike, FileObject]) -> bool:
if isinstance(path_or_fd, (Path, str)) and any(
str(path_or_fd).endswith(ext) for ext in [".mp4", ".m4a", ".m4b"]
):
return False
return True

def supports_save(self) -> bool:
Expand Down Expand Up @@ -571,6 +575,9 @@ def read_audio(
duration=duration,
)

def supports_info(self):
return True

def info(
self,
path_or_fd: Union[Pathlike, FileObject],
Expand Down
2 changes: 1 addition & 1 deletion lhotse/cut/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -3570,7 +3570,7 @@ def _export_to_shar_single(
except Exception as e:
if fault_tolerant:
logging.warning(
"Skipping: failed to load cut '{cut.id}'. Error message: {e}."
f"Skipping: failed to load cut '{cut.id}'. Error message: {e}."
)
else:
raise
Expand Down
Loading