Skip to content

Commit f64ec9a

Browse files
authored
Bug fixes VideoWriter: video names with spaces (#2388)
* bugfix: shorten video when name contains space * fixed rescale and check_integrity
1 parent ec58927 commit f64ec9a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

deeplabcut/utils/auxfun_videos.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __len__(self):
5555

5656
def check_integrity(self):
5757
dest = os.path.join(self.directory, f"{self.name}.log")
58-
command = f"ffmpeg -v error -i {self.video_path} -f null - 2>{dest}"
58+
command = f'ffmpeg -v error -i "{self.video_path}" -f null - 2>"{dest}"'
5959
subprocess.call(command, shell=True)
6060
if os.path.getsize(dest) != 0:
6161
warnings.warn(f'Video contains errors. See "{dest}" for a detailed report.')
@@ -267,8 +267,8 @@ def validate_timestamp(stamp):
267267

268268
output_path = self.make_output_path(suffix, dest_folder)
269269
command = (
270-
f"ffmpeg -n -i {self.video_path} -ss {start} -to {end} "
271-
f"-c:a copy {output_path}"
270+
f'ffmpeg -n -i "{self.video_path}" -ss {start} -to {end} '
271+
f'-c:a copy "{output_path}"'
272272
)
273273
subprocess.call(command, shell=True)
274274
return output_path
@@ -333,8 +333,8 @@ def rescale(
333333
):
334334
output_path = self.make_output_path(suffix, dest_folder)
335335
command = (
336-
f"ffmpeg -n -i {self.video_path} -filter:v "
337-
f'"scale={width}:{height}{{}}" -c:a copy {output_path}'
336+
f'ffmpeg -n -i "{self.video_path}" -filter:v '
337+
f'"scale={width}:{height}{{}}" -c:a copy "{output_path}"'
338338
)
339339
# Rotate, see: https://stackoverflow.com/questions/3937387/rotating-videos-with-ffmpeg
340340
# interesting option to just update metadata.

0 commit comments

Comments
 (0)