Mulai 14 September 2026, Video Intelligence API secara resmi tidak digunakan lagi dan tidak akan didukung lagi. Anda dapat terus menggunakan Video Intelligence API hingga 14 September 2027, saat API tersebut akan dihentikan. Sebaiknya bermigrasi ke Gemini Enterprise Agent Platform atau Cloud Vision API.
Google menggunakan teknologi AI untuk menerjemahkan konten ke dalam bahasa pilihan Anda. Terjemahan AI mungkin mengandung kesalahan.
Mendapatkan transkripsi trek audio
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Video Intelligence API mentranskripsikan ucapan ke teks dari file video yang didukung. Ada dua model yang didukung, yaitu "default" dan "video".
Meminta Transkripsi Ucapan untuk Video
REST
Mengirim permintaan pemrosesan
Berikut cara mengirim permintaan POST ke
metode videos:annotate.
Contoh ini menggunakan token akses untuk akun layanan yang disiapkan bagi project menggunakan Google Cloud CLI. Untuk mengetahui petunjuk cara menginstal Google Cloud CLI, menyiapkan project dengan akun layanan, serta mendapatkan token akses, lihat panduan memulai Video Intelligence.
Sebelum menggunakan salah satu data permintaan,
lakukan penggantian berikut:
INPUT_URI: bucket Cloud Storage yang berisi
file yang ingin Anda beri anotasi, termasuk nama file. Harus
diawali dengan gs://. Contoh:
"inputUri": "gs://cloud-videointelligence-demo/assistant.mp4",
Jika permintaan berhasil, Video Intelligence akan menampilkan name untuk operasi Anda. Di
atas menunjukkan contoh respons tersebut, dengan project-number
adalah nomor project Anda dan operation-id adalah ID operasi yang berjalan lama yang dibuat untuk permintaan tersebut.
Mendapatkan hasil
Untuk mendapatkan hasil permintaan, Anda harus mengirim GET, menggunakan nama operasi yang ditampilkan dari
panggilan ke videos:annotate, seperti yang ditunjukkan dalam contoh berikut.
Sebelum menggunakan salah satu data permintaan,
lakukan penggantian berikut:
OPERATION_NAME: nama operasi seperti yang ditampilkan oleh Video Intelligence API. Nama operasi memiliki format
projects/PROJECT_NUMBER/locations/LOCATION_ID/operations/OPERATION_ID
PROJECT_NUMBER: ID numerik untuk project Google Cloud Anda
Metode HTTP dan URL:
GET https://videointelligence.googleapis.com/v1/OPERATION_NAME
Untuk mengirim permintaan Anda, perluas salah satu opsi berikut:
funcspeechTranscriptionURI(wio.Writer,filestring)error{ctx:=context.Background()client,err:=video.NewClient(ctx)iferr!=nil{returnerr}deferclient.Close()op,err:=client.AnnotateVideo(ctx,&videopb.AnnotateVideoRequest{Features:[]videopb.Feature{videopb.Feature_SPEECH_TRANSCRIPTION,},VideoContext:&videopb.VideoContext{SpeechTranscriptionConfig:&videopb.SpeechTranscriptionConfig{LanguageCode:"en-US",EnableAutomaticPunctuation:true,},},InputUri:file,})iferr!=nil{returnerr}resp,err:=op.Wait(ctx)iferr!=nil{returnerr}// A single video was processed. Get the first result.result:=resp.AnnotationResults[0]for_,transcription:=rangeresult.SpeechTranscriptions{// The number of alternatives for each transcription is limited by// SpeechTranscriptionConfig.MaxAlternatives.// Each alternative is a different possible transcription// and has its own confidence score.for_,alternative:=rangetranscription.GetAlternatives(){fmt.Fprintf(w,"Alternative level information:\n")fmt.Fprintf(w,"\tTranscript: %v\n",alternative.GetTranscript())fmt.Fprintf(w,"\tConfidence: %v\n",alternative.GetConfidence())fmt.Fprintf(w,"Word level information:\n")for_,wordInfo:=rangealternative.GetWords(){startTime:=wordInfo.GetStartTime()endTime:=wordInfo.GetEndTime()fmt.Fprintf(w,"\t%4.1f - %4.1f: %v (speaker %v)\n",float64(startTime.GetSeconds())+float64(startTime.GetNanos())*1e-9,// start as secondsfloat64(endTime.GetSeconds())+float64(endTime.GetNanos())*1e-9,// end as secondswordInfo.GetWord(),wordInfo.GetSpeakerTag())}}}returnnil}
// Instantiate a com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClienttry(VideoIntelligenceServiceClientclient=VideoIntelligenceServiceClient.create()){// Set the language codeSpeechTranscriptionConfigconfig=SpeechTranscriptionConfig.newBuilder().setLanguageCode("en-US").setEnableAutomaticPunctuation(true).build();// Set the video context with the above configurationVideoContextcontext=VideoContext.newBuilder().setSpeechTranscriptionConfig(config).build();// Create the requestAnnotateVideoRequestrequest=AnnotateVideoRequest.newBuilder().setInputUri(gcsUri).addFeatures(Feature.SPEECH_TRANSCRIPTION).setVideoContext(context).build();// asynchronously perform speech transcription on videosOperationFuture<AnnotateVideoResponse,AnnotateVideoProgress>response=client.annotateVideoAsync(request);System.out.println("Waiting for operation to complete...");// Display the resultsfor(VideoAnnotationResultsresults:response.get(600,TimeUnit.SECONDS).getAnnotationResultsList()){for(SpeechTranscriptionspeechTranscription:results.getSpeechTranscriptionsList()){try{// Print the transcriptionif(speechTranscription.getAlternativesCount() > 0){SpeechRecognitionAlternativealternative=speechTranscription.getAlternatives(0);System.out.printf("Transcript: %s\n",alternative.getTranscript());System.out.printf("Confidence: %.2f\n",alternative.getConfidence());System.out.println("Word level information:");for(WordInfowordInfo:alternative.getWordsList()){doublestartTime=wordInfo.getStartTime().getSeconds()+wordInfo.getStartTime().getNanos()/1e9;doubleendTime=wordInfo.getEndTime().getSeconds()+wordInfo.getEndTime().getNanos()/1e9;System.out.printf("\t%4.2fs - %4.2fs: %s\n",startTime,endTime,wordInfo.getWord());}}else{System.out.println("No transcription found");}}catch(IndexOutOfBoundsExceptionioe){System.out.println("Could not retrieve frame: "+ioe.getMessage());}}}}
// Imports the Google Cloud Video Intelligence libraryconstvideoIntelligence=require('@google-cloud/video-intelligence');// Creates a clientconstclient=newvideoIntelligence.VideoIntelligenceServiceClient();/** * TODO(developer): Uncomment the following line before running the sample. */// const gcsUri = 'GCS URI of video to analyze, e.g. gs://my-bucket/my-video.mp4';asyncfunctionanalyzeVideoTranscript(){constvideoContext={speechTranscriptionConfig:{languageCode:'en-US',enableAutomaticPunctuation:true,},};constrequest={inputUri:gcsUri,features:['SPEECH_TRANSCRIPTION'],videoContext:videoContext,};const[operation]=awaitclient.annotateVideo(request);console.log('Waiting for operation to complete...');const[operationResult]=awaitoperation.promise();// There is only one annotation_result since only// one video is processed.constannotationResults=operationResult.annotationResults[0];for(constspeechTranscriptionofannotationResults.speechTranscriptions){// The number of alternatives for each transcription is limited by// SpeechTranscriptionConfig.max_alternatives.// Each alternative is a different possible transcription// and has its own confidence score.for(constalternativeofspeechTranscription.alternatives){console.log('Alternative level information:');console.log(`Transcript: ${alternative.transcript}`);console.log(`Confidence: ${alternative.confidence}`);console.log('Word level information:');for(constwordInfoofalternative.words){constword=wordInfo.word;conststart_time=wordInfo.startTime.seconds+wordInfo.startTime.nanos*1e-9;constend_time=wordInfo.endTime.seconds+wordInfo.endTime.nanos*1e-9;console.log('\t'+start_time+'s - '+end_time+'s: '+word);}}}}analyzeVideoTranscript();
"""Transcribe speech from a video stored on GCS."""fromgoogle.cloudimportvideointelligencevideo_client=videointelligence.VideoIntelligenceServiceClient()features=[videointelligence.Feature.SPEECH_TRANSCRIPTION]config=videointelligence.SpeechTranscriptionConfig(language_code="en-US",enable_automatic_punctuation=True)video_context=videointelligence.VideoContext(speech_transcription_config=config)operation=video_client.annotate_video(request={"features":features,"input_uri":path,"video_context":video_context,})print("\nProcessing video for speech transcription.")result=operation.result(timeout=600)# There is only one annotation_result since only# one video is processed.annotation_results=result.annotation_results[0]forspeech_transcriptioninannotation_results.speech_transcriptions:# The number of alternatives for each transcription is limited by# SpeechTranscriptionConfig.max_alternatives.# Each alternative is a different possible transcription# and has its own confidence score.foralternativeinspeech_transcription.alternatives:print("Alternative level information:")print("Transcript: {}".format(alternative.transcript))print("Confidence: {}\n".format(alternative.confidence))print("Word level information:")forword_infoinalternative.words:word=word_info.wordstart_time=word_info.start_timeend_time=word_info.end_timeprint("\t{}s - {}s: {}".format(start_time.seconds+start_time.microseconds*1e-6,end_time.seconds+end_time.microseconds*1e-6,word,))
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2026-09-18 UTC."],[],[]]