1

When I encode with ffmpeg on Ubuntu 18, the default encoder h264 (libx264) uses by default the pixel format yuvj420p.
But https://ffmpeg.org/doxygen/trunk/pixfmt_8h_source.html says that AV_PIX_FMT_YUVJ420P is "full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range."
https://trac.ffmpeg.org/wiki/Encode/H.264 also recommends "use -vf format=yuv420p (or the alias -pix_fmt yuv420p)."

No "j." Let's try that.

ffmpeg -i in.mov -movflags +faststart -crf 18 -preset slower \ -pix_fmt yuv420p \ -vf "scale=in_range=mpeg:out_range=full" \ -color_range 2 out.mov

That command reports: encoder : Lavf57.83.100,... Video: h264 (libx264) ... yuv420p(pc, progressive).

But ffplay out.mov complains "deprecated pixel format used, make sure you did set range correctly."
ffprobe out.mov agrees that the result is yuvj420p, not my requested yuv420p.

Even diff reports that the result is bitwise identical to that from a command that omits the options for pix_fmt, vf, and color_range.

ffmpeg -h encoder=libx264 reports Supported pixel formats: yuv420p yuvj420p ....

What's the correct way to encode yuv420p with full color range?

ffmpeg version 3.4.6-0ubuntu0.18.04.1 configuration: ... --extra-version=0ubuntu0.18.04.1 ... --enable-libx264

  • 1
    At this time, yuv 4:2:0 with full range is signaled as yuvj420p upon decoding. Deprecated but not removed yet, so not a concern. – Gyan Apr 19 '20 at 19:33
  • First off, you can jut ignore the warning. Its form code that needs to be updated, but hasn't yet. Second -vf "scale=in_range=mpeg:out_range=full" is setting the range to full. Which is yuvj420p – szatmary Apr 19 '20 at 19:34
  • If the deprecation is a side effect of the identical signatures, in libavutil/pixdesc.c's av_pix_fmt_descriptors[], of AV_PIX_FMT_YUV420P and AV_PIX_FMT_YUVJ420P, then I'd accept that as an answer. – Camille Goudeseune Apr 20 '20 at 16:39
  • That is just a bug, and that warning just notifies us devs that it is a bug, just like with any jpeg (jpeg decoder does not support new api yet) or with jpeg inside flac or other music with cover art. – Валерий Заподовников Mar 19 '22 at 02:51

0 Answers0