Given a Calabi-Yau threefold X, one can count curves on X using various approaches, for example using stable maps or ideal sheaves; for any curve class on X, this produces an infinite sequence of invariants, indexed by extra discrete data (e.g. by the domain genus of a stable map). Conjecturally, however, this sequence is determined by only a finite number of integer invariants, known as Gopakumar-Vafa invariants. In this talk, I will propose a direct definition of these invariants via sheaves of vanishing cycles, building on earlier approaches of Kiem-Li and Hosono-Saito-Takahashi. Conjecturally, these should agree with the invariants as defined by stable maps. I will also explain how to prove the conjectural correspondence for irreducible curves on local surfaces. This is joint work with Yukinobu Toda.