UsuallyYes, usually that's what is stated in the scriptures. But in certain exceptional circumstances (may be due to compassion/grace of God) even animals or beings lower than humans can also get it.
Chaturashitilakshesu Sarireshu SaririnAm |
Na Manushyam VinA Annyatra Tatva GyAnantu Labhyate ||Among the 84 lacs kinds of bodies (wombs) Tatva Gyana (Brahma Gyana-the knowledge of self that liberates) is achieved only in the human body and not in any other kinds of bodies.
Kularnava Tantram, Chapter 1, Verse 14.
So, here Lord Shiva quite clearly says that it's only in a human birth that Tattva Gyana is achieved. So, that would mean only in a human birth liberation can be achieved. That's why a human birth is such highly praised in the scriptures and it's even said that gods too long for it.
Related post: Is mukthi possible from world's other than bhuloka(ie. From swarga and naraka)