These are complements of sense verbs (the first case discussed in this answer) and have a number of peculiarities. Of particular interest is the fact that the non-volitional sense verbs can take all four varieties of complement. Which includes gerund and infinitive complements, like these.
The difference between infinitive and gerund complements, "roughly speaking", according to McCawley, is that gerunds correspond to events, while infinitives correspond to situation types.
There is minimal or no difference between the meanings of
- He saw me talking to her.
- He saw me talk to her.
because of facts about vision and conversation, and the usages of complements.
- He saw me talking to her means he witnessed my conversational activity with her.
- He saw me talk to her means he knows that I talked to her because he witnessed the event.
In other words, if he saw one, he saw the other. This is not necessarily true for all predicates;
i.e, He saw me running the marathon does not necessarily mean He saw me run the marathon.