How can i use hardware accelerator Encode and Decode x.264?

Hi, I recently bought a banana pi bpi-m64 and want to use hardware accelerator encode and decode.
Install Ubuntu 16.04 with kernel version 3.10.105 on my board.
My goal is encode and decode raw data with this hardware.
How can i do this?
also need to change kernel modules and enable hardware?
ffmpeg library is a good things? Or Banana Org has a library for this?

Try this:

Useful, thanks,
What about hardware decoding h265/HEVC ?
I want some references to decoding h265 to YUV or another formats.

Hardware decoding:

I try to encode rawdata to h264 and decode again to rawdata. After Install the .deb in this link:

Searching in Google and find some command but not works!!!
Which command i must to use?