import re


def _read_ssim_values(content):
    """Parse FFMpeg output to find SSIM statistics"""
    result = {}
    stats_re = re.compile(r"^\[.*\] SSIM (?P<stats>.*)$")
    for line in content.splitlines():
        match = stats_re.match(line)
        if match:
            for stat in match.group("stats").split():
                if stat.startswith('('):
                    continue
                name, value = stat.split(":", 1)
                result[name] = float(value.split()[0])
    return result