Music Identification
On this page
이 문서는 Tencent Cloud 공식 문서 Music Identification Integration을 참고합니다.
입력 오디오 또는 영상에서 음악을 식별하고 커버곡을 인식합니다. Tencent Music의 오디오 핑거프린트 알고리즘을 기반으로 곡명, 앨범, 가수, 재생 구간을 반환합니다.
API 정보
| 항목 | 값 |
|---|---|
| 서비스 | MPS |
| API Action | ProcessMedia |
| 엔드포인트 | mps.tencentcloudapi.com |
| API 버전 | 2019-06-12 |
| 처리 방식 | 비동기 (TaskId 발급 후 결과 조회) |
인증은 모든 API가 공통으로 TC3-HMAC-SHA256(SecretId/SecretKey) 서명을 사용합니다. 서명 생성 방법은 Quick Start의 TokenHub 문서를 참고하세요.
요청 파라미터
| 파라미터 | 타입 | 필수 | 예시 | 설명 |
|---|---|---|---|---|
| InputInfo | Object | 필수 | {"Type":"URL","UrlInputInfo":{"Url":"https://example.com/audio.mp3"}} |
입력 미디어. Type은 URL 또는 COS |
| OutputStorage | Object | 필수 | {"Type":"COS","CosOutputStorage":{"Bucket":"mybucket-125xxx","Region":"ap-guangzhou"}} |
출력 저장소 |
| OutputDir | String | 선택 | /output/music/ |
출력 디렉터리 |
| AiAnalysisTask.Definition | Integer | 필수 | 21 |
음악 식별 프리셋 템플릿 ID. 고정값 21 |
| AiAnalysisTask.ExtendedParameter | String | 필수 | {"tag":{"process_type":"1102"}} |
확장 파라미터. process_type은 1102 고정 |
| TaskNotifyConfig.NotifyUrl | String | 선택 | https://example.com/callback |
태스크 완료 콜백 URL. NotifyType은 URL |
호출 예시
LANGUAGE
import json
from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile import HttpProfile
from tencentcloud.mps.v20190612 import mps_client, models
cred = credential.Credential("<SecretId>", "<SecretKey>")
http_profile = HttpProfile()
http_profile.endpoint = "mps.tencentcloudapi.com"
client = mps_client.MpsClient(cred, "ap-guangzhou", ClientProfile(httpProfile=http_profile))
params = {
"InputInfo": {
"Type": "URL",
"UrlInputInfo": {"Url": "https://example.com/audio.mp3"}
},
"OutputStorage": {
"Type": "COS",
"CosOutputStorage": {"Bucket": "mybucket-125xxx", "Region": "ap-guangzhou"}
},
"OutputDir": "/output/music/",
"AiAnalysisTask": {
"Definition": 21,
"ExtendedParameter": json.dumps({"tag": {"process_type": "1102"}})
},
"TaskNotifyConfig": {
"NotifyType": "URL",
"NotifyUrl": "https://example.com/callback"
}
}
req = models.ProcessMediaRequest()
req.from_json_string(json.dumps(params))
resp = client.ProcessMedia(req)
print(resp.to_json_string())응답 예시
결과는 완료 콜백의 AiAnalysisResultSet에서 TagTask.Output.TagSet으로 확인합니다.
LANGUAGE
{
"AiAnalysisResultSet": [
{
"TagTask": {
"Status": "SUCCESS",
"Output": {
"TagSet": [
{
"Confidence": 100,
"Tag": "An Array of Stars",
"SpecialInfo": "{\"song_mid\":\"000Quzkn4N0CBN\",\"song_id\":521340020,\"reference_start\":30,\"song_name\":\"An Array of Stars\",\"album_name\":\"An Array of Stars\",\"reference_end\":255,\"singer_name\":\"TIA RAY\",\"segment_list\":[[30,165],[180,255]],\"other_singer_list\":[{\"singer_name\":\"Jam Hsiao\"}]}"
}
]
}
},
"Type": "Tag"
}
]
}SpecialInfo 필드
| 필드 | 타입 | 설명 |
|---|---|---|
| song_name | string | 곡명 |
| album_name | string | 앨범명 |
| singer_name | string | 가수명 |
| other_singer_list | array | 관련 가수 목록 |
| reference_start | int | 곡의 대략적 시작 시점 |
| reference_end | int | 곡의 대략적 종료 시점 |
| segment_list | array | 곡이 등장하는 시간 구간 목록 |
사용 안내
TagSet이 []이면 해당 오디오 구간에서 매칭된 곡이 없다는 뜻입니다.
reference_start와 reference_end는 참고용입니다. 실제 구간은 segment_list가 기준입니다. 감지 간격은 15초라 실제 곡 길이와의 오차는 최대 15초입니다.
음악 식별은 입력 파일 길이 기준으로 과금됩니다.
