user32809: 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?

user32809: 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

32809: <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>
 32809: <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>
