I agree,God even gave him another chance to do it right.<quoted text>
And thus the answer could very well be simply that God told him how and what to sacrifice. That God gave instructions and talked to them is apparent by the account itself where Cain receives counsel. Cain showed no surprise in being talked to by God.
So the Lord said to Cain,Why are you angry? And why has your countenance fallen? 7 If you do well, will you not be accepted? And if you do not do well, sin lies at the door. And its desire is for you, but you should rule over it.