magic_hour 0.9.5__py3-none-any.whl → 0.44.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- magic_hour/README.md +34 -0
- magic_hour/__init__.py +1 -1
- magic_hour/client.py +8 -17
- magic_hour/environment.py +13 -1
- magic_hour/helpers/__init__.py +4 -0
- magic_hour/helpers/download.py +77 -0
- magic_hour/helpers/logger.py +8 -0
- magic_hour/resources/v1/README.md +32 -0
- magic_hour/resources/v1/ai_clothes_changer/README.md +94 -5
- magic_hour/resources/v1/ai_clothes_changer/client.py +161 -16
- magic_hour/resources/v1/ai_face_editor/README.md +195 -0
- magic_hour/resources/v1/ai_face_editor/__init__.py +4 -0
- magic_hour/resources/v1/ai_face_editor/client.py +324 -0
- magic_hour/resources/v1/ai_gif_generator/README.md +116 -0
- magic_hour/resources/v1/ai_gif_generator/__init__.py +4 -0
- magic_hour/resources/v1/ai_gif_generator/client.py +257 -0
- magic_hour/resources/v1/ai_headshot_generator/README.md +81 -3
- magic_hour/resources/v1/ai_headshot_generator/client.py +167 -18
- magic_hour/resources/v1/ai_image_editor/README.md +125 -0
- magic_hour/resources/v1/ai_image_editor/__init__.py +4 -0
- magic_hour/resources/v1/ai_image_editor/client.py +290 -0
- magic_hour/resources/v1/ai_image_generator/README.md +99 -5
- magic_hour/resources/v1/ai_image_generator/client.py +170 -24
- magic_hour/resources/v1/ai_image_upscaler/README.md +89 -3
- magic_hour/resources/v1/ai_image_upscaler/client.py +173 -20
- magic_hour/resources/v1/ai_meme_generator/README.md +129 -0
- magic_hour/resources/v1/ai_meme_generator/__init__.py +4 -0
- magic_hour/resources/v1/ai_meme_generator/client.py +253 -0
- magic_hour/resources/v1/ai_photo_editor/README.md +119 -4
- magic_hour/resources/v1/ai_photo_editor/client.py +199 -18
- magic_hour/resources/v1/ai_qr_code_generator/README.md +84 -3
- magic_hour/resources/v1/ai_qr_code_generator/client.py +140 -18
- magic_hour/resources/v1/ai_talking_photo/README.md +137 -0
- magic_hour/resources/v1/ai_talking_photo/__init__.py +4 -0
- magic_hour/resources/v1/ai_talking_photo/client.py +326 -0
- magic_hour/resources/v1/ai_voice_cloner/README.md +62 -0
- magic_hour/resources/v1/ai_voice_cloner/__init__.py +4 -0
- magic_hour/resources/v1/ai_voice_cloner/client.py +272 -0
- magic_hour/resources/v1/ai_voice_generator/README.md +112 -0
- magic_hour/resources/v1/ai_voice_generator/__init__.py +4 -0
- magic_hour/resources/v1/ai_voice_generator/client.py +241 -0
- magic_hour/resources/v1/animation/README.md +128 -6
- magic_hour/resources/v1/animation/client.py +247 -22
- magic_hour/resources/v1/audio_projects/README.md +135 -0
- magic_hour/resources/v1/audio_projects/__init__.py +12 -0
- magic_hour/resources/v1/audio_projects/client.py +310 -0
- magic_hour/resources/v1/audio_projects/client_test.py +520 -0
- magic_hour/resources/v1/auto_subtitle_generator/README.md +128 -0
- magic_hour/resources/v1/auto_subtitle_generator/__init__.py +4 -0
- magic_hour/resources/v1/auto_subtitle_generator/client.py +346 -0
- magic_hour/resources/v1/client.py +75 -1
- magic_hour/resources/v1/face_detection/README.md +157 -0
- magic_hour/resources/v1/face_detection/__init__.py +12 -0
- magic_hour/resources/v1/face_detection/client.py +380 -0
- magic_hour/resources/v1/face_swap/README.md +137 -9
- magic_hour/resources/v1/face_swap/client.py +329 -38
- magic_hour/resources/v1/face_swap_photo/README.md +118 -3
- magic_hour/resources/v1/face_swap_photo/client.py +199 -14
- magic_hour/resources/v1/files/README.md +39 -0
- magic_hour/resources/v1/files/client.py +351 -1
- magic_hour/resources/v1/files/client_test.py +414 -0
- magic_hour/resources/v1/files/upload_urls/README.md +38 -17
- magic_hour/resources/v1/files/upload_urls/client.py +38 -34
- magic_hour/resources/v1/image_background_remover/README.md +96 -5
- magic_hour/resources/v1/image_background_remover/client.py +151 -16
- magic_hour/resources/v1/image_projects/README.md +82 -10
- magic_hour/resources/v1/image_projects/__init__.py +10 -2
- magic_hour/resources/v1/image_projects/client.py +154 -16
- magic_hour/resources/v1/image_projects/client_test.py +527 -0
- magic_hour/resources/v1/image_to_video/README.md +96 -11
- magic_hour/resources/v1/image_to_video/client.py +282 -38
- magic_hour/resources/v1/lip_sync/README.md +112 -9
- magic_hour/resources/v1/lip_sync/client.py +288 -34
- magic_hour/resources/v1/photo_colorizer/README.md +107 -0
- magic_hour/resources/v1/photo_colorizer/__init__.py +4 -0
- magic_hour/resources/v1/photo_colorizer/client.py +248 -0
- magic_hour/resources/v1/text_to_video/README.md +96 -7
- magic_hour/resources/v1/text_to_video/client.py +204 -18
- magic_hour/resources/v1/video_projects/README.md +81 -9
- magic_hour/resources/v1/video_projects/__init__.py +10 -2
- magic_hour/resources/v1/video_projects/client.py +151 -14
- magic_hour/resources/v1/video_projects/client_test.py +527 -0
- magic_hour/resources/v1/video_to_video/README.md +119 -15
- magic_hour/resources/v1/video_to_video/client.py +299 -46
- magic_hour/types/models/__init__.py +92 -56
- magic_hour/types/models/v1_ai_clothes_changer_create_response.py +33 -0
- magic_hour/types/models/v1_ai_face_editor_create_response.py +33 -0
- magic_hour/types/models/v1_ai_gif_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_headshot_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_image_editor_create_response.py +33 -0
- magic_hour/types/models/v1_ai_image_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_image_upscaler_create_response.py +33 -0
- magic_hour/types/models/v1_ai_meme_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_photo_editor_create_response.py +33 -0
- magic_hour/types/models/v1_ai_qr_code_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_talking_photo_create_response.py +35 -0
- magic_hour/types/models/v1_ai_voice_cloner_create_response.py +27 -0
- magic_hour/types/models/v1_ai_voice_generator_create_response.py +27 -0
- magic_hour/types/models/v1_animation_create_response.py +35 -0
- magic_hour/types/models/v1_audio_projects_get_response.py +72 -0
- magic_hour/types/models/v1_audio_projects_get_response_downloads_item.py +19 -0
- magic_hour/types/models/{get_v1_image_projects_id_response_error.py → v1_audio_projects_get_response_error.py} +2 -2
- magic_hour/types/models/v1_auto_subtitle_generator_create_response.py +35 -0
- magic_hour/types/models/v1_face_detection_create_response.py +25 -0
- magic_hour/types/models/v1_face_detection_get_response.py +45 -0
- magic_hour/types/models/v1_face_detection_get_response_faces_item.py +25 -0
- magic_hour/types/models/v1_face_swap_create_response.py +35 -0
- magic_hour/types/models/v1_face_swap_photo_create_response.py +33 -0
- magic_hour/types/models/v1_files_upload_urls_create_response.py +24 -0
- magic_hour/types/models/{post_v1_files_upload_urls_response_items_item.py → v1_files_upload_urls_create_response_items_item.py} +2 -2
- magic_hour/types/models/v1_image_background_remover_create_response.py +33 -0
- magic_hour/types/models/{get_v1_image_projects_id_response.py → v1_image_projects_get_response.py} +20 -18
- magic_hour/types/models/{get_v1_video_projects_id_response_downloads_item.py → v1_image_projects_get_response_downloads_item.py} +1 -1
- magic_hour/types/models/{get_v1_video_projects_id_response_error.py → v1_image_projects_get_response_error.py} +2 -2
- magic_hour/types/models/v1_image_to_video_create_response.py +35 -0
- magic_hour/types/models/v1_lip_sync_create_response.py +35 -0
- magic_hour/types/models/v1_photo_colorizer_create_response.py +33 -0
- magic_hour/types/models/v1_text_to_video_create_response.py +35 -0
- magic_hour/types/models/{get_v1_video_projects_id_response.py → v1_video_projects_get_response.py} +26 -23
- magic_hour/types/models/{get_v1_video_projects_id_response_download.py → v1_video_projects_get_response_download.py} +1 -1
- magic_hour/types/models/{get_v1_image_projects_id_response_downloads_item.py → v1_video_projects_get_response_downloads_item.py} +1 -1
- magic_hour/types/models/v1_video_projects_get_response_error.py +25 -0
- magic_hour/types/models/v1_video_to_video_create_response.py +35 -0
- magic_hour/types/params/__init__.py +422 -176
- magic_hour/types/params/v1_ai_clothes_changer_create_body.py +40 -0
- magic_hour/types/params/v1_ai_clothes_changer_create_body_assets.py +58 -0
- magic_hour/types/params/v1_ai_clothes_changer_generate_body_assets.py +33 -0
- magic_hour/types/params/v1_ai_face_editor_create_body.py +52 -0
- magic_hour/types/params/v1_ai_face_editor_create_body_assets.py +33 -0
- magic_hour/types/params/v1_ai_face_editor_create_body_style.py +137 -0
- magic_hour/types/params/v1_ai_face_editor_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_ai_gif_generator_create_body.py +47 -0
- magic_hour/types/params/{post_v1_ai_image_generator_body_style.py → v1_ai_gif_generator_create_body_style.py} +5 -5
- magic_hour/types/params/v1_ai_headshot_generator_create_body.py +49 -0
- magic_hour/types/params/v1_ai_headshot_generator_create_body_assets.py +33 -0
- magic_hour/types/params/v1_ai_headshot_generator_create_body_style.py +27 -0
- magic_hour/types/params/v1_ai_headshot_generator_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_ai_image_editor_create_body.py +49 -0
- magic_hour/types/params/v1_ai_image_editor_create_body_assets.py +47 -0
- magic_hour/types/params/v1_ai_image_editor_create_body_style.py +41 -0
- magic_hour/types/params/v1_ai_image_editor_generate_body_assets.py +28 -0
- magic_hour/types/params/{post_v1_ai_image_generator_body.py → v1_ai_image_generator_create_body.py} +17 -11
- magic_hour/types/params/v1_ai_image_generator_create_body_style.py +127 -0
- magic_hour/types/params/v1_ai_image_upscaler_create_body.py +59 -0
- magic_hour/types/params/v1_ai_image_upscaler_create_body_assets.py +33 -0
- magic_hour/types/params/{post_v1_ai_image_upscaler_body_style.py → v1_ai_image_upscaler_create_body_style.py} +4 -4
- magic_hour/types/params/v1_ai_image_upscaler_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_ai_meme_generator_create_body.py +37 -0
- magic_hour/types/params/v1_ai_meme_generator_create_body_style.py +73 -0
- magic_hour/types/params/{post_v1_ai_photo_editor_body.py → v1_ai_photo_editor_create_body.py} +15 -15
- magic_hour/types/params/v1_ai_photo_editor_create_body_assets.py +33 -0
- magic_hour/types/params/{post_v1_ai_photo_editor_body_style.py → v1_ai_photo_editor_create_body_style.py} +20 -4
- magic_hour/types/params/v1_ai_photo_editor_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_ai_qr_code_generator_create_body.py +45 -0
- magic_hour/types/params/{post_v1_ai_qr_code_generator_body_style.py → v1_ai_qr_code_generator_create_body_style.py} +4 -4
- magic_hour/types/params/v1_ai_talking_photo_create_body.py +68 -0
- magic_hour/types/params/v1_ai_talking_photo_create_body_assets.py +46 -0
- magic_hour/types/params/v1_ai_talking_photo_create_body_style.py +44 -0
- magic_hour/types/params/v1_ai_talking_photo_generate_body_assets.py +26 -0
- magic_hour/types/params/v1_ai_voice_cloner_create_body.py +49 -0
- magic_hour/types/params/v1_ai_voice_cloner_create_body_assets.py +33 -0
- magic_hour/types/params/v1_ai_voice_cloner_create_body_style.py +28 -0
- magic_hour/types/params/v1_ai_voice_cloner_generate_body_assets.py +28 -0
- magic_hour/types/params/v1_ai_voice_generator_create_body.py +40 -0
- magic_hour/types/params/v1_ai_voice_generator_create_body_style.py +440 -0
- magic_hour/types/params/{post_v1_animation_body.py → v1_animation_create_body.py} +16 -16
- magic_hour/types/params/{post_v1_animation_body_assets.py → v1_animation_create_body_assets.py} +15 -5
- magic_hour/types/params/{post_v1_animation_body_style.py → v1_animation_create_body_style.py} +13 -10
- magic_hour/types/params/v1_animation_generate_body_assets.py +39 -0
- magic_hour/types/params/v1_auto_subtitle_generator_create_body.py +78 -0
- magic_hour/types/params/v1_auto_subtitle_generator_create_body_assets.py +33 -0
- magic_hour/types/params/v1_auto_subtitle_generator_create_body_style.py +56 -0
- magic_hour/types/params/v1_auto_subtitle_generator_create_body_style_custom_config.py +86 -0
- magic_hour/types/params/v1_auto_subtitle_generator_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_face_detection_create_body.py +44 -0
- magic_hour/types/params/v1_face_detection_create_body_assets.py +33 -0
- magic_hour/types/params/v1_face_detection_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_face_swap_create_body.py +92 -0
- magic_hour/types/params/v1_face_swap_create_body_assets.py +91 -0
- magic_hour/types/params/v1_face_swap_create_body_assets_face_mappings_item.py +44 -0
- magic_hour/types/params/v1_face_swap_create_body_style.py +33 -0
- magic_hour/types/params/v1_face_swap_generate_body_assets.py +56 -0
- magic_hour/types/params/v1_face_swap_generate_body_assets_face_mappings_item.py +25 -0
- magic_hour/types/params/v1_face_swap_photo_create_body.py +40 -0
- magic_hour/types/params/v1_face_swap_photo_create_body_assets.py +76 -0
- magic_hour/types/params/v1_face_swap_photo_create_body_assets_face_mappings_item.py +44 -0
- magic_hour/types/params/v1_face_swap_photo_generate_body_assets.py +47 -0
- magic_hour/types/params/v1_face_swap_photo_generate_body_assets_face_mappings_item.py +25 -0
- magic_hour/types/params/v1_files_upload_urls_create_body.py +36 -0
- magic_hour/types/params/v1_files_upload_urls_create_body_items_item.py +38 -0
- magic_hour/types/params/v1_image_background_remover_create_body.py +40 -0
- magic_hour/types/params/v1_image_background_remover_create_body_assets.py +49 -0
- magic_hour/types/params/v1_image_background_remover_generate_body_assets.py +27 -0
- magic_hour/types/params/v1_image_to_video_create_body.py +101 -0
- magic_hour/types/params/v1_image_to_video_create_body_assets.py +33 -0
- magic_hour/types/params/v1_image_to_video_create_body_style.py +53 -0
- magic_hour/types/params/v1_image_to_video_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_lip_sync_create_body.py +100 -0
- magic_hour/types/params/{post_v1_lip_sync_body_assets.py → v1_lip_sync_create_body_assets.py} +15 -5
- magic_hour/types/params/v1_lip_sync_create_body_style.py +37 -0
- magic_hour/types/params/v1_lip_sync_generate_body_assets.py +36 -0
- magic_hour/types/params/v1_photo_colorizer_create_body.py +40 -0
- magic_hour/types/params/v1_photo_colorizer_create_body_assets.py +33 -0
- magic_hour/types/params/v1_photo_colorizer_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_text_to_video_create_body.py +78 -0
- magic_hour/types/params/v1_text_to_video_create_body_style.py +43 -0
- magic_hour/types/params/v1_video_to_video_create_body.py +101 -0
- magic_hour/types/params/{post_v1_video_to_video_body_assets.py → v1_video_to_video_create_body_assets.py} +9 -4
- magic_hour/types/params/{post_v1_video_to_video_body_style.py → v1_video_to_video_create_body_style.py} +68 -26
- magic_hour/types/params/v1_video_to_video_generate_body_assets.py +27 -0
- magic_hour-0.44.0.dist-info/METADATA +328 -0
- magic_hour-0.44.0.dist-info/RECORD +231 -0
- magic_hour/core/__init__.py +0 -52
- magic_hour/core/api_error.py +0 -56
- magic_hour/core/auth.py +0 -314
- magic_hour/core/base_client.py +0 -618
- magic_hour/core/binary_response.py +0 -23
- magic_hour/core/query.py +0 -106
- magic_hour/core/request.py +0 -156
- magic_hour/core/response.py +0 -293
- magic_hour/core/type_utils.py +0 -28
- magic_hour/core/utils.py +0 -55
- magic_hour/types/models/post_v1_ai_clothes_changer_response.py +0 -25
- magic_hour/types/models/post_v1_ai_headshot_generator_response.py +0 -25
- magic_hour/types/models/post_v1_ai_image_generator_response.py +0 -25
- magic_hour/types/models/post_v1_ai_image_upscaler_response.py +0 -25
- magic_hour/types/models/post_v1_ai_photo_editor_response.py +0 -25
- magic_hour/types/models/post_v1_ai_qr_code_generator_response.py +0 -25
- magic_hour/types/models/post_v1_animation_response.py +0 -25
- magic_hour/types/models/post_v1_face_swap_photo_response.py +0 -25
- magic_hour/types/models/post_v1_face_swap_response.py +0 -25
- magic_hour/types/models/post_v1_files_upload_urls_response.py +0 -21
- magic_hour/types/models/post_v1_image_background_remover_response.py +0 -25
- magic_hour/types/models/post_v1_image_to_video_response.py +0 -25
- magic_hour/types/models/post_v1_lip_sync_response.py +0 -25
- magic_hour/types/models/post_v1_text_to_video_response.py +0 -25
- magic_hour/types/models/post_v1_video_to_video_response.py +0 -25
- magic_hour/types/params/post_v1_ai_clothes_changer_body.py +0 -40
- magic_hour/types/params/post_v1_ai_clothes_changer_body_assets.py +0 -45
- magic_hour/types/params/post_v1_ai_headshot_generator_body.py +0 -40
- magic_hour/types/params/post_v1_ai_headshot_generator_body_assets.py +0 -28
- magic_hour/types/params/post_v1_ai_image_upscaler_body.py +0 -57
- magic_hour/types/params/post_v1_ai_image_upscaler_body_assets.py +0 -28
- magic_hour/types/params/post_v1_ai_photo_editor_body_assets.py +0 -28
- magic_hour/types/params/post_v1_ai_qr_code_generator_body.py +0 -45
- magic_hour/types/params/post_v1_face_swap_body.py +0 -72
- magic_hour/types/params/post_v1_face_swap_body_assets.py +0 -52
- magic_hour/types/params/post_v1_face_swap_photo_body.py +0 -40
- magic_hour/types/params/post_v1_face_swap_photo_body_assets.py +0 -36
- magic_hour/types/params/post_v1_files_upload_urls_body.py +0 -31
- magic_hour/types/params/post_v1_files_upload_urls_body_items_item.py +0 -38
- magic_hour/types/params/post_v1_image_background_remover_body.py +0 -40
- magic_hour/types/params/post_v1_image_background_remover_body_assets.py +0 -28
- magic_hour/types/params/post_v1_image_to_video_body.py +0 -73
- magic_hour/types/params/post_v1_image_to_video_body_assets.py +0 -28
- magic_hour/types/params/post_v1_image_to_video_body_style.py +0 -37
- magic_hour/types/params/post_v1_lip_sync_body.py +0 -80
- magic_hour/types/params/post_v1_text_to_video_body.py +0 -57
- magic_hour/types/params/post_v1_text_to_video_body_style.py +0 -28
- magic_hour/types/params/post_v1_video_to_video_body.py +0 -93
- magic_hour-0.9.5.dist-info/METADATA +0 -133
- magic_hour-0.9.5.dist-info/RECORD +0 -132
- {magic_hour-0.9.5.dist-info → magic_hour-0.44.0.dist-info}/LICENSE +0 -0
- {magic_hour-0.9.5.dist-info → magic_hour-0.44.0.dist-info}/WHEEL +0 -0
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import typing
|
|
2
|
+
import typing_extensions
|
|
2
3
|
|
|
3
|
-
from magic_hour.
|
|
4
|
+
from magic_hour.helpers.logger import get_sdk_logger
|
|
5
|
+
from magic_hour.resources.v1.files.client import AsyncFilesClient, FilesClient
|
|
6
|
+
from magic_hour.resources.v1.video_projects.client import (
|
|
7
|
+
AsyncVideoProjectsClient,
|
|
8
|
+
VideoProjectsClient,
|
|
9
|
+
)
|
|
10
|
+
from magic_hour.types import models, params
|
|
11
|
+
from make_api_request import (
|
|
4
12
|
AsyncBaseClient,
|
|
5
13
|
RequestOptions,
|
|
6
14
|
SyncBaseClient,
|
|
@@ -8,43 +16,163 @@ from magic_hour.core import (
|
|
|
8
16
|
to_encodable,
|
|
9
17
|
type_utils,
|
|
10
18
|
)
|
|
11
|
-
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
logger = get_sdk_logger(__name__)
|
|
12
22
|
|
|
13
23
|
|
|
14
24
|
class ImageToVideoClient:
|
|
15
25
|
def __init__(self, *, base_client: SyncBaseClient):
|
|
16
26
|
self._base_client = base_client
|
|
17
27
|
|
|
28
|
+
def generate(
|
|
29
|
+
self,
|
|
30
|
+
*,
|
|
31
|
+
assets: params.V1ImageToVideoGenerateBodyAssets,
|
|
32
|
+
end_seconds: float,
|
|
33
|
+
height: typing.Union[
|
|
34
|
+
typing.Optional[int], type_utils.NotGiven
|
|
35
|
+
] = type_utils.NOT_GIVEN,
|
|
36
|
+
name: typing.Union[
|
|
37
|
+
typing.Optional[str], type_utils.NotGiven
|
|
38
|
+
] = type_utils.NOT_GIVEN,
|
|
39
|
+
resolution: typing.Union[
|
|
40
|
+
typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]],
|
|
41
|
+
type_utils.NotGiven,
|
|
42
|
+
] = type_utils.NOT_GIVEN,
|
|
43
|
+
style: typing.Union[
|
|
44
|
+
typing.Optional[params.V1ImageToVideoCreateBodyStyle], type_utils.NotGiven
|
|
45
|
+
] = type_utils.NOT_GIVEN,
|
|
46
|
+
width: typing.Union[
|
|
47
|
+
typing.Optional[int], type_utils.NotGiven
|
|
48
|
+
] = type_utils.NOT_GIVEN,
|
|
49
|
+
wait_for_completion: bool = True,
|
|
50
|
+
download_outputs: bool = True,
|
|
51
|
+
download_directory: typing.Optional[str] = None,
|
|
52
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
53
|
+
):
|
|
54
|
+
"""
|
|
55
|
+
Generate image-to-video (alias for create with additional functionality).
|
|
56
|
+
|
|
57
|
+
Create a Image To Video video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
height: `height` is deprecated and no longer influences the output video's resolution.
|
|
61
|
+
name: The name of video. This value is mainly used for your own identification of the video.
|
|
62
|
+
resolution: Controls the output video resolution. Defaults to `720p` if not specified.
|
|
63
|
+
style: Attributed used to dictate the style of the output
|
|
64
|
+
width: `width` is deprecated and no longer influences the output video's resolution.
|
|
65
|
+
assets: Provide the assets for image-to-video.
|
|
66
|
+
end_seconds: The total duration of the output video in seconds.
|
|
67
|
+
wait_for_completion: Whether to wait for the video project to complete
|
|
68
|
+
download_outputs: Whether to download the outputs
|
|
69
|
+
download_directory: The directory to download the outputs to. If not provided, the outputs will be downloaded to the current working directory
|
|
70
|
+
request_options: Additional options to customize the HTTP request
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
V1VideoProjectsGetResponseWithDownloads: The response from the Image-to-Video API with the downloaded paths if `download_outputs` is True.
|
|
74
|
+
|
|
75
|
+
Examples:
|
|
76
|
+
```py
|
|
77
|
+
response = client.v1.image_to_video.generate(
|
|
78
|
+
assets={"image_file_path": "path/to/image.png"},
|
|
79
|
+
end_seconds=5.0,
|
|
80
|
+
resolution="720p",
|
|
81
|
+
wait_for_completion=True,
|
|
82
|
+
download_outputs=True,
|
|
83
|
+
download_directory="outputs/",
|
|
84
|
+
)
|
|
85
|
+
```
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
file_client = FilesClient(base_client=self._base_client)
|
|
89
|
+
|
|
90
|
+
# Upload image file
|
|
91
|
+
image_file_path = assets["image_file_path"]
|
|
92
|
+
assets["image_file_path"] = file_client.upload_file(file=image_file_path)
|
|
93
|
+
|
|
94
|
+
create_response = self.create(
|
|
95
|
+
assets=assets,
|
|
96
|
+
end_seconds=end_seconds,
|
|
97
|
+
height=height,
|
|
98
|
+
name=name,
|
|
99
|
+
resolution=resolution,
|
|
100
|
+
style=style,
|
|
101
|
+
width=width,
|
|
102
|
+
request_options=request_options,
|
|
103
|
+
)
|
|
104
|
+
logger.info(f"Image-to-Video response: {create_response}")
|
|
105
|
+
|
|
106
|
+
video_projects_client = VideoProjectsClient(base_client=self._base_client)
|
|
107
|
+
response = video_projects_client.check_result(
|
|
108
|
+
id=create_response.id,
|
|
109
|
+
wait_for_completion=wait_for_completion,
|
|
110
|
+
download_outputs=download_outputs,
|
|
111
|
+
download_directory=download_directory,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
return response
|
|
115
|
+
|
|
18
116
|
def create(
|
|
19
117
|
self,
|
|
20
118
|
*,
|
|
21
|
-
assets: params.
|
|
119
|
+
assets: params.V1ImageToVideoCreateBodyAssets,
|
|
22
120
|
end_seconds: float,
|
|
23
|
-
height:
|
|
24
|
-
|
|
25
|
-
|
|
121
|
+
height: typing.Union[
|
|
122
|
+
typing.Optional[int], type_utils.NotGiven
|
|
123
|
+
] = type_utils.NOT_GIVEN,
|
|
26
124
|
name: typing.Union[
|
|
27
125
|
typing.Optional[str], type_utils.NotGiven
|
|
28
126
|
] = type_utils.NOT_GIVEN,
|
|
127
|
+
resolution: typing.Union[
|
|
128
|
+
typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]],
|
|
129
|
+
type_utils.NotGiven,
|
|
130
|
+
] = type_utils.NOT_GIVEN,
|
|
131
|
+
style: typing.Union[
|
|
132
|
+
typing.Optional[params.V1ImageToVideoCreateBodyStyle], type_utils.NotGiven
|
|
133
|
+
] = type_utils.NOT_GIVEN,
|
|
134
|
+
width: typing.Union[
|
|
135
|
+
typing.Optional[int], type_utils.NotGiven
|
|
136
|
+
] = type_utils.NOT_GIVEN,
|
|
29
137
|
request_options: typing.Optional[RequestOptions] = None,
|
|
30
|
-
) -> models.
|
|
138
|
+
) -> models.V1ImageToVideoCreateResponse:
|
|
31
139
|
"""
|
|
32
140
|
Image-to-Video
|
|
33
141
|
|
|
34
142
|
Create a Image To Video video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
|
|
35
143
|
|
|
36
|
-
Get more information about this mode at our [product page](/products/image-to-video).
|
|
144
|
+
Get more information about this mode at our [product page](https://magichour.ai/products/image-to-video).
|
|
37
145
|
|
|
38
146
|
|
|
39
147
|
POST /v1/image-to-video
|
|
40
148
|
|
|
41
149
|
Args:
|
|
42
|
-
|
|
150
|
+
height: `height` is deprecated and no longer influences the output video's resolution.
|
|
151
|
+
|
|
152
|
+
Output resolution is determined by the **minimum** of:
|
|
153
|
+
- The resolution of the input video
|
|
154
|
+
- The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
155
|
+
|
|
156
|
+
This field is retained only for backward compatibility and will be removed in a future release.
|
|
157
|
+
name: The name of video. This value is mainly used for your own identification of the video.
|
|
158
|
+
resolution: Controls the output video resolution. Defaults to `720p` if not specified.
|
|
159
|
+
|
|
160
|
+
480p and 720p are available on Creator, Pro, or Business tiers. However, 1080p require Pro or Business tier.
|
|
161
|
+
|
|
162
|
+
**Options:**
|
|
163
|
+
- `480p` - Supports only 5 or 10 second videos. Output: 24fps. Cost: 120 credits per 5 seconds.
|
|
164
|
+
- `720p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 300 credits per 5 seconds.
|
|
165
|
+
- `1080p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 600 credits per 5 seconds.
|
|
166
|
+
style: Attributed used to dictate the style of the output
|
|
167
|
+
width: `width` is deprecated and no longer influences the output video's resolution.
|
|
168
|
+
|
|
169
|
+
Output resolution is determined by the **minimum** of:
|
|
170
|
+
- The resolution of the input video
|
|
171
|
+
- The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
172
|
+
|
|
173
|
+
This field is retained only for backward compatibility and will be removed in a future release.
|
|
43
174
|
assets: Provide the assets for image-to-video.
|
|
44
175
|
end_seconds: The total duration of the output video in seconds.
|
|
45
|
-
height: The height of the input video. This value will help determine the final orientation of the output video. The output video resolution may not match the input.
|
|
46
|
-
style: PostV1ImageToVideoBodyStyle
|
|
47
|
-
width: The width of the input video. This value will help determine the final orientation of the output video. The output video resolution may not match the input.
|
|
48
176
|
request_options: Additional options to customize the HTTP request
|
|
49
177
|
|
|
50
178
|
Returns:
|
|
@@ -59,30 +187,29 @@ class ImageToVideoClient:
|
|
|
59
187
|
client.v1.image_to_video.create(
|
|
60
188
|
assets={"image_file_path": "api-assets/id/1234.png"},
|
|
61
189
|
end_seconds=5.0,
|
|
62
|
-
height=960,
|
|
63
|
-
style={"prompt": "string"},
|
|
64
|
-
width=512,
|
|
65
190
|
name="Image To Video video",
|
|
191
|
+
resolution="720p",
|
|
66
192
|
)
|
|
67
193
|
```
|
|
68
194
|
"""
|
|
69
195
|
_json = to_encodable(
|
|
70
196
|
item={
|
|
71
|
-
"name": name,
|
|
72
|
-
"assets": assets,
|
|
73
|
-
"end_seconds": end_seconds,
|
|
74
197
|
"height": height,
|
|
198
|
+
"name": name,
|
|
199
|
+
"resolution": resolution,
|
|
75
200
|
"style": style,
|
|
76
201
|
"width": width,
|
|
202
|
+
"assets": assets,
|
|
203
|
+
"end_seconds": end_seconds,
|
|
77
204
|
},
|
|
78
|
-
dump_with=params.
|
|
205
|
+
dump_with=params._SerializerV1ImageToVideoCreateBody,
|
|
79
206
|
)
|
|
80
207
|
return self._base_client.request(
|
|
81
208
|
method="POST",
|
|
82
209
|
path="/v1/image-to-video",
|
|
83
210
|
auth_names=["bearerAuth"],
|
|
84
211
|
json=_json,
|
|
85
|
-
cast_to=models.
|
|
212
|
+
cast_to=models.V1ImageToVideoCreateResponse,
|
|
86
213
|
request_options=request_options or default_request_options(),
|
|
87
214
|
)
|
|
88
215
|
|
|
@@ -91,36 +218,154 @@ class AsyncImageToVideoClient:
|
|
|
91
218
|
def __init__(self, *, base_client: AsyncBaseClient):
|
|
92
219
|
self._base_client = base_client
|
|
93
220
|
|
|
221
|
+
async def generate(
|
|
222
|
+
self,
|
|
223
|
+
*,
|
|
224
|
+
assets: params.V1ImageToVideoGenerateBodyAssets,
|
|
225
|
+
end_seconds: float,
|
|
226
|
+
height: typing.Union[
|
|
227
|
+
typing.Optional[int], type_utils.NotGiven
|
|
228
|
+
] = type_utils.NOT_GIVEN,
|
|
229
|
+
name: typing.Union[
|
|
230
|
+
typing.Optional[str], type_utils.NotGiven
|
|
231
|
+
] = type_utils.NOT_GIVEN,
|
|
232
|
+
resolution: typing.Union[
|
|
233
|
+
typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]],
|
|
234
|
+
type_utils.NotGiven,
|
|
235
|
+
] = type_utils.NOT_GIVEN,
|
|
236
|
+
style: typing.Union[
|
|
237
|
+
typing.Optional[params.V1ImageToVideoCreateBodyStyle], type_utils.NotGiven
|
|
238
|
+
] = type_utils.NOT_GIVEN,
|
|
239
|
+
width: typing.Union[
|
|
240
|
+
typing.Optional[int], type_utils.NotGiven
|
|
241
|
+
] = type_utils.NOT_GIVEN,
|
|
242
|
+
wait_for_completion: bool = True,
|
|
243
|
+
download_outputs: bool = True,
|
|
244
|
+
download_directory: typing.Optional[str] = None,
|
|
245
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
246
|
+
):
|
|
247
|
+
"""
|
|
248
|
+
Generate image-to-video (alias for create with additional functionality).
|
|
249
|
+
|
|
250
|
+
Create a Image To Video video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
|
|
251
|
+
|
|
252
|
+
Args:
|
|
253
|
+
height: `height` is deprecated and no longer influences the output video's resolution.
|
|
254
|
+
name: The name of video. This value is mainly used for your own identification of the video.
|
|
255
|
+
resolution: Controls the output video resolution. Defaults to `720p` if not specified.
|
|
256
|
+
style: Attributed used to dictate the style of the output
|
|
257
|
+
width: `width` is deprecated and no longer influences the output video's resolution.
|
|
258
|
+
assets: Provide the assets for image-to-video.
|
|
259
|
+
end_seconds: The total duration of the output video in seconds.
|
|
260
|
+
wait_for_completion: Whether to wait for the video project to complete
|
|
261
|
+
download_outputs: Whether to download the outputs
|
|
262
|
+
download_directory: The directory to download the outputs to. If not provided, the outputs will be downloaded to the current working directory
|
|
263
|
+
request_options: Additional options to customize the HTTP request
|
|
264
|
+
|
|
265
|
+
Returns:
|
|
266
|
+
V1VideoProjectsGetResponseWithDownloads: The response from the Image-to-Video API with the downloaded paths if `download_outputs` is True.
|
|
267
|
+
|
|
268
|
+
Examples:
|
|
269
|
+
```py
|
|
270
|
+
response = await client.v1.image_to_video.generate(
|
|
271
|
+
assets={"image_file_path": "path/to/image.png"},
|
|
272
|
+
end_seconds=5.0,
|
|
273
|
+
resolution="720p",
|
|
274
|
+
wait_for_completion=True,
|
|
275
|
+
download_outputs=True,
|
|
276
|
+
download_directory="outputs/",
|
|
277
|
+
)
|
|
278
|
+
```
|
|
279
|
+
"""
|
|
280
|
+
|
|
281
|
+
file_client = AsyncFilesClient(base_client=self._base_client)
|
|
282
|
+
|
|
283
|
+
# Upload image file
|
|
284
|
+
image_file_path = assets["image_file_path"]
|
|
285
|
+
assets["image_file_path"] = await file_client.upload_file(file=image_file_path)
|
|
286
|
+
|
|
287
|
+
create_response = await self.create(
|
|
288
|
+
assets=assets,
|
|
289
|
+
end_seconds=end_seconds,
|
|
290
|
+
height=height,
|
|
291
|
+
name=name,
|
|
292
|
+
resolution=resolution,
|
|
293
|
+
style=style,
|
|
294
|
+
width=width,
|
|
295
|
+
request_options=request_options,
|
|
296
|
+
)
|
|
297
|
+
logger.info(f"Image-to-Video response: {create_response}")
|
|
298
|
+
|
|
299
|
+
video_projects_client = AsyncVideoProjectsClient(base_client=self._base_client)
|
|
300
|
+
response = await video_projects_client.check_result(
|
|
301
|
+
id=create_response.id,
|
|
302
|
+
wait_for_completion=wait_for_completion,
|
|
303
|
+
download_outputs=download_outputs,
|
|
304
|
+
download_directory=download_directory,
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
return response
|
|
308
|
+
|
|
94
309
|
async def create(
|
|
95
310
|
self,
|
|
96
311
|
*,
|
|
97
|
-
assets: params.
|
|
312
|
+
assets: params.V1ImageToVideoCreateBodyAssets,
|
|
98
313
|
end_seconds: float,
|
|
99
|
-
height:
|
|
100
|
-
|
|
101
|
-
|
|
314
|
+
height: typing.Union[
|
|
315
|
+
typing.Optional[int], type_utils.NotGiven
|
|
316
|
+
] = type_utils.NOT_GIVEN,
|
|
102
317
|
name: typing.Union[
|
|
103
318
|
typing.Optional[str], type_utils.NotGiven
|
|
104
319
|
] = type_utils.NOT_GIVEN,
|
|
320
|
+
resolution: typing.Union[
|
|
321
|
+
typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]],
|
|
322
|
+
type_utils.NotGiven,
|
|
323
|
+
] = type_utils.NOT_GIVEN,
|
|
324
|
+
style: typing.Union[
|
|
325
|
+
typing.Optional[params.V1ImageToVideoCreateBodyStyle], type_utils.NotGiven
|
|
326
|
+
] = type_utils.NOT_GIVEN,
|
|
327
|
+
width: typing.Union[
|
|
328
|
+
typing.Optional[int], type_utils.NotGiven
|
|
329
|
+
] = type_utils.NOT_GIVEN,
|
|
105
330
|
request_options: typing.Optional[RequestOptions] = None,
|
|
106
|
-
) -> models.
|
|
331
|
+
) -> models.V1ImageToVideoCreateResponse:
|
|
107
332
|
"""
|
|
108
333
|
Image-to-Video
|
|
109
334
|
|
|
110
335
|
Create a Image To Video video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
|
|
111
336
|
|
|
112
|
-
Get more information about this mode at our [product page](/products/image-to-video).
|
|
337
|
+
Get more information about this mode at our [product page](https://magichour.ai/products/image-to-video).
|
|
113
338
|
|
|
114
339
|
|
|
115
340
|
POST /v1/image-to-video
|
|
116
341
|
|
|
117
342
|
Args:
|
|
118
|
-
|
|
343
|
+
height: `height` is deprecated and no longer influences the output video's resolution.
|
|
344
|
+
|
|
345
|
+
Output resolution is determined by the **minimum** of:
|
|
346
|
+
- The resolution of the input video
|
|
347
|
+
- The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
348
|
+
|
|
349
|
+
This field is retained only for backward compatibility and will be removed in a future release.
|
|
350
|
+
name: The name of video. This value is mainly used for your own identification of the video.
|
|
351
|
+
resolution: Controls the output video resolution. Defaults to `720p` if not specified.
|
|
352
|
+
|
|
353
|
+
480p and 720p are available on Creator, Pro, or Business tiers. However, 1080p require Pro or Business tier.
|
|
354
|
+
|
|
355
|
+
**Options:**
|
|
356
|
+
- `480p` - Supports only 5 or 10 second videos. Output: 24fps. Cost: 120 credits per 5 seconds.
|
|
357
|
+
- `720p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 300 credits per 5 seconds.
|
|
358
|
+
- `1080p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 600 credits per 5 seconds.
|
|
359
|
+
style: Attributed used to dictate the style of the output
|
|
360
|
+
width: `width` is deprecated and no longer influences the output video's resolution.
|
|
361
|
+
|
|
362
|
+
Output resolution is determined by the **minimum** of:
|
|
363
|
+
- The resolution of the input video
|
|
364
|
+
- The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
365
|
+
|
|
366
|
+
This field is retained only for backward compatibility and will be removed in a future release.
|
|
119
367
|
assets: Provide the assets for image-to-video.
|
|
120
368
|
end_seconds: The total duration of the output video in seconds.
|
|
121
|
-
height: The height of the input video. This value will help determine the final orientation of the output video. The output video resolution may not match the input.
|
|
122
|
-
style: PostV1ImageToVideoBodyStyle
|
|
123
|
-
width: The width of the input video. This value will help determine the final orientation of the output video. The output video resolution may not match the input.
|
|
124
369
|
request_options: Additional options to customize the HTTP request
|
|
125
370
|
|
|
126
371
|
Returns:
|
|
@@ -135,29 +380,28 @@ class AsyncImageToVideoClient:
|
|
|
135
380
|
await client.v1.image_to_video.create(
|
|
136
381
|
assets={"image_file_path": "api-assets/id/1234.png"},
|
|
137
382
|
end_seconds=5.0,
|
|
138
|
-
height=960,
|
|
139
|
-
style={"prompt": "string"},
|
|
140
|
-
width=512,
|
|
141
383
|
name="Image To Video video",
|
|
384
|
+
resolution="720p",
|
|
142
385
|
)
|
|
143
386
|
```
|
|
144
387
|
"""
|
|
145
388
|
_json = to_encodable(
|
|
146
389
|
item={
|
|
147
|
-
"name": name,
|
|
148
|
-
"assets": assets,
|
|
149
|
-
"end_seconds": end_seconds,
|
|
150
390
|
"height": height,
|
|
391
|
+
"name": name,
|
|
392
|
+
"resolution": resolution,
|
|
151
393
|
"style": style,
|
|
152
394
|
"width": width,
|
|
395
|
+
"assets": assets,
|
|
396
|
+
"end_seconds": end_seconds,
|
|
153
397
|
},
|
|
154
|
-
dump_with=params.
|
|
398
|
+
dump_with=params._SerializerV1ImageToVideoCreateBody,
|
|
155
399
|
)
|
|
156
400
|
return await self._base_client.request(
|
|
157
401
|
method="POST",
|
|
158
402
|
path="/v1/image-to-video",
|
|
159
403
|
auth_names=["bearerAuth"],
|
|
160
404
|
json=_json,
|
|
161
|
-
cast_to=models.
|
|
405
|
+
cast_to=models.V1ImageToVideoCreateResponse,
|
|
162
406
|
request_options=request_options or default_request_options(),
|
|
163
407
|
)
|
|
@@ -1,14 +1,109 @@
|
|
|
1
|
+
# v1.lip_sync
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
## Module Functions
|
|
4
|
+
|
|
5
|
+
<!-- CUSTOM DOCS START -->
|
|
6
|
+
|
|
7
|
+
### Lip Sync Generate Workflow <a name="generate"></a>
|
|
8
|
+
|
|
9
|
+
The workflow performs the following action
|
|
10
|
+
|
|
11
|
+
1. upload local assets to Magic Hour storage. So you can pass in a local path instead of having to upload files yourself
|
|
12
|
+
2. trigger a generation
|
|
13
|
+
3. poll for a completion status. This is configurable
|
|
14
|
+
4. if success, download the output to local directory
|
|
15
|
+
|
|
16
|
+
> [!TIP]
|
|
17
|
+
> This is the recommended way to use the SDK unless you have specific needs where it is necessary to split up the actions.
|
|
18
|
+
|
|
19
|
+
#### Parameters
|
|
20
|
+
|
|
21
|
+
In Additional to the parameters listed in the `.create` section below, `.generate` introduces 3 new parameters:
|
|
22
|
+
|
|
23
|
+
- `wait_for_completion` (bool, default True): Whether to wait for the project to complete.
|
|
24
|
+
- `download_outputs` (bool, default True): Whether to download the generated files
|
|
25
|
+
- `download_directory` (str, optional): Directory to save downloaded files (defaults to current directory)
|
|
26
|
+
|
|
27
|
+
#### Synchronous Client
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from magic_hour import Client
|
|
31
|
+
from os import getenv
|
|
32
|
+
|
|
33
|
+
client = Client(token=getenv("API_TOKEN"))
|
|
34
|
+
res = client.v1.lip_sync.generate(
|
|
35
|
+
assets={
|
|
36
|
+
"audio_file_path": "/path/to/1234.mp3",
|
|
37
|
+
"video_file_path": "/path/to/1234.mp4",
|
|
38
|
+
"video_source": "file",
|
|
39
|
+
},
|
|
40
|
+
style={
|
|
41
|
+
"generation_mode": "lite",
|
|
42
|
+
},
|
|
43
|
+
end_seconds=15.0,
|
|
44
|
+
start_seconds=0.0,
|
|
45
|
+
max_fps_limit=12.0,
|
|
46
|
+
name="Lip Sync video",
|
|
47
|
+
wait_for_completion=True,
|
|
48
|
+
download_outputs=True,
|
|
49
|
+
download_directory="outputs"
|
|
50
|
+
)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### Asynchronous Client
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from magic_hour import AsyncClient
|
|
57
|
+
from os import getenv
|
|
58
|
+
|
|
59
|
+
client = AsyncClient(token=getenv("API_TOKEN"))
|
|
60
|
+
res = await client.v1.lip_sync.generate(
|
|
61
|
+
assets={
|
|
62
|
+
"audio_file_path": "/path/to/1234.mp3",
|
|
63
|
+
"video_file_path": "/path/to/1234.mp4",
|
|
64
|
+
"video_source": "file",
|
|
65
|
+
},
|
|
66
|
+
style={
|
|
67
|
+
"generation_mode": "lite",
|
|
68
|
+
},
|
|
69
|
+
end_seconds=15.0,
|
|
70
|
+
start_seconds=0.0,
|
|
71
|
+
max_fps_limit=12.0,
|
|
72
|
+
name="Lip Sync video",
|
|
73
|
+
wait_for_completion=True,
|
|
74
|
+
download_outputs=True,
|
|
75
|
+
download_directory="outputs"
|
|
76
|
+
)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
<!-- CUSTOM DOCS END -->
|
|
80
|
+
|
|
81
|
+
### Lip Sync <a name="create"></a>
|
|
4
82
|
|
|
5
83
|
Create a Lip Sync video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
|
|
6
|
-
|
|
7
|
-
Get more information about this mode at our [product page](/products/lip-sync).
|
|
8
|
-
|
|
84
|
+
|
|
85
|
+
Get more information about this mode at our [product page](https://magichour.ai/products/lip-sync).
|
|
9
86
|
|
|
10
87
|
**API Endpoint**: `POST /v1/lip-sync`
|
|
11
88
|
|
|
89
|
+
#### Parameters
|
|
90
|
+
|
|
91
|
+
| Parameter | Required | Deprecated | Description | Example |
|
|
92
|
+
| -------------------- | :------: | :--------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
|
|
93
|
+
| `assets` | ✓ | ✗ | Provide the assets for lip-sync. For video, The `video_source` field determines whether `video_file_path` or `youtube_url` field is used | `{"audio_file_path": "api-assets/id/1234.mp3", "video_file_path": "api-assets/id/1234.mp4", "video_source": "file"}` |
|
|
94
|
+
| `└─ audio_file_path` | ✓ | — | The path of the audio file. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more. | `"api-assets/id/1234.mp3"` |
|
|
95
|
+
| `└─ video_file_path` | ✗ | — | Required if `video_source` is `file`. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more. | `"api-assets/id/1234.mp4"` |
|
|
96
|
+
| `└─ video_source` | ✓ | — | | `"file"` |
|
|
97
|
+
| `└─ youtube_url` | ✗ | — | Using a youtube video as the input source. This field is required if `video_source` is `youtube` | `"http://www.example.com"` |
|
|
98
|
+
| `end_seconds` | ✓ | ✗ | The end time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.1, and more than the start_seconds. | `15.0` |
|
|
99
|
+
| `start_seconds` | ✓ | ✗ | The start time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0. | `0.0` |
|
|
100
|
+
| `height` | ✗ | ✓ | `height` is deprecated and no longer influences the output video's resolution. Output resolution is determined by the **minimum** of: - The resolution of the input video - The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details. This field is retained only for backward compatibility and will be removed in a future release. | `123` |
|
|
101
|
+
| `max_fps_limit` | ✗ | ✗ | Defines the maximum FPS (frames per second) for the output video. If the input video's FPS is lower than this limit, the output video will retain the input FPS. This is useful for reducing unnecessary frame usage in scenarios where high FPS is not required. | `12.0` |
|
|
102
|
+
| `name` | ✗ | ✗ | The name of video. This value is mainly used for your own identification of the video. | `"Lip Sync video"` |
|
|
103
|
+
| `style` | ✗ | ✗ | Attributes used to dictate the style of the output | `{"generation_mode": "lite"}` |
|
|
104
|
+
| `└─ generation_mode` | ✗ | — | A specific version of our lip sync system, optimized for different needs. * `lite` - Fast and affordable lip sync - best for simple videos. Costs 1 credit per frame of video. * `standard` - Natural, accurate lip sync - best for most creators. Costs 1 credit per frame of video. * `pro` - Premium fidelity with enhanced detail - best for professionals. Costs 2 credits per frame of video. Note: `standard` and `pro` are only available for users on Creator, Pro, and Business tiers. | `"lite"` |
|
|
105
|
+
| `width` | ✗ | ✓ | `width` is deprecated and no longer influences the output video's resolution. Output resolution is determined by the **minimum** of: - The resolution of the input video - The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details. This field is retained only for backward compatibility and will be removed in a future release. | `123` |
|
|
106
|
+
|
|
12
107
|
#### Synchronous Client
|
|
13
108
|
|
|
14
109
|
```python
|
|
@@ -23,9 +118,7 @@ res = client.v1.lip_sync.create(
|
|
|
23
118
|
"video_source": "file",
|
|
24
119
|
},
|
|
25
120
|
end_seconds=15.0,
|
|
26
|
-
height=960,
|
|
27
121
|
start_seconds=0.0,
|
|
28
|
-
width=512,
|
|
29
122
|
max_fps_limit=12.0,
|
|
30
123
|
name="Lip Sync video",
|
|
31
124
|
)
|
|
@@ -45,10 +138,20 @@ res = await client.v1.lip_sync.create(
|
|
|
45
138
|
"video_source": "file",
|
|
46
139
|
},
|
|
47
140
|
end_seconds=15.0,
|
|
48
|
-
height=960,
|
|
49
141
|
start_seconds=0.0,
|
|
50
|
-
width=512,
|
|
51
142
|
max_fps_limit=12.0,
|
|
52
143
|
name="Lip Sync video",
|
|
53
144
|
)
|
|
54
145
|
```
|
|
146
|
+
|
|
147
|
+
#### Response
|
|
148
|
+
|
|
149
|
+
##### Type
|
|
150
|
+
|
|
151
|
+
[V1LipSyncCreateResponse](/magic_hour/types/models/v1_lip_sync_create_response.py)
|
|
152
|
+
|
|
153
|
+
##### Example
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
{"credits_charged": 450, "estimated_frame_cost": 450, "id": "cuid-example"}
|
|
157
|
+
```
|