Opus on 12.04
On 12.04 (Precise), however, there are dependency problems with installing the opus codecs and tools, so I have found by far the best solution is the one that has become available very recently: compile the opus audio encoder and decoder as noted here, and build ffmpeg with opus support by adding --enable-opus to the configure options of ffmpeg (as listed on the compilation guide).
I know that ffmpeg is deprecated in Ubuntu in favour of Libav, but compiling is a good way to get a fully functioning opus encoder/decoder integrated into ffmpeg itself. You can then use it to convert files (first to wav) and then to .opus. The documentation installed with libopus and ffmpeg will reveal all the options that can be used to convert files.
When converting files with ffmpeg after compilation, you must specify -acodec libopus or ffmpeg will not use the opus codec:
ffmpeg -i pc.wav -ar 48000 -ac 2 -acodec libopus -ab 256k man.opus
You can then test the file created with
ffplay man.opus
Compilation Tips
There's no need to reproduce the guide here in its entirety, but it's worth noting one or two things:
You should first install the dependencies as listed (I omit yasm from the list: see my second point):
sudo apt-get -y install autoconf build-essential checkinstall git libass-dev libfaac-dev libgpac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev librtmp-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev
There is one issue that should be pointed out: the git build seems to want yasm-1.2, and that is not available, so you have to compile the source from the official site, but it is simple. Just remove any installed versions of yasm, then unpack the downloaded archive, cd to the folder, run ./configure && make and then sudo checkinstall.
If any other builds require the earlier version, you can just remove this version and install the repository version.
It is necessary to remove any existing libav, ffmpeg, x264, libvpx, or fdk-aac packages before you start compiling.
It is critical that you compile and install x264, fdk-aac, libvpx and opus before you build ffmpeg, as those libraries will be used in the build.
Do not forget to add --enable-opus to the configure options when you run the ffmpeg compilation.
The version of opus compiled was 1.1alpha, so you may need to re-compile the opus library and ffmpeg in the future again when a new version is released.
You can use ffplay to play any opus files you create.