OSX 10.9 and libx265


(Atalantia) #1

Hello,
I installed ffmpeg to OSX 10.9 with the following command:

brew install ffmpeg --with-fdk-aac --with-freetype --with-libass --with-libvpx --enable-libx265

First during compiling I got the message: --enable-libx265: unknown command
And then when I run a shell with libx265 I get the result:

Unknown encoder ‘libx265’

Can someone give me a hint how to activate libx265 on OSX Mavericks?

Kind regards


(Jacob Ledbetter) #2

libx256 is not available with brew, it might need to be installed after the fact.


(Atalantia) #3

Thanks, how to install it?


(Eduard Rozenberg) #4

Wrong formula name.

brew install x265


(Atalantia) #5

It says:
Warning: x265 2.7 is already installed and up-to-date
To reinstall 2.7, run brew reinstall x265

Ok, so I reinstalled it.

I try to call the encoder like this:
/usr/local/Cellar/ffmpeg/3.4.2/bin/ffmpeg -loglevel 24 -i ~/pathTo/myMovie.avi -c:v libx265 -crf 28 -c:a aac -b:a 128k ~/pathTo/OutMovie.mp4

but I get the same error like before:
Unknown encoder 'libx265


(Jacob Ledbetter) #6

Try brew link x265?


(Eduard Rozenberg) #7

Probably your ffmpeg is not currently compiled/built with x265 support. To check, run this and see if you get a result. If not then x265 is not part of your ffmpeg.
$ (ffmpeg 2>&1) | grep -o libx265

To build ffmpeg with x265:

$ brew uninstall ffmpeg
$ brew install ffmpeg --with-fdk-aac --with-freetype --with-libass --with-libvpx --with-x265

In your original build line you have --enable-libx265 which is not right.

To see all possible build options, brew info ffmpeg.


(Eduard Rozenberg) #8

As a general note, with any of the ffmpeg build options, you have to first install the libraries those options require, before building ffmpeg.

So for ex. if you later decide to add say --with-libbluray, you’ll need to uninstall ffmpeg, figure out the name of the required library from brew info ffmpeg Recommended/Optional sections, install the bluray library ($ brew install libbluray), and install (recompile) ffmpeg with all the options from before + the new option you’re adding.

Also note the options to use with brew install have different names than the build info you get from running ffmpeg. For example:

brew install option: --with-libbluray
ffmpeg build info: --enable-libbluray


(Atalantia) #9

Yes, I didn’t get a result with: $ (ffmpeg 2>&1) | grep -o libx265

So I try now:
$ brew uninstall ffmpeg

$ brew install ffmpeg --with-fdk-aac --with-freetype --with-libass --with-libvpx --with-x265

PS: It worked. libx265 is recognzed and working. Thanks all of you.
Where can I call the help and all the flags and options for libx265?


(Jacob Ledbetter) #10

brew info x256 Should have the options you are looking for. :+1:


(Atalantia) #11

brew info x265
Yes :wink:
But I couldn’t find any user documentation.


(Eduard Rozenberg) #12

You’ll need to read ffmpeg documentation. It isn’t short.

For specific use cases, better to do a web search for whatever you’re trying to do, say “ffmpeg convert mkv mp4”, or whatever your scenario(s) are.


(Atalantia) #13

Hmm, thats quite difficult. I know what I want but I don’t know how to get it. I want to to convert some large AVC movies (>6GB) to x.265 with preserving the maximum of visual quality. But only human understand this question, I can’t really ask duckduck.


(Eduard Rozenberg) #14

The human known as “Don Melton” understands this question, and luckily he’s been working for a few years on a project to make this “somewhat difficult” instead of “quite difficult”.

With his tools it could be as “simple” as $ transcode-video --handbrake-option encoder=x265 "/path/to/Movie.mkv" but you’ll have to install all the necessary packages as he describes. There’s nothing very easy about multimedia transcoding and quality considerations.


(Eduard Rozenberg) #15

The closest thing to easy is $ brew cask install handbrake and use that app for conversion. It won’t be as good as using Don Melton’s quality-obsessive approach, but it should be good enough. Never delete your originals though - basic advice when doing any multimedia transcoding. Never know when you might need them, and drives are cheap.


(Atalantia) #16

Great! I test it allready. $ transcode-video --handbrake-option encoder=x265 "/path/to/Movie.mkv" is running. I even have a comparison of a same video transcoded with ffmpeg h.265


(Atalantia) #17

After testing I have to say. I get the best results with #!/bin/bash ffmpeg -hide_banner -stats -i "movie.mkv" -map 0:v:0 -c:v libx265 -x265-params crf=20 "convertedMovie.mkv"
I add audio and subtitles in a second step. Default preset of libx265 is medium.

PS: I installed ffplay too. Thanks Eduard Rozenberg I know now how to do it :wink: Its very handy if you need to crop something.

$ brew uninstall ffmpeg
$ brew install ffmpeg --with-fdk-aac --with-freetype --with-libass --with-libvpx --with-sdl2 --with-x265