deprecated pixel format used, make sure you did set range correctly
Why am I getting this warning and how to fix it? Essentially, I want to convert a video to a jpg every 4th frame with the same resolution as original video.
[jalal@goku vid2]$ ffmpeg -i debate_vid2.mov -r 0.25 images_%08d.jpg
ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfaac --enable-nonfree --enable-libfdk-aac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'debate_vid2.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2017-03-10 02:45:46
Duration: 01:36:50.03, start: 0.000000, bitrate: 785 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s (default)
Metadata:
creation_time : 2017-03-10 02:45:46
handler_name : Core Media Data Handler
Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 334x360 [SAR 1:1 DAR 167:180], 685 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2017-03-10 02:45:46
handler_name : Core Media Data Handler
encoder : H.264
[swscaler @ 0x1bb4240] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'images_%08d.jpg':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
encoder : Lavf56.25.101
Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 334x360 [SAR 1:1 DAR 167:180], q=2-31, 200 kb/s, 0.25 fps, 0.25 tbn, 0.25 tbc (default)
Metadata:
creation_time : 2017-03-10 02:45:46
handler_name : Core Media Data Handler
encoder : Lavc56.26.100 mjpeg
Stream mapping:
Stream #0:1 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
frame= 1454 fps= 25 q=1.6 Lsize=N/A time=01:36:56.00 bitrate=N/A dup=0 drop=172847
video:28470kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[jalal@goku vid2]$
Solution 1:
If you are just converting videos using ffmpeg
, this is just a warning, not an error, and nothing to worry about.
You can safely ignore the message when using ffmpeg from the command-line, and you don't have to fix anything.
Background:
The warning occurs when converting from a yuv420p
source to JPEG, which makes ffmpeg choose yuvj420p
as output format. That format is required for writing files with the mjpeg
encoder.
These two pixel formats have different color ranges: the former is from 16–235, which is "limited range" (also called "MPEG" range), the latter defaults to 0–255, which is "full range".
This difference in color formats (which were selected automatically) makes ffmpeg trigger that specific warning message, telling you to make sure you set the color range correctly.
The warning is primarly meant for developers who use FFmpeg as a library in their own code (like here). See also the comments on this question. The specific deprecation is listed here:
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range