transcribe rejects public YouTube URLs even though the Gemini API supports them
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start with internal/cli/custom/media.go for input policy and URL classification, then internal/cli/custom/transcribe.go for model routing, prompts, and artifact rendering. Review the existing transcription behavior and related issue #144 before tracing how video inputs and output formats are handled. Done means public YouTube URLs work across the requested formats, existing audio behavior remains intact, and the listed regression cases and help documentation are covered.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
I expected gemini-api transcribe to accept a public YouTube URL and transcribe the video's spoken audio directly. Instead, the CLI rejects the URL before making an API request and recommends downloading or uploading the media.
This is a CLI restriction, not a missing Gemini API capability. analyze -i <YouTube URL> and agent run -i <YouTube URL> already support passing the URL as a video input. The command users would naturally look for, transcribe, does not.
The CLI should make supported Gemini Developer API capabilities easy to discover and use. Direct YouTube transcription should be a first-class workflow.
Reproduction
Tested with installed gemini-api 0.4.2 and source at 3a9106d94e0522d0b5d9003b5b1c3d262e7d4692 on macOS.
gemini-api transcribe \
-i 'https://www.youtube.com/watch?v=rRJ7Jhun12I' \
--dry-run
The CLI exits with code 2:
YouTube URLs are not supported by transcribe
Download the media locally or upload it with "gemini-api files upload <path>"
Expected: accept the URL as a video input, generate a complete transcript, and support the existing Markdown, text, JSON, and SRT output formats without requiring a local download or Files API upload.
Official API support
The Gemini API video-understanding guide documents direct public YouTube inputs. With the currently supported v1beta content-array shape, the relevant input is:
{
"type": "video",
"uri": "https://www.youtube.com/watch?v=rRJ7Jhun12I"
}
This uses the Gemini Developer API at generativelanguage.googleapis.com, not Vertex AI. The guide documents public-video support and describes the feature as preview.
Live validation
I tested NASA's approximately five-minute Webb Spies Rain Clouds, New Molecule on Titan, using NASA's published reference captions for comparison. The video and reference are linked from NASA's source page.
gemini-3.8-flashtranscribed the URL directly, including the final spoken sentence, without downloading or uploading the video.- One schema-constrained JSON run returned 39 segments and 725 normalized spoken-word tokens versus 723 in the reference.
- Word error rate was 1.24%: 9 word-level insertions, deletions, or substitutions divided by 723 reference words, after lowercasing, splitting into alphanumeric tokens, and excluding caption sound-effect labels.
- All 78 aligned segment start/end boundaries fell within, or at most 1.367 seconds outside, the NASA caption cue containing the corresponding boundary word. This is a comparison with caption intervals, not a claim of word-level timing precision.
- A local prototype produced timestamped Markdown and valid SRT directly from the URL.
There is also a formatting trap: repeated free-form requests returned the transcript but omitted timestamps even though the prompt explicitly requested them. Merely allowing the URL and adding a transcription prompt is not sufficient to honor the command's default timestamp behavior.
Recommended implementation
- Remove the YouTube-specific rejection from transcription input validation. Reuse the existing URL classification and URI-backed video content handling used by
analyze. Do not add a downloader or require an upload. - Route by content type, not only MIME type. Keep
gemini-3.5-transcribefor audio. Route YouTube/video inputs to the video-capable default, currentlygemini-3.8-flash, unless a compatible model is explicitly selected. A YouTube video block has no required MIME type, so the current MIME-only fallback will miss it. Inspect the video content block itself; do not invent a MIME type to trigger routing. - Handle explicit audio-only models clearly. If a user explicitly selects
gemini-3.5-transcribefor a YouTube URL, explain that it accepts audio only and suggest omitting--modelor choosing a video-capable model. - Request structured transcript segments for every YouTube output format. Require
content, plusspeakerandstart_time/end_timewhen requested. Render Markdown, text, JSON, and SRT locally from those segments. This prevents a successful-looking Markdown file from silently dropping timestamps. Preserve--no-speakersand--no-timestampsbehavior; SRT still requires timing. - Ask for complete, verbatim speech. Explicitly prohibit summaries, paraphrases, omitted sections, and added visual descriptions; mark unclear words rather than inventing them. Preserve existing non-success/incomplete response handling.
- Make the capability visible. Mention public YouTube URLs in the root command description,
transcribe --help,--inputdescription, machine-readable usage, and README. Add runnable Markdown and SRT examples. Explain automatic model selection and that video speaker labels/timestamps are model-generated estimates. - Preserve the existing output contract. Continue writing artifacts, printing their paths by default, reporting the effective model per input in machine output, and sending
store: false.
Relevant implementation:
- Input policy, URL classification, and source resolution
- Transcription routing, prompting, and artifact rendering
Related: #144 covers the dedicated audio transcription model. Its audio behavior should be preserved while adding direct YouTube support.
Regression coverage
- Watch URLs, short
youtu.beURLs, and supported mobile/Shorts forms are sent as video URIs. - Default model selection works even when the URI has no MIME type; explicit compatible models remain honored.
- Explicit audio-only models fail before an interaction is sent.
- All four artifact formats preserve requested fields; missing requested timestamps fail without writing an incomplete artifact.
--dry-runpreviews the correct request without network calls or file writes.- Existing local-file/uploaded-file transcription and mixed-input behavior keep working.
- Help and README make the direct URL workflow discoverable.
Current workaround
gemini-api analyze \
-i 'https://www.youtube.com/watch?v=rRJ7Jhun12I' \
--api-version v1beta \
'Transcribe all spoken audio verbatim from beginning to end. Do not summarize, paraphrase, omit sections, or add visual descriptions.' \
> episode.txt
This produces text, but free-form output does not reliably honor timestamp requests. The separate version-compatibility regression is tracked in #177; --api-version v1beta is intentional here.
- Ngôn ngữ chính
- Go
- Star
- 514
- Fork
- 84
- Merge trung bình
- 1 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 69
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của google-gemini/gemini-api-cli
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
google-gemini/gemini-api-cli#231 · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs(self-hosted): E2B guide stops the worker after 5 minutes and exposes the environment keyĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
google-gemini/gemini-api-cli#227 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
google-gemini/gemini-api-cli#221 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
..Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
google-gemini/gemini-api-cli#205 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 25/100
google-gemini/gemini-api-cli#188 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của google-gemini/gemini-api-cli
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
google/osv-scanner#3327 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
tld-snapshot
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
awslabs/ferret-scan#1064 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
VictoriaMetrics/VictoriaTraces#335 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
【文档错误】创建镜像空间步骤中的截图标注与文字描述不一致Đang mởenhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
DaoCloud/DaoCloud-docs#7839 ·
Maintainer thường phản hồi trong vòng 1 ngày