MCPcopy Create free account
hub / github.com/DeepLabCut/DeepLabCut / rescale

Method rescale

deeplabcut/utils/auxfun_videos.py:319–340  ·  view source on GitHub ↗
(
        self,
        width,
        height=-1,
        rotatecw="No",
        angle=0.0,
        suffix="rescale",
        dest_folder=None,
    )

Source from the content-addressed store, hash-verified

317 return output_path
318
319 def rescale(
320 self,
321 width,
322 height=-1,
323 rotatecw="No",
324 angle=0.0,
325 suffix="rescale",
326 dest_folder=None,
327 ):
328 output_path = self.make_output_path(suffix, dest_folder)
329 command = f'ffmpeg -n -i "{self.video_path}" -filter:v "scale={width}:{height}{{}}" -c:a copy "{output_path}"'
330 # Rotate, see: https://stackoverflow.com/questions/3937387/rotating-videos-with-ffmpeg
331 # interesting option to just update metadata.
332 if rotatecw == "Arbitrary":
333 angle = np.deg2rad(angle)
334 command = command.format(f", rotate={angle}")
335 elif rotatecw == "Yes":
336 command = command.format(", transpose=1")
337 else:
338 command = command.format("")
339 subprocess.call(command, shell=True)
340 return output_path
341
342 @staticmethod
343 def write_frame(frame, where):

Callers 2

DownSampleVideoFunction · 0.95
test_writer_rescaleFunction · 0.80

Calls 3

make_output_pathMethod · 0.95
formatMethod · 0.80
callMethod · 0.45

Tested by 1

test_writer_rescaleFunction · 0.64