ntt.videos package#
Submodules#
ntt.videos.change_speed module#
- ntt.videos.change_speed.change_speed(video_path_in: str, video_path_out: str, speed_factor: float = 1.0, backend: str = 'opencv') str#
Change video speed using the requested backend.
- ntt.videos.change_speed.change_speed_ffmpeg(video_path_in: str, video_path_out: str, speed_factor: float) str#
Change video speed using ffmpeg setpts.
- ntt.videos.change_speed.change_speed_moviepy(video_path_in: str, video_path_out: str, speed_factor: float) str#
Change video speed using MoviePy.
- ntt.videos.change_speed.change_speed_opencv(video_path_in: str, video_path_out: str, speed_factor: float) str#
Change video speed by resampling frames with OpenCV.
- ntt.videos.change_speed.change_video_speed(video_path_in: str, video_path_out: str, speed_factor: float = 1.0, backend: str = 'opencv') str#
Change video speed using the requested backend.
- ntt.videos.change_speed.change_video_speed_ffmpeg(video_path_in: str, video_path_out: str, speed_factor: float) str#
Change video speed using ffmpeg setpts.
- ntt.videos.change_speed.change_video_speed_moviepy(video_path_in: str, video_path_out: str, speed_factor: float) str#
Change video speed using MoviePy.
- ntt.videos.change_speed.change_video_speed_opencv(video_path_in: str, video_path_out: str, speed_factor: float) str#
Change video speed by resampling frames with OpenCV.
ntt.videos.compress module#
- ntt.videos.compress.compress_video_ffmpeg_cmd(video_path_in, video_path_out, ext='_comp35')#
- ntt.videos.compress.convert_video(file_path_in, file_name_in, file_path_out, file_name_out)#
ntt.videos.create_clip module#
ntt.videos.crop module#
- ntt.videos.crop.crop_video(input_path: str, output_path: str, x1: int, y1: int, x2: int, y2: int, backend: str = 'opencv', zoom_factor: float = 1.0) str#
- ntt.videos.crop.crop_video_ffmpeg(input_path: str, output_path: str, x1: int, y1: int, x2: int, y2: int, zoom_factor: float = 1.0) str#
- ntt.videos.crop.crop_video_moviepy(input_path: str, output_path: str, x1: int, y1: int, x2: int, y2: int, zoom_factor: float = 1.0) str#
- ntt.videos.crop.crop_video_opencv(input_path: str, output_path: str, x1: int, y1: int, x2: int, y2: int, zoom_factor: float = 1.0) str#
ntt.videos.dimensions module#
- ntt.videos.dimensions.get_video_dimensions(video_path)#
ntt.videos.display module#
ntt.videos.duration module#
- ntt.videos.duration.get_video_duration(video_path_in, video_name)#
- ntt.videos.duration.remove_duration_ffmpeg(input_file, output_file, start_time)#
- ntt.videos.duration.remove_duration_movieclip(input_file, output_file, duration)#
ntt.videos.exif module#
Technical metadata extraction for videos.
Two backends with the same interface so they can be used interchangeably:
extract_metadata_opencv– uses cv2.VideoCapture (no subprocess).extract_metadata_ffprobe– uses ffmpeg-python (already a project dependency).
Both functions:
- Accept a video file path.
- Return a dict with consistent keys:
width,height,fps,frame_count,duration_s,codec.
Raise
FileNotFoundErrorif the file does not exist.
- ntt.videos.exif.extract_metadata_ffprobe(video_path: str) dict#
Extract technical metadata from a video using ffprobe (via ffmpeg-python).
- Parameters:
video_path (str) – Path to the video file.
- Returns:
- Keys:
width,height,fps,frame_count, duration_s,codec.
- Keys:
- Return type:
dict
- Raises:
FileNotFoundError – If the file does not exist.
- ntt.videos.exif.extract_metadata_opencv(video_path: str) dict#
Extract technical metadata from a video using OpenCV.
- Parameters:
video_path (str) – Path to the video file.
- Returns:
- Keys:
width,height,fps,frame_count, duration_s,codec.
- Keys:
- Return type:
dict
- Raises:
FileNotFoundError – If the file does not exist.
ntt.videos.get_fourcc module#
ntt.videos.info module#
- ntt.videos.info.extract_video_info(video_path: str, backend: str = 'auto') dict#
Return unified video info with optional backend selection.
- ntt.videos.info.extract_video_info_ffprobe(video_path: str) dict#
Return unified video info using ffprobe.
- ntt.videos.info.extract_video_info_opencv(video_path: str) dict#
Return unified video info using OpenCV only.
ntt.videos.io module#
- ntt.videos.io.get_writer_fourcc(video_path: str) int#
Return a container-compatible fourcc for the output path.
- ntt.videos.io.read(video_path: str) list#
- ntt.videos.io.read_video(video_path: str) list#
- ntt.videos.io.write(video_path: str, frames: list, fps: int = 30) str#
- ntt.videos.io.write_video(video_path: str, frames: list, fps: int = 30) str#
ntt.videos.peak module#
- ntt.videos.peak.detect_peak_in_video(file_path)#
- ntt.videos.peak.detect_peak_video(input_path, video_name_in, output_path, video_name_out, xa, xb, ya, yb, seuil=200, frame_begin=0, frame_end=-1, nb_frame=-1, afficher_anime=True, afficher_hist=False, write_video=True, clip_before_seconds=1.0, clip_after_seconds=1.0)#
ntt.videos.shake_video module#
- ntt.videos.shake_video.rotate_video(video_path_in, video_name, rotation_increment, video_path_out)#
- ntt.videos.shake_video.shake_video_randomly(video_path_in, video_name, shake_intensity, video_path_out)#
- ntt.videos.shake_video.translate_video_horizontally(video_path_in, video_name, translation_rate, video_path_out)#
- ntt.videos.shake_video.translate_video_vertically(video_path_in, video_name, translation_rate, video_path_out)#
ntt.videos.show module#
- ntt.videos.show.show_video(video_path, window_name='Video')#
Show a video in a window at its native frame rate.
- Parameters:
video_path (str) – Path to the video file.
window_name (str) – Title of the display window.
Press Esc or Q to quit early.
ntt.videos.split_video module#
- ntt.videos.split_video.split_video_ffmpeg(video_path_in: str, video_name: str, output_path: str, n: int) None#
This function splits a video into n segments of equal duration using ffmpeg.
- Parameters:
video_path_in (string) – path to the folder conataining the input video
video_name (string) – name of the input video
output_path (string) – path to the folder conataining the output segments
n (int) – number of segments
- Raises:
ValueError – if n is negative
Exception – if the video is not found
- Returns:
None
ntt.videos.stich module#
- ntt.videos.stich.stitch_2_videos(video_path_in, video_name_in1, video_name_in2, video_path_out, video_name_out, time_difference, src_pts1, dest_pts1, src_pts2, dest_pts2)#
stitches video1 and video2 based on the source and destination points
ntt.videos.video_generation module#
ntt.videos.video_overlay module#
- ntt.videos.video_overlay.overlay_two_videos_opencv(path_videos, name_video1, name_video2, opacities, path_video_out)#
- ntt.videos.video_overlay.overlay_videos_moviepy(list_videos_path, opacities, path_video_out)#
ntt.videos.zoom module#
- ntt.videos.zoom.zoom_xy(input_video, output_video, zoom_x, zoom_y, zoom_duration=1.0, screensize=(640, 360))#