title: Downloading youtube mp3 - metadata encoding issue (python, youtube-dl, ffmpeg)
body: <p>I'm trying to download audio from youtube with youtube-dl.exe and ffmpeg.exe (Windows 7), but I am having some troubles with encoding. I have to parse metadata manually, because when I try to use</p>
  <pre><code>--metadata-from-title &quot;%(artist) - %(title)&quot; --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=DaU94Ld3fuM
  </code></pre>
  <p>I get ERROR: Could not interpret title of video as &quot;%(artist) - %(title)&quot;</p>
  <p>Anyway, I wrote some code to save metadata with ffmpeg:</p>
  <pre><code>def download(url, title_first=False):
      if (0 == subprocess.call('youtube-dl --extract-audio --audio-format mp3 %s' % url)):
          #saves file in current directory in format: VID_TITLE-VID_ID.mp3
          video_id = url[url.find('=')+1:] #video id from URL (after ?v=)
          for f in os.listdir('.'):
              if video_id in f:
                  filename = f
                  break
          os.rename(filename, video_id+'.mp3') #name without non-ascii chars (for tests)
          video_title = filename[: filename.find(video_id)-1]
  
          output = video_title + '.mp3'
          title, artist = '', ''
          try: #parsing the title
              x = video_title.find('-')
              artist = video_title[:x].strip()
              title = video_title[x+1:].strip()
              if (title_first): output = '%s - %s.mp3' % (title, artist)
          except:
              pass
  
          x = 'ffmpeg -i &quot;%s&quot; -metadata title=&quot;%s&quot; -metadata artist=&quot;%s&quot; -acodec copy -id3v2_version 3 -write_id3v1 1 &quot;%s&quot;' \
                          % (video_id+'.mp3', title, artist, output)
          print x
          subprocess.call(x)
  </code></pre>
  <p>The file is downloaded and then cropped to given start and duration times (the code above is a simplified version). Filename is fine, but when I open the file with AIMP3, it shows rubbish instead of non-ascii characters:</p>
  <p><img src="https://i.stack.imgur.com/t6uqP.png" alt="enter image description here" /></p>
  <p>I've tried to re-encode the final command with iso-8859-2, utf-8 and mbcs:</p>
  <pre><code>x = x.decode('cp1250').encode('iso-8859-2')
  </code></pre>
  <p>But non-ascii chars are still not readable. Passing an unicode command returns UnicodeEncodeError...</p>
  <p>Any idea how to solve this problem?</p>