Skip to main content
POST
/
api
/
portrait
/
effects
/
hitchcock-effects
Hitchcock special effects
curl --request POST \
  --url https://www.ailabapi.com/api/portrait/effects/hitchcock-effects \
  --header 'Content-Type: multipart/form-data' \
  --header 'ailabapi-api-key: <api-key>' \
  --form version=v2 \
  --form mode=0 \
  --form long_side=960 \
  --form frame_num=90 \
  --form fps=30 \
  --form use_flow=-1 \
  --form 'speed_shift=<string>' \
  --form image_target=@example-file
{
"request_id": "",
"log_id": "",
"error_code": 0,
"error_code_str": "",
"error_msg": "",
"error_detail": {
"status_code": 200,
"code": "",
"code_message": "",
"message": ""
},
"data": {
"video": ""
}
}

Request

  • URL: https://www.ailabapi.com/api/portrait/effects/hitchcock-effects
  • Method: POST
  • Content-Type: multipart/form-data

Image requirements

  • Image format: JPEG JPG PNG BMP
  • Image size: No more than 5 MB.
  • Image resolution: Larger than 64x64px, smaller than 2048x2048px.

Headers

FieldRequiredTypeDescription
ailabapi-api-keyYESstringApplication API KEY. Get API KEY

Body

FieldRequiredTypeScopeDefaultDescription
versionYESstringv2Version.
image_targetYESfile
modeNOinteger0, 1, 2, 3, 400`: Push forward shot, default with flowing effect.`, 1: Wide-angle camera movement., 2`: Hitchcock camera movement.`, 3: Swing camera movement., “4: Bounce camera movement.
long_sideNOinteger[0, 1920]960The length of the video’s longer side for rendering. The larger the value, the longer it takes, growing exponentially in powers of two.
frame_numNOinteger90Video frame rate (without speed change). The larger the value, the longer it takes, increasing linearly.
fpsNOinteger30Video frame rate. frame_num/fps determines the video duration.
use_flowNOinteger-1, 0, 1-1-1`: The algorithm determines whether to enable the flow effect based on the `mode` value.`, 0: Forcefully disable the flow effect., “1: Forcefully enable the flow effect.
speed_shiftNOstringConstant SpeedEach pair of adjacent values represents the x and y values of a control point., x range [0, 1]: Progress from the beginning to the end of the original video., y range [0.1, 10]: Speed rate., Each pair of adjacent control points represents a speed change curve, with the curve function being a trigonometric function.

speed_shift

For example, 0,1,0.5,4,0.5,4,1,1 represents the curve in the following diagram. Video Curve Speed Variation

Response

Response Field Handling Flow
  1. Handle Public Response Fields Parse and validate the Public Response Fields, checking the status code or response message to ensure the request is successful and error-free.
  2. Handle Business Response Fields If the Public Response Fields are valid and error-free, proceed with processing the business logic in the Business Response Fields.

Public Response Fields

Viewing Public Response Fields and Error Codes

Business Response Fields

FieldTypeDescription
dataobjectThe content of the result data returned.
+videostringReturns the base64 encoded string of the generated video.

Response Example

{
  "request_id":     "",
  "log_id":         "",
  "error_code":     0,
  "error_msg":      "",
  "error_detail":   {
    "status_code":  200,
    "code":         "",
    "code_message": "",
    "message":      ""
  },
  "data":           {
    "video": ""
  }
}

Sample Code

Authorizations

ailabapi-api-key
string
header
required

API Key for authentication

Body

multipart/form-data
version
string

Version.

Example:

"v2"

image_target
file
mode
integer

Camera movement mode. <li>0: Push forward shot, default with flowing effect.</li> <li>1: Wide-angle camera movement.</li> <li>2: Hitchcock camera movement.</li> <li>3: Swing camera movement.</li> <li>4: Bounce camera movement.</li>

Example:

"0"

long_side
integer

The length of the video's longer side for rendering. The larger the value, the longer it takes, growing exponentially in powers of two.

Example:

"960"

frame_num
integer

Video frame rate (without speed change). The larger the value, the longer it takes, increasing linearly.

Example:

"90"

fps
integer

Video frame rate. frame_num/fps determines the video duration.

Example:

"30"

use_flow
number

Whether to apply the flow effect. Enabling the flow effect typically increases processing time by approximately 20% to 30%. <li>-1: The algorithm determines whether to enable the flow effect based on the mode value.</li> <li>0: Forcefully disable the flow effect.</li> <li>1: Forcefully enable the flow effect.</li>

Example:

"-1"

speed_shift
string

Video Curve Speed Variation. <li>Each pair of adjacent values represents the x and y values of a control point.</li> <li>x range [0, 1]: Progress from the beginning to the end of the original video.</li> <li>y range [0.1, 10]: Speed rate.</li> <li>Each pair of adjacent control points represents a speed change curve, with the curve function being a trigonometric function.</li>

Response

200 - application/json

Success

The response is of type object.