[FFmpeg-user] Correct conversion of yuvj420p?

Peter B. pb at das-werkstatt.com
Tue Sep 8 17:12:30 EEST 2020

Dear Paul,

On 07.09.20 23:57, Paul B Mahol wrote:
> On Mon, Sep 07, 2020 at 11:20:10PM +0200, Peter B. wrote:
>> [...]
>> The source video is: yuvj420p(pc, smpte170m/bt709/bt709)
>> The output video is: yuv420p(pc, smpte170m/bt709/bt709)
>> What would be the right commandline to losslessly convert this to FFV1?
>> I've tried, but so far I get differing streamhash MD5s for the video -
>> regardless if I set the color range :(
> ffmpeg -i input_video.mov -vf setrange=limited -c:v ffv1 out.mkv
> That command will tell ffmpeg that range is not full but limited
> and will not do lossy conversion with swscale at all.

That worked! Thank you!
Streamhash says it's a match :)

> You will need to signal that encoded video is still full range somehow in container,
> otherwise you will get correct hash but output display will think
> its really limited while it is actually still full range.

Thanks for pointing that out.
I've done the following:

$FFMPEG -i $VIDEO_IN -an -c:v ffv1 \
  -vf setrange=limited \
  -pix_fmt yuv420p \
  -color_range jpeg \
  -colorspace smpte170m \
  -color_primaries bt709 \
  -color_trc bt709 \

The streamhash matches, and the color interpretation metadata seems to 
be identical to the source:

   * Source video (h.264):
     yuvj420p(pc, smpte170m/bt709/bt709)

   * Target video (ffv1):
     yuv420p(pc, smpte170m/bt709/bt709)

Thanks again Paul!

More information about the ffmpeg-user mailing list