X264 Encoder For Mac



Audio encoder software are used to record CDs, to download music, podcasts, and movies, to tag art, metadata and automatically look them up as well. Using this, wi-fi syncing is possible for Android devices. It can be used to play varied formats and creating of playlists. Various devices can be synced including iPhones, iPads, and iPods.

  • Many thanks for the post. I just bought the entry model iMac Pro (8 core, 32GB RAM) and I am also trying to reduce stream lag. While streaming, the software X264 encoding only gets the CPU up to 8%. Hardware encoding is not speeding up the lag. I am now using an Ethernet connection and a Speedify VPN for streaming. But the lag is still there.
  • Even after buying a MAC I was an avid Windows user as it was the only platform that could handle conversion of multiple formats, especially the way MPEG was handled. After 2 months being converted to a MAC and 1 week of finding ffmpegX, I have finally dismantled my PC and sold it on ebay.' Macupdate.com: 'Takes video encoding out of the dark ages'.
  • Developer: The given encoder is especially designed for MAC OS X with an enhanced graphic user interface which can operate more than 20 powerful Unix Open Source Video and Audio Processing Tools that include ‘ffmpeg’, which is the ‘hyper fast video and audio encoder’, ‘mpeg2enc’, which is the open-source mpeg-2 encoder.

H.264 has been the de facto standard video formatacross the internet for the past decade.It is widely supported for playback in all modern browsersand many hardware devices such as gaming consoles and phones.It provides better video quality at smaller file sizescompared to its predecessors.

x264 is a mature, free, open-source encoderfor the H.264 video format.

Prerequisites

To get started, you'll need two things:

  • A video to encode—for the examples,we will pipe in a video from VapourSynth,which you should be able to doif you've been following the previous sections of this guide
  • The x264 encoder

Here's how we get a copy of the x264 encoder:

Windows

Official Windows builds are availablehere.

Linux/macOS

Generally, x264 will be availablethrough your distribution's package manager.Here are a few examples:

  • Ubuntu/Debian: sudo apt install x264
  • Arch Linux: sudo pacman -S x264
  • macOS: brew install x264

Getting Started

X264 H264

x264 is very configurable,and the options may seem overwhelming.But you can get started encodingby using the presets x264 providesand understanding a few basic concepts.We'll walk through those conceptswith the following examples.

Example 1: General-Purpose Encoding

X264 Encoder Obs

Open up a terminal window,and navigate to the folderwhere your VapourSynth script lives.Let's run the following command:

Let's run through what each of these options means:

vspipe --y4m myvideo.vpy -
For

This portion loads your VapourSynth scriptand pipes it to stdout,adding y4m headers that x264 can decode.If you use Linux,you're probably familiar with how piping works.If you're not,it's basically a way of chaining two commands together.In this case, we want to chain vspipe,the program that reads VapourSynth scripts,with x264, our encoder.

Mac
--demuxer y4m

This tells x264 that we're providing it with a y4m file.This matches up with the --y4m flagthat we gave to the vspipe command.

--preset veryfast

x264 has a set of presetsto switch between faster encoding, or higher quality.The full list of presets, from fastest to slowest, is:

  1. ultrafast
  2. superfast
  3. veryfast
  4. faster
  5. fast
  6. medium
  7. slow
  8. slower
  9. veryslow
  10. placebo

You will almost never want to use the extreme settings,but generally, if you want good qualityand don't care about how long the encode takes,slower or veryslow are recommended.In this example,because we are just demonstrating how x264 works,we want a fast encode and have chosen veryfast.

For the curious,you can see a full list of the settings enabled by each presetby running x264 --fullhelp | less (Linux/Mac)or x264 --fullhelp | more (Windows).However, this probably won't mean much at the moment.Don't worry,this page will explain laterwhat all of those settings mean.

Disclaimer:x264's fullhelp is not guaranteed to be up-to-date.

--tune animation

Beyond the preset chosen,x264 allows us to further tune the encoding settingsfor the type of content we're working with.The following tunings are generally the most useful:

  • film: Recommended for live action videos.
  • animation: Recommended for anime or cartoons with flat textures.For 3D animation (e.g. Pixar movies),you may find better results with film.
  • grain: Recommended for particularly grainy films.

You don't need to use a tuning,but it generally helpsto produce a better-looking video.

--crf 24

CRF is a constant-quality, 1-pass encoding mode.In layman's terms,this means that we don't need the output to meet a specific filesize,we just want the output to meet a certain quality level.CRF ranges from 0 to 51 (for 8-bit encoding),with 0 being the best qualityand 51 being the smallest filesize,but there is a certain range of CRF settingsthat are generally most useful.Here are some guidelines:

  • CRF 13: This is considered visually lossless to videophiles.This can produce rather large files,but is a good choice if you want high quality videos.Some fansubbing groups use this for Blu-ray encodes.
  • CRF 16-18: This is considered visually lossless to most viewers,and leans toward high qualitywhile still providing a reasonable filesize.This is a typical range for fansub encodes.
  • CRF 21-24: This provides a good balance between quality and filesize.Some quality loss becomes visible,but this is generally a good choicewhere filesize becomes a concern,such as for videos viewed over the internet.
  • CRF 26-30: This prioritizes filesize,and quality loss becomes more obvious.It is generally not recommended to go higher than CRF 30in any real-world encoding scenario,unless you want your videos to look like they were made for dial-up.

X264 Encoder Level

-o x264output.mkv -

This last portion tells which files to use for the input and output.We use -o to tell which filename to write the encoded file to.In this case, x264 will write a file at x264output.mkvin the current directory.

Obs Encoder X264 Or Amd

The last argument we are passing to x264 is the input file.In this case, we pass - for the input file,which tells x264 to use the piped output from vspipe.The input argument is the only positional argument,so it does not need to be last;x264 will recognize itas the only argument without a -- flag before it.

Example 2: Targeted File Size

For the next example,let's say we want to make sure our encodefits onto a single 4.7GB DVD1.How would we do that in x264?

First, we'll need to figure outwhat bitrate our encode should be,in kilobits per second.This means we'll need to know a couple of things:

  • The length of our video, in seconds.For this example,let's say our movie is 2 hours (120 minutes) long.We'll convert that to seconds:120 minutes * 60 minutes/second = 7200 seconds.
  • Our target filesize.We know that this is 4.7GB,but we need to convert it to kilobits.We can do this with the following steps:

4.7GB×1000MBGB=4700MB4700MB×1000KBMB=4,700,000KB4,700,000KB×8KbitKB=37,600,000Kbitbegin{aligned}4.7:mathrm{GB}times frac{1000:mathrm{MB}}{mathrm{GB}} &= 4700:mathrm{MB}4700:mathrm{MB}times frac{1000:mathrm{KB}}{mathrm{MB}} &= 4,700,000:mathrm{KB}4,700,000:mathrm{KB}times frac{8:mathrm{Kbit}}{mathrm{KB}} &= 37,600,000:mathrm{Kbit}end{aligned}

Now we divide the kilobit size we calculated by our video length,to find our kilobit per second target bitrate:

37,600,000Kbit÷7200seconds5222Kbps37,600,000:mathrm{Kbit}div 7200:mathrm{seconds} approx 5222:mathrm{Kbps}

X264 Encoder For Mac

There is also a python script that can handle this calculation for us:

And here's how we could add that to our x264 command:

The --bitrate option, by itself,says that we want to do a 1-pass, average-bitrate encode.In other words, the encoder will still give more bitsto sections of the video that have more detail or motion,but the average bitrate of the videowill be close to what we requested.

Example 3: 2-Pass Encoding

So far, we've only done 1-pass encodes.While using CRF 1-pass is greatwhen you don't have a target bitrate,it's recommended not to use 1-passfor targeted-bitrate encodes,because the encoder can't knowwhat's coming ahead of the current section of video.This means it can't make good decisionsabout what parts of the video need the most bitrate.

How do we fix this?x264 supports what is known as 2-pass encoding.In 2-pass mode, x264 runs through the video twice,the first time analyzing itto determine where to place keyframesand which sections of video need the most bitrate,and the second time performing the actual encode.2-pass mode is highly recommendedif you need to target a certain bitrate.

Here's how we would run our first pass:

This creates a stats file in our current directory,which x264 will use in the second pass:

You'll notice all we had to change was --pass 1 to --pass 2. Simple!

Although x264 will automatically use faster settings for the first pass,it should be no surprisethat 2-pass encoding is slower than 1-pass encoding.Therefore, there are still certain use caseswhere 1-pass, bitrate-targeted videois a good fit, such as streaming.

Recap

We covered the basics of how to encode in x264,including speed presets, tunings, and three different encoding modes.

Here is a summary of when to use each encoding mode:

  • 1-pass Constant Quality (CRF):
    • Good for: General-purpose encoding
    • Bad for: Streaming; obtaining a certain file size
  • 1-pass Average Bitrate:
    • Good for: Streaming
    • Bad for: Everything else
  • 2-pass Average Bitrate:
    • Good for: Obtaining a certain file size
    • Bad for: Streaming

Advanced Configuration

Coming Soon

1. Source: http://www.mpeg.org/MPEG/DVD/Book_A/Specs.html ↩
Posted by Candice Liu to HEVC, Handbrake | Updated on December 6, 2018

How do I convert x265 files to x264 as fast as possible using Handbrake? What settings do I use for this? Loss of quality is fine, as long as it's watchable. My TV doesn't support x265 files so I plan on keeping the converted x264 files on my TV. - Reddit

X264 Encoder For Mac Windows 10

My player can play x264 successfully, but for HEVC or x265 (480p or 720p or 1080p) video it cannot play smoothly, the A-V sync is horrible. I need to change the codec from HEVC/x265 to x264. Any help?

X265 is a library aiming to encode videos into HEVC/H.265 video compression format. While X264 bears resemblance to X265 but it just encodes video streams into H.264. So when we refer to convert x265 to x264, it generally means a conversion from HEVC/H.265 to H.264. And such task can be done with Handbrake, the latest version 1.0.7 having been updated with better x265 support but confusing many users due to its complex x265 profile settings. For a simple entry, just check the Handbrake tutorial below and learn the Handbrake X264/H.265 encoding settings to speed up the x265 to x264 converting process.