ecologits.estimations.video
¶
video_impacts(model_name, resolution, duration, with_audio=True, datacenter_location=None, datacenter_pue=None, datacenter_wue=None)
¶
Determines the impacts of generating a video based on the specified model, resolution, and duration. Calculates and returns the detailed impacts related to computational resources, energy consumption, and data processing associated with the generation task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
The name of the model selected for video generation. |
required |
resolution
|
str
|
The resolution of the video to be generated, typically provided as a string (e.g., "1920x1080" or "1080p"). |
required |
duration
|
float
|
The length of the video to generate, specified in seconds. |
required |
with_audio
|
bool
|
Whether the video generation also includes audio. |
True
|
datacenter_location
|
str | None
|
ISO 3166-1 alpha-3 code of the datacenter location. Uses the provider default when omitted or None; pass "WOR" for the world mix. |
None
|
datacenter_pue
|
float | RangeValue | None
|
Power Usage Effectiveness of the datacenter. Uses the provider default when omitted. |
None
|
datacenter_wue
|
float | RangeValue | None
|
Water Usage Effectiveness of the datacenter in L/kWh. Uses the provider default when omitted. |
None
|
Returns:
| Type | Description |
|---|---|
ImpactsOutput
|
An ImpactsOutput object containing details of the computed impacts. |
Source code in ecologits/estimations/video.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
parse_resolution(resolution)
¶
Parses a resolution string and returns its width and height as a tuple.
This function supports named resolutions defined in a private dictionary and direct width x height formats (e.g., "1920x1080"). For named resolutions, the function will return the associated width and height values. If the input does not match these formats, an error is raised.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
str
|
str The resolution string to parse. It may be a named resolution or in the format "widthxheight". |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, int]
|
tuple[int, int] A tuple containing the width and height, respectively. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Raised if the resolution is unsupported or formatted incorrectly. |
Source code in ecologits/estimations/video.py
parse_value_or_range(value)
¶
Parses a fixed numeric value or min/max range from model data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float | dict[str, float]
|
Either a fixed numeric value or a dict containing "min" and "max" values. |
required |
Returns:
| Type | Description |
|---|---|
float | RangeValue
|
The fixed value or a RangeValue. |
Source code in ecologits/estimations/video.py
duration_to_frames(duration)
¶
Converts a video duration in seconds to a frame count at 24 fps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
float
|
The length of the video in seconds. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The number of frames as an integer. |