Smart Crop Vertical

SMART_CROP_VERTICAL

Turns a landscape clip into a 9:16 vertical clip whose window follows the largest face.

Video Editingreframevertical-videoface-trackingmit
Smart Crop Vertical: Video Editing model on Kainguru

About Smart Crop Vertical

Turns a landscape clip into a 9:16 vertical clip that follows the largest face. Each output frame is the full height of the input. The window width is that height times 9/16, and it never extends past the frame. The window moves toward the face a little on each frame.

Weights

The detector is YuNet, file face_detection_yunet_2023mar.onnx (232,589 bytes), from the OpenCV Zoo at commit f12e12798e8314f7c074a6656816c048dcc95b7a.

Model card:

https://github.com/opencv/opencv_zoo/blob/f12e12798e8314f7c074a6656816c048dcc95b7a/models/face_detection_yunet/README.md

That card states: "All files in this directory are licensed under MIT License." YuNet was trained by Shiqi Yu in libfacedetection (https://github.com/ShiqiYu/libfacedetection). The OpenCV Zoo repository root is Apache-2.0. The weights directory carries the MIT licence named on the card, and that is the licence for this file.

The file is public. An anonymous request for the bytes returns HTTP 200.

Limits

The request is rejected when the file is over 50 MB, when it is not an MP4, MOV or WebM, when either side is over 1920 pixels, when the clip is over 60 seconds or 1800 frames, when the frame rate cannot be read, or when smoothing or fallback is outside the bounds above.

Faces are located on a copy whose longest side is at most 1280 pixels, and the centre is mapped back to the original. The largest face on that copy is the one that is followed. Profile faces, covered faces, drawings and non-human faces are outside what this detector is for. When a frame has no face, the window moves toward the frame centre, or stays on the last face position when fallback is last.

The clip has no audio in the output. The model runs on CPU.

Smart Crop Vertical inputs and output

NameTypeRequiredDefaultDetails
videofileYes—Landscape clip to crop. MP4, MOV or WebM, at most 50 MB, 60 seconds, 1800 frames and 1920 pixels on a side.
video/mp4
smoothingnumberNo0.9How slowly the crop window follows the face. 0 snaps to the face. 0.99 lags.
0–0.99
fallbacktextNocenterWhere to crop when no face is found: the frame centre, or the last face position.
Allowed: center, last

Output. Returns binary file.

Run Smart Crop Vertical with the API

Send your API key in the X-API-Key header. The run is asynchronous: submit it, then poll it until it finishes. Create an API key.

cURL
curl -X POST "https://api.kainguru.com/api/v1/executions?mlFlowId=SMART_CROP_VERTICAL" \
  -H "X-API-Key: kg_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "video": "https://example.com/input.png",
    "fallback": "center",
    "smoothing": 0.9
  },
  "outputFormat": "json"
}'

# Poll until the execution reaches a terminal state
curl "https://api.kainguru.com/api/v1/executions/{executionId}" \
  -H "X-API-Key: kg_your_api_key"
Python
from kainguru import KainguruClient

with KainguruClient(api_key="kg_your_api_key", base_url="https://api.kainguru.com/api") as client:
    submitted = client.executions.execute(
        "SMART_CROP_VERTICAL",
        {
          "video": "https://example.com/input.png",
          "fallback": "center",
          "smoothing": 0.9
        },
        output_format="json",
    )
    result = client.executions.await_completion(submitted.id)
    print(result.execution.output)

Smart Crop Vertical pricing

Price per request: 2.58 credits ($0.0258). The price is shown again before every run; all prices are on the pricing page.

Licence and source

Background Matting v2: Video Editing model on Kainguru
Video Editing

Background Matting v2

Cuts a person out of video precisely, hair included, when you also give a picture of the empty background from the…

Fine-tunable
DeOldify Video: Video Editing model on Kainguru
Video Editing

DeOldify Video

Colourises black-and-white video with DeOldify's video model: plausible colour for every frame, laid over the original…

Fine-tunable
MuseTalk 1.5: Video Editing model on Kainguru
Video Editing

MuseTalk 1.5

Makes a face in a video say new words. Send a clip of one talking face and an audio file; the mouth and jaw move to…

Fine-tunable
RIFE 4.26: Video Editing model on Kainguru
Video Editing

RIFE 4.26

Raises a video's frame rate 2, 3, 4 or 8 times by predicting the frames in between, fast enough for long clips (RIFE…

Fine-tunable
STTN Subtitle Remover: Video Editing model on Kainguru
Video Editing

STTN Subtitle Remover

Removes burned-in subtitles and captions from a video: finds the text on every frame and fills it in from the rest of…

Fine-tunable
Face Anonymizer Video: Video Editing model on Kainguru
Video Editing

Face Anonymizer Video

Finds every face in a short video and covers it on each frame with a blur, pixelation or a solid box.