|
52 | 52 | validate_image_aspect_ratio, |
53 | 53 | validate_image_dimensions, |
54 | 54 | validate_string, |
| 55 | + validate_video_dimensions, |
| 56 | + validate_video_duration, |
55 | 57 | ) |
56 | 58 | from server import PromptServer |
57 | 59 |
|
@@ -1904,6 +1906,8 @@ async def execute( |
1904 | 1906 | ) -> IO.NodeOutput: |
1905 | 1907 | # if len(name) > 64: |
1906 | 1908 | # raise ValueError("Name of asset can not be greater then 64 symbols") |
| 1909 | + validate_image_dimensions(image, min_width=300, max_width=6000, min_height=300, max_height=6000) |
| 1910 | + validate_image_aspect_ratio(image, min_ratio=(0.4, 1), max_ratio=(2.5, 1)) |
1907 | 1911 | resolved_group = await _resolve_group_id(cls, group_id) |
1908 | 1912 | asset_id = await _create_seedance_asset( |
1909 | 1913 | cls, |
@@ -1965,6 +1969,24 @@ async def execute( |
1965 | 1969 | ) -> IO.NodeOutput: |
1966 | 1970 | # if len(name) > 64: |
1967 | 1971 | # raise ValueError("Name of asset can not be greater then 64 symbols") |
| 1972 | + validate_video_duration(video, min_duration=2, max_duration=15) |
| 1973 | + validate_video_dimensions(video, min_width=300, max_width=6000, min_height=300, max_height=6000) |
| 1974 | + |
| 1975 | + w, h = video.get_dimensions() |
| 1976 | + if h > 0: |
| 1977 | + ratio = w / h |
| 1978 | + if not (0.4 <= ratio <= 2.5): |
| 1979 | + raise ValueError(f"Asset video aspect ratio (W/H) must be in [0.4, 2.5], got {ratio:.3f} ({w}x{h}).") |
| 1980 | + pixels = w * h |
| 1981 | + if not (409_600 <= pixels <= 927_408): |
| 1982 | + raise ValueError( |
| 1983 | + f"Asset video total pixels (W×H) must be in [409600, 927408], " f"got {pixels:,} ({w}x{h})." |
| 1984 | + ) |
| 1985 | + |
| 1986 | + fps = float(video.get_frame_rate()) |
| 1987 | + if not (24 <= fps <= 60): |
| 1988 | + raise ValueError(f"Asset video FPS must be in [24, 60], got {fps:.2f}.") |
| 1989 | + |
1968 | 1990 | resolved_group = await _resolve_group_id(cls, group_id) |
1969 | 1991 | asset_id = await _create_seedance_asset( |
1970 | 1992 | cls, |
|
0 commit comments