Skip to main content

Module utils

Module utils 

Source
Expand description

Utility functions and helpers for transcode operations.

Functions§

calculate_aspect_ratio
Calculates the aspect ratio from width and height.
calculate_compression_ratio
Calculates compression ratio.
calculate_optimal_tiles
Calculates the optimal tile configuration for parallel encoding.
calculate_space_savings
Calculates space savings.
cleanup_temp_files
Cleans up temporary files.
container_from_extension
Determines the container format from a file extension.
estimate_encoding_time
Estimates encoding time based on video duration and quality settings.
estimate_file_size
Calculates the file size estimate for a transcode.
format_aspect_ratio
Formats an aspect ratio as a string.
format_bitrate
Formats a bitrate in bits per second to a human-readable string.
format_compression_ratio
Formats compression ratio as a percentage.
format_duration
Formats a duration in seconds to a human-readable string.
format_file_size
Formats a file size in bytes to a human-readable string.
format_framerate
Formats framerate as a string.
format_space_savings
Formats space savings.
get_file_extension
Gets the file extension from a path.
is_standard_framerate
Checks if a framerate is standard.
is_standard_resolution
Checks if a resolution is standard (common resolution).
parse_duration
Parses a duration string (e.g., “01:23:45” or “83:45”).
resolution_name
Gets the name of a standard resolution.
suggest_audio_codec
Suggests optimal audio codec based on container format.
suggest_bitrate
Suggests optimal bitrate for a given resolution and framerate.
suggest_video_codec
Suggests optimal codec based on container format.
temp_stats_file
Creates a temporary file path for statistics.
validate_input_file
Validates that a file exists and is readable.
validate_resolution_constraints
Validates resolution constraints.