Return the path to a transcoder (ffmpeg or avconv) with MP3 support.

def get_transcoder():
	"""Return the path to a transcoder (ffmpeg or avconv) with MP3 support."""

	transcoders = ['ffmpeg', 'avconv']
	transcoder_details = {}

	for transcoder in transcoders:
		command_path = shutil.which(transcoder)
		if command_path is None:
			transcoder_details[transcoder] = 'Not installed.'
			continue

		stdout = subprocess.run([command_path, '-codecs'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, universal_newlines=True).stdout
		mp3_encoding_support = ('libmp3lame' in stdout and 'disable-libmp3lame' not in stdout)
		if mp3_encoding_support:
			transcoder_details[transcoder] = "MP3 encoding support."
			break
		else:
			transcoder_details[transcoder] = "No MP3 encoding support."
	else:
		raise ValueError(
			f"ffmpeg or avconv must be in the path and support mp3 encoding."
			"\nDetails: {transcoder_details}"
		)

	return command_path