title: YouTube Live Broadcast silence detect
body: <p>I'm trying to monitor a YouTube live broadcast for silence to be able to restart ffmpeg broadcast. How would you achieve that without breaking the YouTube ToS?</p>
  
  <p>I tried with the YouTube API, but health.status is only supported for Live streams but not for broadcast.</p>
  
  <p>I came up with the idea of youtube-dl, grabing the m3u8 and the run ffmpeg with silencedetect but now I'm somehow stuck.</p>
  
  <p>Get the formats</p>
  
  <pre><code>youtube-dl --list-formats https://www.youtube.com/watch?v=BiHequcIiNw
  </code></pre>
  
  <p>Get the m3u8 manifest</p>
  
  <pre><code>youtube-dl -f 91 -g https://www.youtube.com/watch?v=BiHequcIiNw
  </code></pre>
  
  <p>Run ffprobe</p>
  
  <pre><code>ffprobe -v quiet -print_format json -show_streams https://manifest.googlevideo.com/api/manifest/hls_playlist/expire/1588936061/ei/Hem0Xp35EZLl1wLLhYaYCA/ip/2a02:1205:c6bb:4590:301f:6186:c624:f2ba/id/BiHequcIiNw.0/itag/91/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/goi/160/sgoap/gir%3Dyes%3Bitag%3D139/sgovp/gir%3Dyes%3Bitag%3D160/hls_chunk_host/r3---sn-nfpnnjvh-9and.googlevideo.com/playlist_duration/30/manifest_duration/30/vprv/1/playlist_type/DVR/initcwndbps/13630/mh/GY/mm/44/mn/sn-nfpnnjvh-9and/ms/lva/mv/m/mvi/2/pl/48/dover/11/keepalive/yes/fexp/23882513/mt/1588914375/disable_polymer/true/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,live,goi,sgoap,sgovp,playlist_duration,manifest_duration,vprv,playlist_type/sig/AOq0QJ8wRgIhALApv3H2YEE2GLTXIyRxw8Fu8espLgRThUfhi97DIS6-AiEAsT_4bwAfsihK6zsrKgaxMYTemlAr8BXnBTwuhwe3aAE%3D/lsparams/hls_chunk_host,initcwndbps,mh,mm,mn,ms,mv,mvi,pl/lsig/AG3C_xAwRQIgRG3c1ww23Jokzk6vfAfeZlhwEanWG_9GmwRip81v65cCIQDg1Y9pXWS4bUjpKpZ90c3icp4slmAzhQJPn2gqW0UOeQ%3D%3D/playlist/index.m3u8
  </code></pre>
  
  <p>But I haven't found a difference in the json if the stream is up or down. Any hint how I could monitor the m3u8 if it's up or down?</p>