$resolutions = "144", "360", "480", "720", "1080", "0"

foreach ($resolution in $resolutions) {
    for($crf = 15; $crf -lt 19; $crf += 5){ 
        $con = '_'+$resolution+'_'+$crf+'.mp4'
        $output = ".\x265"+$con
        ffmpeg -ss 02:50 -i .\input.mp4 -map 0 -vf scale=-8:$resolution -c:v libx265 -preset fast -x265-params crf=$crf -strict -2 -movflags faststart -c:a libopus -ac 2 -b:a 128k -vbr on -compression_level 10 -codec:s copy -t 10 $output
        $output = ".\x264"+$con
        ffmpeg -ss 02:50 -i .\input.mp4 -map 0 -vf scale=-8:$resolution -c:v libx264 -preset fast -x264-params crf=$crf -strict -2 -movflags faststart -c:a libopus -ac 2 -b:a 128k -vbr on -compression_level 10 -codec:s copy -t 10 $output
    }
}