API Media — Chuyển MP4 sang MP3 & tạo phụ đề SRT
API Media của revidapi.com gộp hai workflow phổ biến trong một sản phẩm: chuyển video/audio sang MP3 và transcribe video thành SRT (phụ đề có timestamp). Chỉ cần gửi media_url — phù hợp vietsub, podcast, automation n8n.
Xem thêm danh mục API Key, Media Automation và API Download đa nền tảng để lấy file video trước khi xử lý.
Tại sao chọn revidapi.com Media API?
- Hai tác vụ trong một SP: MP4 → MP3 hoặc MP4 → SRT (transcribe)
- Giá cố định: 25 credit / request mỗi endpoint
- Webhook + job_id: Xử lý async, poll status khi cần
- Đầu ra linh hoạt: MP3 với bitrate tùy chọn; SRT, text, segments
- Tích hợp n8n: JSON REST, header
x-api-key - Free 100 credit khi đăng ký
Hai endpoint chính
| Tác vụ | Method | Endpoint |
|---|---|---|
| MP4/video → MP3 | POST | https://api.revidapi.com/paid/media/convert/mp3 |
| MP4/video → SRT (transcribe) | POST | https://api.revidapi.com/paid/media/transcribe/srt |
| Kiểm tra job | POST | https://api.revidapi.com/paid/get/job/status |
Tài liệu: Convert to MP3 · Media Transcribe
Giá & credit
- 25 credit / request — áp dụng cho cả convert MP3 và transcribe SRT
- Giá cố định, không tính theo phút hay dung lượng file
- Đăng ký mới: 100 credit miễn phí
1. Chuyển MP4 sang MP3
| Tham số | Bắt buộc | Mô tả |
|---|---|---|
media_url |
Có | URL file video/audio cần convert |
bitrate |
Không | Bitrate MP3, vd: 128k, 192k (mặc định 128k) |
webhook_url |
Không | URL nhận kết quả khi xong |
id |
Không | ID tracking request |
Ví dụ — MP4 to MP3 (cURL)
curl -X POST https://api.revidapi.com/paid/media/convert/mp3
-H "x-api-key: YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{
"media_url": "https://example.com/video.mp4",
"bitrate": "192k",
"webhook_url": "https://example.com/webhook",
"id": "mp4-to-mp3-001"
}'
Response — MP3
{
"code": 200,
"id": "mp4-to-mp3-001",
"job_id": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6",
"response": "https://cloud-storage.example.com/converted-file.mp3",
"message": "success"
}
2. Chuyển MP4 sang SRT (Transcribe)
| Tham số | Bắt buộc | Mô tả |
|---|---|---|
media_url |
Có | URL file video/audio |
task |
Không | transcribe hoặc translate (mặc định transcribe) |
include_srt |
Không | true để nhận file SRT |
include_text |
Không | Text thuần (mặc định true) |
include_segments |
Không | Segments có timestamp |
response_type |
Không | direct hoặc cloud |
max_words_per_line |
Không | Giới hạn từ mỗi dòng SRT |
webhook_url |
Không | URL callback async |
id |
Không | ID tracking job |
Ví dụ — MP4 to SRT (cURL)
curl -X POST https://api.revidapi.com/paid/media/transcribe/srt
-H "x-api-key: YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{
"media_url": "https://example.com/video.mp4",
"task": "transcribe",
"include_text": true,
"include_srt": true,
"include_segments": true,
"response_type": "cloud",
"max_words_per_line": 5,
"webhook_url": "https://example.com/webhook",
"id": "mp4-to-srt-001"
}'
Response — Transcribe (webhook)
{
"code": 200,
"id": "mp4-to-srt-001",
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"response": {
"text_url": "https://storage.example.com/text.txt",
"srt_url": "https://storage.example.com/subtitles.srt",
"segments_url": "https://storage.example.com/segments.json"
},
"message": "success"
}
Kiểm tra trạng thái job
curl -X POST https://api.revidapi.com/paid/get/job/status
-H "x-api-key: YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{"job_id": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6"}'
Workflow gợi ý
- Podcast / audio: Download video → Convert MP3 → upload CDN
- Vietsub: Download video → Transcribe SRT → chỉnh phụ đề → burn caption
- Dịch video: Transcribe → dịch text → TTS → ghép lại (Separate Voice)
- n8n: Chain Download → Convert hoặc Transcribe → webhook lưu file
Lưu ý quan trọng
media_urlphải public hoặc server revidapi.com truy cập được- Transcribe có webhook: API trả
202+job_id, kết quả gửi vềwebhook_url bitrateMP3 theo format128k,192k…- Dùng
response_type: cloudcho file SRT/text lớn
Câu hỏi thường gặp (FAQ)
MP4 sang MP3 và MP4 sang SRT tốn bao nhiêu credit?
Mỗi request 25 credit — một lần convert MP3 hoặc một lần transcribe SRT. Chi tiết: docs convert MP3, docs transcribe.
Làm sao nhận file MP3 sau khi convert?
Response trả response là URL file MP3, hoặc gửi qua webhook_url. Có thể poll POST /paid/get/job/status bằng job_id.
Làm sao lấy file SRT từ video?
Gọi POST /paid/media/transcribe/srt với include_srt: true. Kết quả trong response.srt (direct) hoặc response.srt_url (cloud).
Có transcribe sang ngôn ngữ khác không?
Có. Đặt task: "translate" và tùy chọn language theo tài liệu API.
Tích hợp n8n thế nào?
Hai node HTTP Request: một cho /paid/media/convert/mp3, một cho /paid/media/transcribe/srt. Dùng Webhook node nhận callback hoặc loop job status.
Bắt đầu ngay
Nhấn Thử Ngay để lấy API Key. Khám phá Media Automation trên revidapi.com.
revidapi.com — Hệ sinh thái AI & API automation cho thị trường Việt Nam.
