<p>CABAC will give a small compression but increases the encoding time a bit. </p>

CC BY-SA 4.0
2020-01-13T09:49:32.343Z
2020-01-13T13:32:07.967Z
2020-01-13T13:32:07.967Z
Sunny
<p>Cabac is lossless, but h264 is lossy. The part you are missing is that cabac is not THE compression algorithm. It is just the final step out of hundreds of steps in video compression. By the time you get to cabac, all the lossy steps have already been performed, and a final lossless step is added to squeeze a few more bits out.</p>

CC BY-SA 4.0
2019-11-23T03:55:23.537Z
2019-11-23T03:55:23.537Z
SlimSCSI
<p>I've been looking into how to compress a video using ffmpeg when I stumbled across CABAC encoding which I could specify by using the libx264 for the video codec and pairing it with the proper arguments (<code>-x264opts cabac=1</code>), however I know that libx264 is usually used for lossy compression. However, CABAC encoding is listed as a lossless compression technique on <a href="https://en.wikipedia.org/wiki/Context-adaptive_binary_arithmetic_coding" rel="nofollow noreferrer">Wikipedia</a>. I know I can control the quality of the file by using the <code>-crf</code> tag but I wanted to know if I specified ffmpeg to use cabac, would the output video be compressed lossless or lossy?</p>

<ffmpeg><encoding><libx264><lossless>
Is CABAC encoding lossy or lossless in ffmpeg?
Juhmer_Tena
# Is CABAC encoding lossy or lossless in ffmpeg?

(Asked by: username_0 on 2019-11-22)

I've been looking into how to compress a video using ffmpeg when I stumbled across CABAC encoding which I could specify by using the libx264 for the video codec and pairing it with the proper arguments (`-x264opts cabac=1`), however I know that libx264 is usually used for lossy compression. However, CABAC encoding is listed as a lossless compression technique on [Wikipedia](https://en.wikipedia.org/wiki/Context-adaptive_binary_arithmetic_coding). I know I can control the quality of the file by using the `-crf` tag but I wanted to know if I specified ffmpeg to use cabac, would the output video be compressed lossless or lossy?

**Tags:** ffmpeg, encoding, libx264, lossless


---

## 2 answers

### Answer by username_2 on 2019-11-23. Score: 4 | Accepted answer

Cabac is lossless, but h264 is lossy. The part you are missing is that cabac is not THE compression algorithm. It is just the final step out of hundreds of steps in video compression. By the time you get to cabac, all the lossy steps have already been performed, and a final lossless step is added to squeeze a few more bits out.


---

### Answer by username_1 on 2020-01-13. Score: 0

CABAC will give a small compression but increases the encoding time a bit.


---

