<p>This command preserved the colorspace and also video didnt get darker after transcoding</p>
<pre><code>ffmpeg -i input.mp4 -color_primaries smpte170m -color_trc smpte170m -colorspace smpte170m -r 25 -crf 18 output.mp4
</code></pre>
<p>source: <a href="https://kdenlive.org/en/project/color-hell-ffmpeg-transcoding-and-preserving-bt-601/" rel="nofollow noreferrer">https://kdenlive.org/en/project/color-hell-ffmpeg-transcoding-and-preserving-bt-601/</a></p>
<p>more about colorspace: <a href="https://trac.ffmpeg.org/wiki/colorspace" rel="nofollow noreferrer">https://trac.ffmpeg.org/wiki/colorspace</a></p>

CC BY-SA 4.0
2020-11-07T09:59:27.793Z
2020-11-07T09:59:27.793Z
mustafa candan
<p>I have a <code>x264</code> video with <code>yuvj420p(pc, smpte170m)</code> color space and i want to convert this video to <code>x265</code> and reduce its file size. I have used this command <code>ffmpeg -i input.mp4 -vcodec libx265 -crf 20 output.mp4</code> but the video got darker and when i runned ffprobe i saw the colorspace changed to <code>yuvj420p(pc, progressive)</code> How can i preserve color space while transcoding?</p>

<ffmpeg><video-quality><transcoding><colorspace><h265>
How to preserve colorspace in ffmpeg
mustafa candan
# How to preserve colorspace in ffmpeg

(Asked by: username_0 on 2020-11-07)

I have a `x264` video with `yuvj420p(pc, smpte170m)` color space and i want to convert this video to `x265` and reduce its file size. I have used this command `ffmpeg -i input.mp4 -vcodec libx265 -crf 20 output.mp4` but the video got darker and when i runned ffprobe i saw the colorspace changed to `yuvj420p(pc, progressive)` How can i preserve color space while transcoding?

**Tags:** ffmpeg, video-quality, transcoding, colorspace, h265


---

## 1 answers

### Answer by username_0 on 2020-11-07. Score: 4

This command preserved the colorspace and also video didnt get darker after transcoding
ffmpeg -i input.mp4 -color_primaries smpte170m -color_trc smpte170m -colorspace smpte170m -r 25 -crf 18 output.mp4

source: https://kdenlive.org/en/project/color-hell-ffmpeg-transcoding-and-preserving-bt-601/
more about colorspace: https://trac.ffmpeg.org/wiki/colorspace


---

