Created
April 22, 2025 07:59
-
-
Save SqrtRyan/d1aa9fb82f6d31bc60c2ee2f1d4b5b4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rp import * | |
def separate_videos(combined_video_path:str): | |
#Let's say combined_video_path is like '/path/to/preview_video.mp4' | |
combined_video = load_video(combined_video_path) # In THWC form | |
#Trim off the text on the top - only keep the bottom 480 rows of pixels | |
combined_video = combined_video[:, -480:, :, :] | |
left_video,right_video=split_tensor_into_regions(combined_video,1,1,2,1) | |
name = get_file_name(combined_video_path, include_file_extension=False) # Like 'preview_video' | |
left_video_path = with_file_name(combined_video_path, name+'__left' ) # Like '/path/to/preview_video__left.mp4' | |
right_video_path = with_file_name(combined_video_path, name+'__right') # Like '/path/to/preview_video__right.mp4' | |
framerate=20 #Change this as you like - its the FPS | |
save_video_mp4(left_video , left_video_path , framerate=framerate, video_bitrate="max") | |
save_video_mp4(right_video, right_video_path, framerate=framerate, video_bitrate="max") | |
return left_video_path, right_video_path | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment