Advertisement
rowntreerob

yt-download , transcribe audio only

Apr 2nd, 2023
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. -- audio track download -- issue stereo default instead of MONO which precludes transcribed BOTH tracks
  2.  
  3. ads$ yt-dlp --no-playlist -f 'ba' https://www.youtube.com/watch?v=bEuIQosyQBo -o 'chd_audio_1.%(ext)s'
  4. [youtube] Extracting URL: https://www.youtube.com/watch?v=bEuIQosyQBo
  5. [youtube] bEuIQosyQBo: Downloading webpage
  6. [youtube] bEuIQosyQBo: Downloading android player API JSON
  7. [info] bEuIQosyQBo: Downloading 1 format(s): 251
  8. [dashsegments] Total fragments: 5
  9. [download] Destination: chd_audio_1.webm
  10. [download] 100% of 46.95MiB in 00:00:14 at 3.32MiB/s
  11.  
  12. -- cloud upload input for transcription --
  13. Downloads$ gsutil cp chd_audio_1.webm gs://workbox-demos-1b95f-us-notebooks
  14.  
  15. Updates are available for some Google Cloud CLI components. To install them,
  16. please run:
  17. $ gcloud components update
  18. -- transcribe the input to json out (dupped) --
  19.  
  20. curl -X POST \
  21. -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
  22. -H "Content-Type: application/json; charset=utf-8" \
  23. --data "{
  24. 'config': {
  25. 'language_code': 'en-US','encoding': 'WEBM_OPUS', 'audioChannelCount':2, 'enableSeparateRecognitionPerChannel': true
  26. },
  27. 'audio':{
  28. 'uri':''
  29. }
  30. }" "https://speech.googleapis.com/v1/speech:longrunningrecognize"
  31.  
  32. Copying file://chd_audio_1.webm [Content-Type=video/webm]...
  33. / [1 files][ 47.0 MiB/ 47.0 MiB]
  34. Operation completed over 1 objects/47.0 MiB.
  35. $ curl -X POST -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) -H "Content-Type: application/json; charset=utf-8" --data "{
  36. 'config': {
  37. 'language_code': 'en-US','encoding': 'WEBM_OPUS', 'audioChannelCount':2, 'enableSeparateRecognitionPerChannel': true
  38. },
  39. 'audio':{
  40. 'uri':'gs://workbox-demos-1b95f-us-notebooks/chd_audio_1.webm'
  41. }
  42. }" "https://speech.googleapis.com/v1/speech:longrunningrecognize"
  43. {
  44. "name": "2765399186392764876"
  45. }
  46.  
  47. --copy the file from stdout -- dest chd_transcribed_raw_1.txt
  48.  
  49. -- sed to just json tag , awk deduped to solve the stereo issue --
  50.  
  51. sed -nr '/"transcript": "/p' chd_transcribed_raw_1.txt | awk 'NR %2 == 0' > chd_tran_raw_dedupd.txt
  52.  
  53. rm the tags w manual edit on 80 "transcript": tags in json
  54.  
  55.  
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement