Rather than trying specific formats at first, it should try and find a codec chain using partly specified formats. This will prune many impossible paths.