<p>When encoding to webm (specifically VP8, i.e. libvpx), the color range gets reduced from 0-255 to 15-235. This causes a washed-out look; blacks become faded and not as sharp.</p>

<p>I have found <a href="https://stackoverflow.com/a/35652676/1204434">solutions</a> to this problem for mp4, but can't find one for webm. (With an mp4, you can add <code>-pix_fmt yuvj420p</code>. I have tested that and it works for mp4. However, libvpx does not recognize this option.)</p>

<p>The command I'm using is <code>ffmpeg -i in.avi -c:v libvpx -crf 8 -b:v 5M -an out.webm</code></p>

<hr>

<p>Update: while the below comment fixed the problem for me, I've noticed that browsers seem to do some of their own color conversion when displaying video. It looks like they do a TV->PC conversion, eliminating a lot of the washed-out look of video. Possibly they do this to account for the fact that most video is in the clipped range. When playing my improved version, the blacks look overly dark, and I prefer the original version.</p>

<p>But when played in VLC, the improved version shows the full color range I wanted. So I think whether you use this technique depends on where the intend the video to be played. In VLC I would; in a browser, I wouldn't.</p>

CC BY-SA 4.0
2019-03-03T17:14:08.323Z
How are you converting to limited range?
Gyan
CC BY-SA 4.0
2019-03-03T17:32:28.570Z
@Gyan You mean what command am I using that's producing the limited range in the final output? `ffmpeg -i in.avi -c:v libvpx -crf 8 -b:v 5M -an out.webm`. Although from searching it seems that either most codecs do that by default, or ffmpeg does (I'm a new to manipulating color spaces, although I understand what they are).
felwithe
CC BY-SA 4.0
2019-03-03T17:58:07.327Z
Use `ffmpeg -i in.avi -vf "scale=in_range=pc:out_range=tv" -c:v libvpx -crf 8 -b:v 5M -an out.webm`
Gyan
CC BY-SA 4.0
2019-03-03T18:23:14.687Z
@Gyan That didn't do it, but `out_range=pc` did! (I figure that was a typo, since output range=tv is what we were trying to avoid). Thank you! I had read about another hack using the scale filter, and tried it, but the command didn't work. If you'll make that an answer I'll accept it.
felwithe
<ffmpeg><colorspace>
ffmpeg: color loss when encoding to .webm
felwithe
# ffmpeg: color loss when encoding to .webm

(Asked by: username_0 on 2019-03-03)

When encoding to webm (specifically VP8, i.e. libvpx), the color range gets reduced from 0-255 to 15-235. This causes a washed-out look; blacks become faded and not as sharp.

I have found [solutions](https://stackoverflow.com/a/35652676/1204434) to this problem for mp4, but can't find one for webm. (With an mp4, you can add `-pix_fmt yuvj420p`. I have tested that and it works for mp4. However, libvpx does not recognize this option.)

The command I'm using is `ffmpeg -i in.avi -c:v libvpx -crf 8 -b:v 5M -an out.webm`

---

Update: while the below comment fixed the problem for me, I've noticed that browsers seem to do some of their own color conversion when displaying video. It looks like they do a TV->PC conversion, eliminating a lot of the washed-out look of video. Possibly they do this to account for the fact that most video is in the clipped range. When playing my improved version, the blacks look overly dark, and I prefer the original version.

But when played in VLC, the improved version shows the full color range I wanted. So I think whether you use this technique depends on where the intend the video to be played. In VLC I would; in a browser, I wouldn't.

**Tags:** ffmpeg, colorspace

> **Comments:**
> **username_1**: How are you converting to limited range?  
> **username_0**: @username_1 You mean what command am I using that's producing the limited range in the final output? `ffmpeg -i in.avi -c:v libvpx -crf 8 -b:v 5M -an out.webm`. Although from searching it seems that either most codecs do that by default, or ffmpeg does (I'm a new to manipulating color spaces, although I understand what they are).  
> **username_1**: Use `ffmpeg -i in.avi -vf "scale=in_range=pc:out_range=tv" -c:v libvpx -crf 8 -b:v 5M -an out.webm`  
> **username_0**: @username_1 That didn't do it, but `out_range=pc` did! (I figure that was a typo, since output range=tv is what we were trying to avoid). Thank you! I had read about another hack using the scale filter, and tried it, but the command didn't work. If you'll make that an answer I'll accept it.  

---

## 0 answers

