scripts/readme/full-2k-i2va-h3-regenerate-2k.sh
1.5 KB · 56 lines · bash Raw
1 #!/usr/bin/env bash
2 set -euo pipefail
3
4 H3_BASE_VIDEO='./i2va.mp4'
5 # Encode the local H3-Base video as a Data URL and create the regeneration task.
6 task_id=$(
7 jq -n \
8 --arg prompt "$EXPANDED_PROMPT" \
9 --rawfile base_video <(
10 printf 'data:video/mp4;base64,'
11 base64 -w0 "$H3_BASE_VIDEO"
12 ) \
13 '{
14 "model": "MiniMax-H3",
15 "content": [
16 {
17 "type": "text",
18 "text": $prompt
19 },
20 {
21 "type": "image_url",
22 "image_url": {
23 "url": "https://cdn.hailuoai.com/prod/hailuo_demo/testsets/H3_AA_I2VA/gallery/sr_v17_variants_seed42_43_20260724/inputs/4a3a90bf9100_KDmcbkhzYo5sjjxr9FqcVmWVnzb.png"
24 },
25 "role": "first_frame"
26 },
27 {
28 "type": "video_url",
29 "video_url": {
30 "url": $base_video
31 },
32 "role": "base_video"
33 }
34 ],
35 "resolution": "2K"
36 }' |
37 curl --silent --show-error \
38 --request POST \
39 --url "$MINIMAX_API_BASE/v2/video_regeneration" \
40 --header "Authorization: Bearer $TOKEN" \
41 --header 'Content-Type: application/json' \
42 --data-binary @- |
43 jq -er '.task_id'
44 )
45 # Query again while the task is queued or running.
46 regeneration_result=$(
47 curl --silent --show-error \
48 --request GET \
49 --url "$MINIMAX_API_BASE/v2/query/video_generation/$task_id" \
50 --header "Authorization: Bearer $TOKEN"
51 )
52 echo "$regeneration_result" | jq '{status: .task.status}'
53 # Download the 2K MP4 after the task succeeds.
54 video_url=$(echo "$regeneration_result" | jq -er '.task.content.url')
55 curl --location "$video_url" --output i2va_2k.mp4
56