| 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): |