how to use FFMPEG to transcode h264 to h265 on Ubuntu 12.04?

7.3k Views Asked by At

I am ching.

I use the following command to transcode h264 to h265.

ffmpeg -i input.mp4 -c:v libx265 -crf 26 -preset fast -c:a aac -b:a 128k output.mp4

But the result is

Unknown encoder 'libx265'

But I have compiled h265 by the following command before using the above command.

sudo apt-get install cmake mercurial
cd ~/ffmpeg_sources
hg clone https://bitbucket.org/multicoreware/x265
cd ~/ffmpeg_sources/x265/build/linux
PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
make
make install

Then, I use ffmpeg -codecs to check if it supports to encode h265.

The result is

D.V.L. hevc H.265 / HEVC (High Efficiency Video Coding)

It seems that ffmpeg does not support h265.

How can I solve this problem?

1

There are 1 best solutions below

2
On

To call the ffmpeg binary in the current folder do

./ffmpeg -i input.mp4 -c:v libx265 -crf 26 -preset fast -c:a aac -b:a 128k output.mp4

Without ./ it will call the binary in /usr/bin which is probably installed through apt without x265 in it.

Hint: The jump in efficiency between preset medium and fast is really high, medium is way better than fast. The same goes for slow and medium (all other presets make no big difference), so consider using slow if you have a little bit more time.