Skip to content
On this page

Video Upload Interface

1.Interface Function

This function allows users to upload data containing video files and production information by calling the upload interface of the Quick Magic motion capture service. Users need to configure relevant parameters, including the domain name, user credentials, video file path, motion capture type, and skeleton type. After a successful upload, users can verify the operation's result by checking the returned status code and message. Additionally, users can provide a callback address to receive notifications when the video production is completed.

2.Request Method

Post

3.Request URL

https://www.quickmagic.ai/business/upload/

4.Request Parameters(Request Body)

  • companyKey:Required, CompanyKey is the credentials of the business user(available on the User Information page).

  • bonetype:Required, skeleton type. Currently, only one format can be selected per API call.

      1:boyFBX format
      2:BIP format (does not support capture type value including facial capture "3")
      3:Mixamo format (does not support capture type value including facial capture "3")
      4:Unreal format (does not support capture type value including facial capture "3")
      5:VMD format
      7:girlFBX format
      8:anim format
      9:OnlyFace format (when using OnlyFace format, capture type value can only be "1,3")
    
  • capturetype:Required, motion capture type. A combination of the following values, separated by commas (e.g., "0,2,3"). Full-body/half-body/auto-detection must have exactly one value, while facial capture and hand capture can be optionally selected.

      0:Full-body 
      1:Half-body
      2:Hand capture
      3:Facial capture
      5:Auto-detection (full-body or half-body)
    
  • videoFile: Required, the file of the uploaded video. For specific restrictions on video length and size, refer to the following URL: "https://www.quickmagic.ai/consult?from=2".

  • isStaticCamera:Optional, the camera state in the uploaded video.

      1:Moving (includes movement, rotation, scaling)
    
  • poseType: Required, the type of pose in the first frame.

      1: TPose
      2: APose
      3: Origin Video
    
  • mulPersonInfo: Target frame information for multi-person videos. Not required for single-person videos; required for multi-person videos to provide target person frame info in the format "frame,x,y,w,h".

  • poseType:"Required,"the type of·pose in the·first·frame.

      1: TPose
      2: APose
      3: Origin Video
    
  • rollback_url:Optional, callback address. The caller must start a service to receive messages, with the request method as POST and parameter format as "http://127.0.0.1:12345".

5.Response Information

The server will return response data in JSON format. A successful response includes a status code, message, and data; an error response includes a status code and error information.

  • Message:Parameter validation message and success message from Quick Magic motion capture.

  • videoId:The ID of the video record returned after a successful upload. status:Status code.

  • status:Status code

      200:Succeed
      600:System errors
      500:Parameter errors
    
  • videoStatus:"Pending production" if the upload is successful; otherwise, empty.

6.Python Example Code

# encoding=utf-8
import os
import requests

# Configuration
url = "https://www.quickmagic.ai/business/upload/"
key = "f351974e-9d4e-46f1-b221-d0bf7c6d25df"
video_path = r"data\xiaoyu.mp4"
capture_type = "0"
bone_type = "1"
pose_type = "1"

# Check if video file exists
assert os.path.exists(video_path)

# Prepare data and files
files = {'videoFile': open(video_path, 'rb')}
data = {"capturetype": capture_type, "bonetype": bone_type, "companyKey": key, "pose_type": pose_type } 

# API endpoint URL
url = f"{url}"
print(url)
print(data)

# Make API request
response = requests.post(url, data=data, files=files)

# Check response status
if response.status_code == 200:
    print(response.text)
else:
    print(f"{response.status_code}, Failed to access link")

7.Callback Address Response Information

  • message:Processing information.

  • videoId: The ID of the uploaded video.

  • status:Interface call status

      200:Succeed
      600:System errors
      500:Parameter errors
    
  • videoStatus: Video production status (Pending, In production, Production completed, Production failed).

8.Python Example Code with Callback

# encoding=utf-8
import os
import requests

# Configuration
url = "https://www.quickmagic.ai/business/upload/"
key = "f351974e-9d4e-46f1-b221-d0bf7c6d25df"
video_path = r"data\xiaoyu.mp4"
capture_type = "0"
bone_type = "1"
pose_type = "1"
rollback_url = "http://68.183.225.102:80"

# Check if video file exists
assert os.path.exists(video_path)

# Prepare data and files
files = {'videoFile': open(video_path, 'rb')}
data = {
    "capturetype": capture_type,
    "bonetype": bone_type,
    "companyKey": key,
    "rollbackUrl": rollback_url
    "pose_type": pose_type.
}

# API endpoint URL
url = f"{url}"
print(url)
print(data)

# Make API request
response = requests.post(url, data=data, files=files)

# Check response status
if response.status_code == 200:
    print(response.text)
else:
    print("Failed to access link")

9.Example Code for Starting Callback Service

import datetime

import sanic
from sanic import Sanic
from sanic.response import json

app = Sanic("test")


@app.route('/', methods=['POST'])
async def test(request: sanic.Request):
    now_time = datetime.datetime.now()
    print(f"Hello, {now_time}")
    print(request.json)
    return json({'hello': 'world'})


if __name__ == '__main__':
    app.run(host="68.183.225.102", port=12345)

    # test
    # curl -X POST -H "Content-Type: application/json" -d '{"x":"1"}' -v http://68.183.225.102:80