POST
/
v1
/
video-to-video
Python
from magic_hour import Client
from os import getenv

client = Client(token=getenv("API_TOKEN"))
res = client.v1.video_to_video.generate(
    assets={"video_file_path": "/path/to/1234.mp4", "video_source": "file"},
    end_seconds=15.0,
    start_seconds=0.0,
    style={
        "art_style": "3D Render",
        "model": "default",
        "prompt": "string",
        "prompt_type": "default",
        "version": "default",
    },
    fps_resolution="HALF",
    name="Video To Video video",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="outputs"
)
{
  "id": "cuid-example",
  "estimated_frame_cost": 450,
  "credits_charged": 450
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <api_key>, where <api_key> is your API key. To get your API key, go to Developer Hub and click "Create new API Key".

Body

application/json

Body

start_seconds
number
required

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.

Required range: x >= 0
Example:

0

end_seconds
number
required

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.

Required range: x >= 0.1
Example:

15

style
object
required
assets
object
required

Provide the assets for video-to-video. For video, The video_source field determines whether video_file_path or youtube_url field is used

name
string
default:Video To Video - dateTime

The name of video. This value is mainly used for your own identification of the video.

Example:

"Video To Video video"

height
integer | null
deprecated

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 for more details.

This field is retained only for backward compatibility and will be removed in a future release.

width
integer | null
deprecated

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 for more details.

This field is retained only for backward compatibility and will be removed in a future release.

fps_resolution
enum<string>
default:HALF

Determines whether the resulting video will have the same frame per second as the original video, or half.

  • FULL - the result video will have the same FPS as the input video
  • HALF - the result video will have half the FPS as the input video
Available options:
FULL,
HALF
Example:

"HALF"

Response

Success

id
string
required

Unique ID of the video. This value can be used in the get video project API to fetch additional details such as status

Example:

"cuid-example"

estimated_frame_cost
integer
required
deprecated

Deprecated: Previously represented the number of frames (original name of our credit system) used for video generation. Use 'credits_charged' instead.

The amount of frames used to generate the video. If the status is not 'complete', the cost is an estimate and will be adjusted when the video completes.

Example:

450

credits_charged
integer
required

The amount of credits deducted from your account to generate the video. If the status is not 'complete', this value is an estimate and may be adjusted upon completion based on the actual FPS of the output video.

If video generation fails, credits will be refunded, and this field will be updated to include the refund.

Example:

450