Loading...
Loading...
Compare original and translation side by side
exec(open('skills/video/generate_video.py').read())
result = generate_video(
prompt="A cinematic drone shot over snowy mountains at sunrise",
model="balanced", # "budget" | "balanced" | "premium"
duration=5,
)exec(open('skills/video/generate_video.py').read())
result = generate_video(
prompt="A cinematic drone shot over snowy mountains at sunrise",
model="balanced", # "budget" | "balanced" | "premium"
duration=5,
)
`generate_video` automatically: submits → polls → fetches result → downloads mp4 to `output/videos/`.
`generate_video`会自动执行:提交任务 → 轮询状态 → 获取结果 → 将mp4文件下载至`output/videos/`目录。video_urlhttps://*.fal.media/.../*.mp4Content-Security-Policy: sandbox; default-src 'none'<video><iframe>Content-Disposition: attachment?download=1result["local_path"]output/videos/xxx.mp4generate_videooutput/videos/<filename>[video](output/videos/<filename>.mp4)send_to_telegram(file_path="output/videos/...", message_type="video")send_to_wechat(file_path="output/videos/...", message_type="video")local_pathcurl -L -o output/videos/<filename>.mp4 "<video_url>"video_urlhttps://*.fal.media/.../*.mp4Content-Security-Policy: sandbox; default-src 'none'<video><iframe>Content-Disposition: attachment?download=1result["local_path"]output/videos/xxx.mp4generate_videooutput/videos/<filename>[video](output/videos/<filename>.mp4)send_to_telegram(file_path="output/videos/...", message_type="video")send_to_wechat(file_path="output/videos/...", message_type="video")local_pathcurl -L -o output/videos/<filename>.mp4 "<video_url>"output/fal_assets/publish_asset.pyfal-assets<preview_base>/<filename>generate_video(... image_url=public_url)undefinedpublish_asset.pyoutput/fal_assets/fal-assets<preview_base>/<filename>generate_video(... image_url=public_url)undefined
`generate_video` auto-rewrites the model path from `*/text-to-video` to `*/image-to-video` whenever `image_url` is provided. The same approach works for video-to-video models — pass an mp4 URL instead.
当提供`image_url`时,`generate_video`会自动将模型路径从`*/text-to-video`重写为`*/image-to-video`。相同方法适用于视频转视频模型——只需传入mp4 URL即可。publish_asset.pypublish_asset.py.jpg .jpeg .png .webp .gif .bmp.mp4 .mov .webm .mkv .m4v.jpg .jpeg .png .webp .gif .bmp.mp4 .mov .webm .mkv .m4vfal-assetsfal-assetsundefinedundefined
After publish, the public base URL is reusable for every future image-to-video / video-to-video task. Files dropped into `output/fal_assets/` become reachable as `<base>/<filename>` immediately — no re-publish needed.
Verify with:
```bash
curl -sI https://community.iamstarchild.com/<user_slug>-fal-assets/<filename>
发布后,公开基础URL可重复用于未来所有图像转视频/视频转视频任务。放入`output/fal_assets/`的文件会立即变为`<base>/<filename>`可访问状态——无需重新发布。
验证方法:
```bash
curl -sI https://community.iamstarchild.com/<user_slug>-fal-assets/<filename>
If `preview(action='serve')` returns `No available ports in pool`, ask the user which existing preview can be stopped to free a port — never silently kill one.
---
如果`preview(action='serve')`返回`No available ports in pool`,请询问用户可以停止哪个现有预览以释放端口——切勿静默终止任何预览。
---| Tier | Model | Cost / 5s | Notes |
|---|---|---|---|
| budget | | $0.25 | Fastest, cheapest; good for prompt iteration |
| balanced | | $0.70 | Default; best lip-sync, most use cases |
| premium | | $1.20 | Best motion + camera direction |
generate_video(model=...)text-to-videoimage-to-videogenerate_video.py::estimate_cost| 层级 | 模型 | 每5秒成本 | 说明 |
|---|---|---|---|
| budget | | $0.25 | 速度最快、成本最低;适合提示词迭代 |
| balanced | | $0.70 | 默认模型;唇形同步效果最佳,适用于大多数场景 |
| premium | | $1.20 | 运动效果与镜头调度最佳 |
generate_video(model=...)text-to-videoimage-to-videogenerate_video.py::estimate_costexec(open('skills/video/poll_status.py').read())
result = poll_video("019ded6c-d871-7290-bbf1-ddc6993f8958")generate_videorequest_idexec(open('skills/video/poll_status.py').read())
result = poll_video("019ded6c-d871-7290-bbf1-ddc6993f8958")generate_videorequest_idgenerate_video.pypublish_asset.pyoutput/fal_assets/fal-assetspoll_status.pyrequest_idgenerate_video.pypublish_asset.pyoutput/fal_assets/fal-assetspoll_status.pyrequest_id| Problem | Fix |
|---|---|
| Use |
| Ask the user which preview to stop; do not auto-kill |
| Reference asset host failed mid-render — re-encode/resize to 16:9, re-publish, retry |
| Top up balance; cost is pre-charged on submit |
| sc-proxy only allows approved fal video endpoints; pick one from the model table |
Generation | Shorten prompt, drop unusual tokens, retry once before changing model |
Job stuck | Save |
| User reports the fal.media link "shows nothing" / "blank page" | Expected — fal serves with |
| 问题 | 解决方法 |
|---|---|
| 使用 |
| 询问用户停止哪个预览;请勿自动终止 |
| 参考资产主机在渲染中途故障——重新编码/调整为16:9比例,重新发布后重试 |
| 充值余额;提交任务时会预先扣费 |
| sc-proxy仅允许已批准的fal视频端点;从模型表中选择一个 |
上游生成 | 缩短提示词,移除特殊令牌,更换模型前重试一次 |
任务卡在 | 保存 |
| 用户反馈fal.media链接“显示空白”/“空白页面” | 此为预期情况——fal采用 |
sc-proxyqueue.fal.runapi.fal.aiAuthorization: Key fake-falai-key-12345FAL_KEY403 endpoint_not_allowedhttps://*.fal.media/...sc-proxyqueue.fal.runapi.fal.aiAuthorization: Key fake-falai-key-12345FAL_KEY403 endpoint_not_allowedhttps://*.fal.media/...generate_video.py::estimate_costtransparent-proxy/apis/falai.py::_VIDEO_PRICINGFAL_KEYgenerate_video.py::estimate_costtransparent-proxy/apis/falai.py::_VIDEO_PRICINGFAL_KEY