Upscale and enhance video quality using AI via verging.ai.
text
/video-enhancement --video <video file or URL> [options]
OptionShortDescriptionDefault--video-vVideo file path or URL (YouTube/Bilibili)Required--start-sStart time in seconds0--end-eEnd time in secondsVideo end (max 30s)--hdHD upscaling (5 credits/sec)false (3 credits/sec)--api-key-kAPI Key$VERGING_API_KEY--output-oSave path for resultCurrent directory--download-dAuto download resultfalse
Recommended: Authorization: ApiKey <your_key>
bash
# ✅ Recommended (canonical form)
curl -H "Authorization: ApiKey vrg_sk_your_key_here" https://verging.ai/api/v1/auth/me
# ✅ Also works (Bearer with API key is supported)
curl -H "Authorization: Bearer vrg_sk_your_key_here" https://verging.ai/api/v1/auth/me
Get your API key: https://verging.ai → Login → Avatar → API Keys
bash
curl -H "Authorization: ApiKey $VERGING_API_KEY" \
https://verging.ai/api/v1/auth/me
Response: {"email":"...","name":"...","credits":100}
bash
# ⚠️ MUST use -F (multipart form-data)
curl -X POST https://verging.ai/api/v1/upload-video \
-H "Authorization: ApiKey $VERGING_API_KEY" \
-F "video_file_name=video.mp4" \
-F "job_type=video-enhance"
Response:
json
{
"code": 100000,
"result": {
"url": "https://...presigned-url...",
"public_url": "https://img.panpan8.com/video-enhance/..."
}
}
bash
curl -X PUT -T /tmp/verging-video-enhancement/trimmed.mp4 \
-H "Content-Type: video/mp4" \
"<presigned_url_from_step_2>"
bash
# ⚠️ Uses -F (form-data), NOT JSON
curl -X POST https://verging.ai/api/v1/video_enhance/create-job \
-H "Authorization: ApiKey $VERGING_API_KEY" \
-F "target_video_url=<public_url_from_step_2>" \
-F "file_name=video.mp4" \
-F "user_video_duration=30" \
-F "job_type=video-enhance" \
-F "is_hd=false"
Response: {"code":10000,"result":{"job_id":"123"},"message":{"en":"Request Success","zh":"提交任务成功"}}
bash
curl -H "Authorization: ApiKey $VERGING_API_KEY" \
"https://verging.ai/api/v1/jobs/list-jobs?job_ids=<job_id>"
Response: [{"id":123,"job_type":"video-enhance","status":"COMPLETED","progress":100,"result_url":"https://...","created_at":"...","updated_at":"..."}]
Status values: PENDING → PROCESSING → COMPLETED (or FAILED)
Parse args → extract video path/URL, options
Download remote video (if URL): yt-dlp "URL" -o /tmp/verging-video-enhancement/input.mp4
Get duration → ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 video.mp4
Trim if needed (--start/--end or duration > 30s): bash
ffmpeg -i input.mp4 -ss <start> -to <end> -c:v libx264 -c:a aac /tmp/verging-video-enhancement/trimmed.mp4
Check credits → GET /api/v1/auth/me (need duration × 3 normal or ×5 HD)
Upload video → POST /upload-video (Form Data) → PUT to presigned URL
Create job → POST /video_enhance/create-job (Form Data)
Poll status → GET /jobs/list-jobs?job_ids=X every 5 seconds until COMPLETED
Return/download result → show result_url, optionally curl download
Authorization: ApiKey <key> (recommended) — Bearer <key> also works/upload-video uses Form Data ( -F) — NOT JSON/video_enhance/create-job uses Form Data ( -F) — NOT JSON, no file upload needed/tmp/verging-video-enhancement/ModeCostNormal3 credits/secondHD5 credits/second
export VERGING_API_KEY="your_key"