I heard someone knockAfter ouvi alguém, the infinitive bater describes what you heard the person do. Bater à porta means to knock at the door; bater a porta can mean to slam the door.
PO: Ouvi alguém bater à porta e fui abrir.
EN: I heard someone knock at the door and went to open it.