vikit.wrappers.ffmpeg_wrapper¶
Overview¶
|
Concatenate multiple videos into a single video. |
|
Save the incoming audio file to a regular mp3 file with a standardized filename |
|
Creates a video zooming into an image for a certain duration |
|
Cuts the video starting at start_time and ending at end_time |
|
Extract all audio tracks from a video and output them as separate files. |
|
Extract a slice of the audio file using ffmpeg |
|
Generates a video from an image |
|
Get the first frame of the video |
|
Get the last frame of the video |
|
Get the duration of a media file. |
|
Get the frames per second of a media file. |
|
Check if the video has an audio track |
|
Merge audio with the video |
|
Reencode the video, doing this for imported video that might not concatenate well |
|
Reverses the frames of the video, with last frame being the first, second to last |
Functions¶
- async vikit.wrappers.ffmpeg_wrapper.concatenate_videos(video_file_paths: list[str], target_file_name: str = None, ratio_to_multiply_animations: float = 1) str¶
Concatenate multiple videos into a single video.
- Parameters:
video_file_paths -- The file paths to the videos to concatenate. Must contain at least 1 path and all videos must have the same FPS.
target_file_name -- The target file of the video file to create. Default: TargetCompositeVideo.mp4
ratioToMultiplyAnimations -- The ratio by which to speed up or slow down the video to match its duration to an expected duration, e.g. of an audio track.
- Returns:
The path to the concatenated video file
- Return type:
- Raises:
ValueError -- If video_file_paths is empty or the videos don’t have the same FPS.
FileNotFoundError -- If any of the video files does not exist.
- async vikit.wrappers.ffmpeg_wrapper.convert_as_mp3_file(fileName, target_file_name: str)¶
Save the incoming audio file to a regular mp3 file with a standardized filename
- async vikit.wrappers.ffmpeg_wrapper.create_zoom_video(image_url, target_duration=3, target_video_name=None)¶
Creates a video zooming into an image for a certain duration :param image_url: The image url to zoom in :type image_url: str :param target_duration: Optional, the duration of the output video in seconds :type target_duration: float :param target_video_name: Optional, the name of the output video :type target_video_name: string
- Returns:
The zoomed video
- Return type:
- async vikit.wrappers.ffmpeg_wrapper.cut_video(video_url, start_time, end_time, target_duration=None, target_video_name=None)¶
Cuts the video starting at start_time and ending at end_time :param video_url: The video url to cut (eg ./videofolder/video.mp4) :type video_url: str :param start_time: The begining time of the video in seconds :type start_time: float :param end_time: The end time of the video in seconds :type end_time: float :param target_duration: Optional, the duration of the output video in seconds :type target_duration: float :param target_video_name: Optional, the name of the output video in seconds :type target_video_name: string
- Returns:
The reencoded video
- Return type:
- async vikit.wrappers.ffmpeg_wrapper.extract_audio_from_video(video_full_path, target_dir: str = None) str¶
Extract all audio tracks from a video and output them as separate files. Naive implementation:
we do not check the existence of audio stream,
we do not check the pre-existence of the output file,
- Parameters:
video_full_path (str) -- Full path of the input video file.
target_dir -- Directory where to store audio file
- Returns:
The output audio file path
- async vikit.wrappers.ffmpeg_wrapper.extract_audio_slice(audiofile_path: str, start: float = 0, end: float = 1, target_file_name: str = None)¶
Extract a slice of the audio file using ffmpeg
- async vikit.wrappers.ffmpeg_wrapper.generate_video_from_image(image_url, duration=5, dimensions=(1280, 720), target_path=None)¶
Generates a video from an image
- async vikit.wrappers.ffmpeg_wrapper.get_first_frame_as_image_ffmpeg(media_url, target_path=None)¶
Get the first frame of the video
- async vikit.wrappers.ffmpeg_wrapper.get_last_frame_as_image_ffmpeg(media_url, target_path=None)¶
Get the last frame of the video
- vikit.wrappers.ffmpeg_wrapper.get_media_duration(input_video_path)¶
Get the duration of a media file.
- vikit.wrappers.ffmpeg_wrapper.get_media_fps(input_video_path)¶
Get the frames per second of a media file.
- vikit.wrappers.ffmpeg_wrapper.has_audio_track(video_path)¶
Check if the video has an audio track
- async vikit.wrappers.ffmpeg_wrapper.merge_audio(media_url: str, audio_file_path: str, audio_file_relative_volume: float | None = None, target_file_name=None)¶
Merge audio with the video
- async vikit.wrappers.ffmpeg_wrapper.reencode_video(video_url, target_video_name=None, fps=24)¶
Reencode the video, doing this for imported video that might not concatenate well with generated ones or among themselves
- async vikit.wrappers.ffmpeg_wrapper.reverse_video(video_url, target_video_name=None)¶
Reverses the frames of the video, with last frame being the first, second to last the second etc… and first frame the latest one :param video_url: The video to reverse :type video_url: str :param target_video_name: Optional, the name of the output video :type target_video_name: string
- Returns:
The reversed video
- Return type: