title: "TypeError: byte indices must be integers or slices, not str" Converting bytes to ints
body: <p>I am using a different program (ffmpeg) to grab the length of a youtube video that was downloaded in order to randomize a specific point in the video. However I am getting this error when I am trying to execute this code: </p>
  
  <pre><code>def grabTimeOfDownloadedYoutubeVideo(youtubeVideo):
      process = subprocess.Popen(['/usr/local/bin/ffmpeg', '-i', youtubeVideo], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
      stdout, stderr = process.communicate()
      matches = str(re.search(b"Duration:\s{1}(?P&lt;hours&gt;\d+?):(?P&lt;minutes&gt;\d+?):(?P&lt;seconds&gt;\d+\.\d+?),", stdout, re.DOTALL).groupdict()).encode()
      print(matches)
      hours = int(matches['hours'])
      minutes = int(matches['minutes'])
      seconds = int(matches['seconds'])
      total = 0
      total += 60 * 60 * hours
      total += 60 * minutes
      total += seconds
      print(total)
  </code></pre>
  
  <p>The matches variable prints out to this:</p>
  
  <pre><code>b"{'minutes': b'04', 'hours': b'00', 'seconds': b'24.94'}"
  </code></pre>
  
  <p>So all of the output comes out with a 'b' at the beginning of it. How do I remove the 'b' and just get the number?</p>
  
  <p>Full error message here:</p>
  
  <pre><code>Traceback (most recent call last):
    File "bot.py", line 87, in &lt;module&gt;
      grabTimeOfDownloadedYoutubeVideo("videos/1.mp4")
    File "bot.py", line 77, in grabTimeOfDownloadedYoutubeVideo
      hours = int(matches['hours'])
  TypeError: byte indices must be integers or slices, not str
  </code></pre>