Metadata phương tiện
Giá cả
25 credits cho mỗi yêu cầu
Chi phí cố định bất kể kích thước tệp phương tiện.
Endpoint này trích xuất metadata chi tiết từ tệp phương tiện (video, âm thanh, hình ảnh) bao gồm định dạng, thời lượng, thông tin codec, độ phân giải và bitrate.
Endpoint
POST https://api.revidapi.com/paid/media/metadata
Xác thực
Endpoint này yêu cầu xác thực API. Bao gồm API key của bạn trong header x-api-key.
Yêu cầu
{
"media_url": "https://example.com/media.mp4",
"webhook_url": "https://example.com/webhook", // Tùy chọn
"id": "custom-id" // Tùy chọn
}
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| media_url | string | Có | URL của tệp phương tiện cần phân tích |
| webhook_url | string | Không | URL để nhận kết quả xử lý |
| id | string | Không | Mã định danh tùy chỉnh để theo dõi yêu cầu |
Phản hồi
Thành công (200 OK)
{
"code": 200,
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"id": "custom-id",
"response": {
"filesize": 15679283,
"filesize_mb": 14.95,
"duration": 87.46,
"duration_formatted": "00:01:27.46",
"format": "mp4,mov,m4a,3gp,3g2,mj2",
"overall_bitrate": 1438692,
"overall_bitrate_mbps": 1.44,
"has_video": true,
"video_codec": "h264",
"video_codec_long": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"width": 1920,
"height": 1080,
"resolution": "1920x1080",
"fps": 30.0,
"video_bitrate": 1300000,
"video_bitrate_mbps": 1.3,
"pixel_format": "yuv420p",
"has_audio": true,
"audio_codec": "aac",
"audio_codec_long": "AAC (Advanced Audio Coding)",
"audio_channels": 2,
"audio_sample_rate": 48000,
"audio_sample_rate_khz": 48.0,
"audio_bitrate": 128000,
"audio_bitrate_kbps": 128
},
"message": "success",
"run_time": 0.542,
"queue_time": 0,
"total_time": 0.542,
"pid": 12345,
"queue_id": 67890,
"queue_length": 0,
"build_number": "123"
}
Đối với tệp chỉ có âm thanh, các trường liên quan đến video sẽ không được bao gồm. Tương tự, đối với tệp video không có âm thanh, các trường liên quan đến âm thanh sẽ không được bao gồm.
Đã đưa vào hàng đợi (202 Accepted)
{
"code": 202,
"id": "custom-id",
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"message": "processing",
"pid": 12345,
"queue_id": 67890,
"max_queue_length": "unlimited",
"queue_length": 0,
"build_number": "123"
}
Lỗi (4xx/5xx)
{
"code": 500,
"id": "custom-id",
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"message": "Error extracting metadata: [chi tiết lỗi]",
"pid": 12345,
"queue_id": 67890,
"queue_length": 0,
"build_number": "123"
}
Ví dụ
Yêu cầu
curl -X POST https://api.example.com/v1/media/metadata \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_api_key" \
-d '{
"media_url": "https://example.com/sample-video.mp4",
"webhook_url": "https://your-server.com/webhook"
}'
Phản hồi
{
"code": 200,
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"response": {
"filesize": 15679283,
"filesize_mb": 14.95,
"duration": 87.46,
"duration_formatted": "00:01:27.46",
"format": "mp4",
"overall_bitrate": 1438692,
"overall_bitrate_mbps": 1.44,
"has_video": true,
"video_codec": "h264",
"width": 1920,
"height": 1080,
"resolution": "1920x1080",
"fps": 30.0,
"video_bitrate": 1300000,
"video_bitrate_mbps": 1.3,
"has_audio": true,
"audio_codec": "aac",
"audio_channels": 2,
"audio_sample_rate": 48000,
"audio_bitrate": 128000,
"audio_bitrate_kbps": 128
},
"message": "success",
"run_time": 0.542,
"total_time": 0.542
}
Giá cả
25 credits cho mỗi yêu cầu
Chi phí cố định bất kể kích thước tệp phương tiện.
Endpoint này trích xuất metadata chi tiết từ tệp phương tiện (video, âm thanh, hình ảnh) bao gồm định dạng, thời lượng, thông tin codec, độ phân giải và bitrate.
Endpoint
POST https://api.revidapi.com/paid/media/metadata
Xác thực
Endpoint này yêu cầu xác thực API. Bao gồm API key của bạn trong header x-api-key.
Yêu cầu
{
"media_url": "https://example.com/media.mp4",
"webhook_url": "https://example.com/webhook", // Tùy chọn
"id": "custom-id" // Tùy chọn
}
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| media_url | string | Có | URL của tệp phương tiện cần phân tích |
| webhook_url | string | Không | URL để nhận kết quả xử lý |
| id | string | Không | Mã định danh tùy chỉnh để theo dõi yêu cầu |
Phản hồi
Thành công (200 OK)
{
"code": 200,
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"id": "custom-id",
"response": {
"filesize": 15679283,
"filesize_mb": 14.95,
"duration": 87.46,
"duration_formatted": "00:01:27.46",
"format": "mp4,mov,m4a,3gp,3g2,mj2",
"overall_bitrate": 1438692,
"overall_bitrate_mbps": 1.44,
"has_video": true,
"video_codec": "h264",
"video_codec_long": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"width": 1920,
"height": 1080,
"resolution": "1920x1080",
"fps": 30.0,
"video_bitrate": 1300000,
"video_bitrate_mbps": 1.3,
"pixel_format": "yuv420p",
"has_audio": true,
"audio_codec": "aac",
"audio_codec_long": "AAC (Advanced Audio Coding)",
"audio_channels": 2,
"audio_sample_rate": 48000,
"audio_sample_rate_khz": 48.0,
"audio_bitrate": 128000,
"audio_bitrate_kbps": 128
},
"message": "success",
"run_time": 0.542,
"queue_time": 0,
"total_time": 0.542,
"pid": 12345,
"queue_id": 67890,
"queue_length": 0,
"build_number": "123"
}
Đối với tệp chỉ có âm thanh, các trường liên quan đến video sẽ không được bao gồm. Tương tự, đối với tệp video không có âm thanh, các trường liên quan đến âm thanh sẽ không được bao gồm.
Đã đưa vào hàng đợi (202 Accepted)
{
"code": 202,
"id": "custom-id",
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"message": "processing",
"pid": 12345,
"queue_id": 67890,
"max_queue_length": "unlimited",
"queue_length": 0,
"build_number": "123"
}
Lỗi (4xx/5xx)
{
"code": 500,
"id": "custom-id",
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"message": "Error extracting metadata: [chi tiết lỗi]",
"pid": 12345,
"queue_id": 67890,
"queue_length": 0,
"build_number": "123"
}
Ví dụ
Yêu cầu
curl -X POST https://api.example.com/v1/media/metadata \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_api_key" \
-d '{
"media_url": "https://example.com/sample-video.mp4",
"webhook_url": "https://your-server.com/webhook"
}'
Phản hồi
{
"code": 200,
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"response": {
"filesize": 15679283,
"filesize_mb": 14.95,
"duration": 87.46,
"duration_formatted": "00:01:27.46",
"format": "mp4",
"overall_bitrate": 1438692,
"overall_bitrate_mbps": 1.44,
"has_video": true,
"video_codec": "h264",
"width": 1920,
"height": 1080,
"resolution": "1920x1080",
"fps": 30.0,
"video_bitrate": 1300000,
"video_bitrate_mbps": 1.3,
"has_audio": true,
"audio_codec": "aac",
"audio_channels": 2,
"audio_sample_rate": 48000,
"audio_bitrate": 128000,
"audio_bitrate_kbps": 128
},
"message": "success",
"run_time": 0.542,
"total_time": 0.542
}
Kiểm tra Trạng thái Công việc
Sau khi gửi một công việc, bạn có thể kiểm tra trạng thái của nó bằng cách sử dụng job_id được trả về trong phản hồi.
Endpoint
URL Path: https://api.revidapi.com/paid/get/job/status
HTTP Method: POST
Yêu cầu
Headers
x-api-key(bắt buộc): API key để xác thực.Content-Type:application/json
Tham số Body
{
"job_id": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6"
}
Ví dụ Yêu cầu
curl -X POST \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"job_id": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6"}' \
https://api.revidapi.com/paid/get/job/status
Phản hồi
Phản hồi Thành công
{
"endpoint": "/v1/toolkit/job/status",
"code": 200,
"id": null,
"job_id": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6",
"response": {
"job_status": "done",
"job_id": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6",
"queue_id": 140368864456064,
"process_id": 123456,
"response": {
"endpoint": "/v1/endpoint/name",
"code": 200,
"id": "request-123",
"job_id": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6",
"response": "https://cloud-storage.example.com/output.mp4",
"message": "success",
"pid": 123456,
"queue_id": 140368864456064,
"run_time": 2.345,
"queue_time": 0.123,
"total_time": 2.468,
"queue_length": 0,
"build_number": "1.0.0"
}
},
"message": "success",
"pid": 123456,
"queue_id": 140368864456064,
"run_time": 0.001,
"queue_time": 0.0,
"total_time": 0.001,
"queue_length": 0,
"build_number": "1.0.0"
}
Phản hồi Lỗi
- 404 Not Found: Nếu không tìm thấy công việc với
job_idđược cung cấp:
{
"error": "Job not found",
"job_id": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6"
}
- 500 Internal Server Error: Nếu xảy ra lỗi không mong muốn:
{
"error": "Failed to retrieve job status: <error_message>",
"code": 500
}