Skip to content

Music Identification ​

이 문서는 Tencent Cloud 공식 문서 Music Identification Integration을 참고합니다.

입력 오디오 또는 영상에서 음악을 식별하고 커버곡을 인식합니다. Tencent Music의 오디오 핑거프린트 알고리즘을 기반으로 곡명, 앨범, 가수, 재생 구간을 반환합니다.

API 정보 ​

항목값
서비스MPS
API ActionProcessMedia
엔드포인트mps.tencentcloudapi.com
API 버전2019-06-12
처리 방식비동기 (TaskId 발급 후 결과 조회)

인증은 모든 API가 공통으로 TC3-HMAC-SHA256(SecretId/SecretKey) 서명을 사용합니다. 서명 생성 방법은 Quick Start의 TokenHub 문서를 참고하세요.

요청 파라미터 ​

파라미터타입필수예시설명
InputInfoObject필수{"Type":"URL","UrlInputInfo":{"Url":"https://example.com/audio.mp3"}}입력 미디어. Type은 URL 또는 COS
OutputStorageObject필수{"Type":"COS","CosOutputStorage":{"Bucket":"mybucket-125xxx","Region":"ap-guangzhou"}}출력 저장소
OutputDirString선택/output/music/출력 디렉터리
AiAnalysisTask.DefinitionInteger필수21음악 식별 프리셋 템플릿 ID. 고정값 21
AiAnalysisTask.ExtendedParameterString필수{"tag":{"process_type":"1102"}}확장 파라미터. process_type은 1102 고정
TaskNotifyConfig.NotifyUrlString선택https://example.com/callback태스크 완료 콜백 URL. NotifyType은 URL

호출 예시 ​

python
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으로 확인합니다.

json
{
  "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_namestring곡명
album_namestring앨범명
singer_namestring가수명
other_singer_listarray관련 가수 목록
reference_startint곡의 대략적 시작 시점
reference_endint곡의 대략적 종료 시점
segment_listarray곡이 등장하는 시간 구간 목록

사용 안내 ​

TagSet이 ``이면 해당 오디오 구간에서 매칭된 곡이 없다는 뜻입니다.

reference_start와 reference_end는 참고용입니다. 실제 구간은 segment_list가 기준입니다. 감지 간격은 15초라 실제 곡 길이와의 오차는 최대 15초입니다.

음악 식별은 입력 파일 길이 기준으로 과금됩니다.

基于 VitePress 构建 · 部署于腾讯云 EdgeOne Pages