Improved matching algorithm to avoid unneccesary transcoding (thanks, Liboicl!)
Closes #124.
Merge remote-tracking branch 'pms/master'