title: ffmpeg select highest quality video track and audio track in specific language from m3u8
body: <p>I have a bunch of .m3u8 files that contain video tracks in different resolutions and bitrates, and audio tracks in different laguages.
  I want to select the highest quality video stream and if available the audio track in a specified language.</p>
  
  <p>I know how to select the audio track, currently I use </p>
  
  <pre><code>-map 0:m:language:en? 
  </code></pre>
  
  <p>like this</p>
  
  <pre><code>ffmpeg -re -protocol_whitelist file,http,https,tcp,tls -i .\some_file.m3u8 -codec:a aac -c:v copy -f flv -map 0:m:language:en? rtmp://foo.com:1935/live/xyz
  </code></pre>
  
  <p>With that I only stream audio if the specified audio language is available, or audio and video in the default configuration if it's not.</p>
  
  <p>I want to stream the best video track (the one ffmpeg picks by default) in both cases.</p>