Skip to content

Commit e2b4c07

Browse files
committed
bug fix for audios
1 parent 4cc294c commit e2b4c07

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

cvat/apps/engine/media_extractors.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,10 @@ def _get_av_container(self):
546546
self._source_path[0].seek(0) # required for re-reading
547547

548548
encoding = self.get_file_encoding(self._source_path[0])
549-
return av.open(self._source_path[0], metadata_encoding = encoding)
549+
if encoding:
550+
return av.open(self._source_path[0], metadata_encoding = encoding)
551+
else:
552+
return av.open(self._source_path[0])
550553

551554
def _get_duration(self):
552555
with self._get_av_container() as container:

cvat/apps/engine/task.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,10 @@ def get_audio_duration(file_path):
970970
slogger.glob.debug("ENCODING")
971971
slogger.glob.debug(encoding)
972972
# Open the audio file
973-
container = av.open(file_path, metadata_encoding=encoding)
973+
if encoding:
974+
container = av.open(file_path, metadata_encoding=encoding)
975+
else:
976+
container = av.open(file_path)
974977

975978
# Get the first audio stream
976979
audio_stream = next((stream for stream in container.streams if stream.codec.type == 'audio'), None)

0 commit comments

Comments
 (0)