FFMPEG information:
to the makefile in the right part.
It helps others help you if you tell us where you think the "right part" is. If you are successful it will help others that want to duplicate your work.
But when I do sudo apt-get install libx264-dev, it says its already installed on my machine.
OpenWrt lives in it's own little cross compiling world, other than having the tools to compile (gcc, make, things like that) it doesn't care what you have installed on your system.
There is an option for libx264 under libraries in the menuconfig. Two ways to go here:
1. You can just enable it and hope OpenWrt compiles it before ffmpeg, it may work, it may not work, and it may work today and not tomorrow. If you go this way the best shot is to disable ffmpeg, enable libx264, compile, enable ffmpeg, and compile again. This should make sure libx264 is ready when ffmpeg tries to build.
2. Setup a dependency for libx264 in the ffmpeg makefile. This is the "right" way to do it but it may not be "trivial".
The ffmpeg Makefile is one of the more complex I have run into, ffmpeg has a lot of options to set and OpenWrt has them set up in groups. It looks like you need to do something in the section at the top of the Makefile where all the FFMPEG_CUSTOM_WHATEVER definitions are and this will feed the part where the dependencies are setup