Skip to content

Commit aefc407

Browse files
committed
rotation
1 parent c93e7fc commit aefc407

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

open_dubbing/video_processing.py

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
from moviepy import AudioFileClip, VideoFileClip, concatenate_videoclips
2121

22+
from open_dubbing import logger
23+
2224
_DEFAULT_FPS: Final[int] = 30
2325
_DEFAULT_DUBBED_VIDEO_FILE: Final[str] = "dubbed_video"
2426
_DEFAULT_OUTPUT_FORMAT: Final[str] = ".mp4"
@@ -40,6 +42,11 @@ def split_audio_video(*, video_file: str, output_directory: str) -> tuple[str, s
4042
video_clip_without_audio = video_clip.with_audio(None)
4143
fps = video_clip.fps or _DEFAULT_FPS
4244

45+
rotation_angle = getattr(video_clip, "rotation", 0)
46+
if rotation_angle in [90, 180, 270]:
47+
video_clip = video_clip.rotated(rotation_angle)
48+
logger().info(f"Keep rotation angle {rotation_angle} for video")
49+
4350
video_output_file = os.path.join(output_directory, filename + "_video.mp4")
4451
video_clip_without_audio.write_videofile(
4552
video_output_file, codec="libx264", fps=fps, logger=None

0 commit comments

Comments
 (0)