[FFmpeg-user] Correct conversion of yuvj420p?
Peter B.
pb at das-werkstatt.com
Tue Sep 8 00:20:10 EEST 2020
Hi everyone!
I've read quite a while ago that pix_fmt "yuvj420p" is deprecated, and
when trying to convert an H.264/MOV to FFV1/MKV, I get the following
message:
> Incompatible pixel format 'yuvj420p' for codec 'ffv1', auto-selecting
format 'yuv420p'
> [swscaler @ 0x71c9440] deprecated pixel format used, make sure you
did set range correctly
The comment in
[libavutil/pixfmt.h](https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/pixfmt.h#L78),
says:
> AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG),
deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range
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 :(
Thanks in advance for any hints!
Peter B.
Here's what I've tried so far:
(Console output below)
// ----------------------------------------
FFMPEG="ffmpeg-4.3.1"
VIDEO_IN="../MVI_1522.MOV"
clear
$FFMPEG -i $VIDEO_IN -n -an -c:v ffv1 -pix_fmt + does_not_work.mkv
$FFMPEG -i $VIDEO_IN -n -an -c:v ffv1 -pix_fmt yuvj420p out.mkv
$FFMPEG -i $VIDEO_IN -n -an -c:v ffv1 -pix_fmt yuvj420p -color_range
jpeg -colorspace smpte170m -color_primaries bt709 -color_trc bt709
out-bt709.mkv
$FFMPEG -i $VIDEO_IN -n -an -c:v ffv1 -pix_fmt yuvj420p -color_range
jpeg out-jpeg.mkv
sleep 1
echo
echo "Source video:"
$FFMPEG -i $VIDEO_IN -f streamhash -hash md5 -v quiet -map 0 -
echo
echo "Without setting color information:"
$FFMPEG -i out.mkv -f streamhash -hash md5 -v quiet -map 0 -
echo
echo "Color information set:"
$FFMPEG -i out-bt709.mkv -f streamhash -hash md5 -v quiet -map 0 -
$FFMPEG -i out-jpeg.mkv -f streamhash -hash md5 -v quiet -map 0 -
// ----------------------------------------
ffmpeg-4.3.1 -i ../MVI_1522.MOV -n -an -c:v ffv1 -pix_fmt +
does_not_work.mkv
ffmpeg version 4.3.1-static https://johnvansickle.com/ffmpeg/ Copyright
(c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static
--disable-debug --disable-ffplay --disable-indev=sndio
--disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-gmp --enable-libgme --enable-gray
--enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf
--enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband
--enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis
--enable-libopus --enable-libtheora --enable-libvidstab
--enable-libvo-amrwbenc --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d
--enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../MVI_1522.MOV':
Metadata:
major_brand : qt
minor_version : 537331968
compatible_brands: qt CAEP
creation_time : 2012-07-14T20:54:32.000000Z
Duration: 00:00:11.52, start: 0.000000, bitrate: 45262 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuvj420p(pc, smpte170m/bt709/bt709), 1920x1080, 43657 kb/s,
25 fps, 25 tbr, 25k tbn, 50k tbc (default)
Metadata:
creation_time : 2012-07-14T20:54:32.000000Z
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz,
stereo, s16, 1536 kb/s (default)
Metadata:
creation_time : 2012-07-14T20:54:32.000000Z
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> ffv1 (native))
Press [q] to stop, [?] for help
[ffv1 @ 0x5fb9500] Specified pixel format yuvj420p is invalid or not
supported
Error initializing output stream 0:0 -- Error while opening encoder for
output stream #0:0 - maybe incorrect parameters such as bit_rate, rate,
width or height
Conversion failed!
------------
ffmpeg-4.3.1 -i ../MVI_1522.MOV -n -an -c:v ffv1 -pix_fmt yuvj420p out.mkv
ffmpeg version 4.3.1-static https://johnvansickle.com/ffmpeg/ Copyright
(c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static
--disable-debug --disable-ffplay --disable-indev=sndio
--disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-gmp --enable-libgme --enable-gray
--enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf
--enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband
--enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis
--enable-libopus --enable-libtheora --enable-libvidstab
--enable-libvo-amrwbenc --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d
--enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../MVI_1522.MOV':
Metadata:
major_brand : qt
minor_version : 537331968
compatible_brands: qt CAEP
creation_time : 2012-07-14T20:54:32.000000Z
Duration: 00:00:11.52, start: 0.000000, bitrate: 45262 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuvj420p(pc, smpte170m/bt709/bt709), 1920x1080, 43657 kb/s,
25 fps, 25 tbr, 25k tbn, 50k tbc (default)
Metadata:
creation_time : 2012-07-14T20:54:32.000000Z
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz,
stereo, s16, 1536 kb/s (default)
Metadata:
creation_time : 2012-07-14T20:54:32.000000Z
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> ffv1 (native))
Press [q] to stop, [?] for help
Incompatible pixel format 'yuvj420p' for codec 'ffv1', auto-selecting
format 'yuv420p'
[swscaler @ 0x82fd9c0] deprecated pixel format used, make sure you did
set range correctly
Output #0, matroska, to 'out.mkv':
Metadata:
major_brand : qt
minor_version : 537331968
compatible_brands: qt CAEP
encoder : Lavf58.45.100
Stream #0:0(eng): Video: ffv1 (FFV1 / 0x31564646), yuv420p,
1920x1080, q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc (default)
Metadata:
creation_time : 2012-07-14T20:54:32.000000Z
encoder : Lavc58.91.100 ffv1
frame= 288 fps= 43 q=-0.0 Lsize= 255120kB time=00:00:11.48
bitrate=182035.0kbits/s speed= 1.7x
video:255116kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.001688%
------------
ffmpeg-4.3.1 -i ../MVI_1522.MOV -n -an -c:v ffv1 -pix_fmt yuvj420p
-color_range jpeg -colorspace smpte170m -color_primaries bt709
-color_trc bt709 out-bt709.mkv
ffmpeg version 4.3.1-static https://johnvansickle.com/ffmpeg/ Copyright
(c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static
--disable-debug --disable-ffplay --disable-indev=sndio
--disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-gmp --enable-libgme --enable-gray
--enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf
--enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband
--enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis
--enable-libopus --enable-libtheora --enable-libvidstab
--enable-libvo-amrwbenc --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d
--enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../MVI_1522.MOV':
Metadata:
major_brand : qt
minor_version : 537331968
compatible_brands: qt CAEP
creation_time : 2012-07-14T20:54:32.000000Z
Duration: 00:00:11.52, start: 0.000000, bitrate: 45262 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuvj420p(pc, smpte170m/bt709/bt709), 1920x1080, 43657 kb/s,
25 fps, 25 tbr, 25k tbn, 50k tbc (default)
Metadata:
creation_time : 2012-07-14T20:54:32.000000Z
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz,
stereo, s16, 1536 kb/s (default)
Metadata:
creation_time : 2012-07-14T20:54:32.000000Z
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> ffv1 (native))
Press [q] to stop, [?] for help
Incompatible pixel format 'yuvj420p' for codec 'ffv1', auto-selecting
format 'yuv420p'
[swscaler @ 0x89c9740] deprecated pixel format used, make sure you did
set range correctly
Output #0, matroska, to 'out-bt709.mkv':
Metadata:
major_brand : qt
minor_version : 537331968
compatible_brands: qt CAEP
encoder : Lavf58.45.100
Stream #0:0(eng): Video: ffv1 (FFV1 / 0x31564646), yuv420p(pc,
smpte170m/bt709/bt709), 1920x1080, q=2-31, 200 kb/s, 25 fps, 1k tbn, 25
tbc (default)
Metadata:
creation_time : 2012-07-14T20:54:32.000000Z
encoder : Lavc58.91.100 ffv1
frame= 288 fps= 42 q=-0.0 Lsize= 255120kB time=00:00:11.48
bitrate=182035.0kbits/s speed=1.69x
video:255116kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.001694%
------------
ffmpeg-4.3.1 -i ../MVI_1522.MOV -n -an -c:v ffv1 -pix_fmt yuvj420p
-color_range jpeg out-jpeg.mkv
ffmpeg version 4.3.1-static https://johnvansickle.com/ffmpeg/ Copyright
(c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static
--disable-debug --disable-ffplay --disable-indev=sndio
--disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-gmp --enable-libgme --enable-gray
--enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf
--enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband
--enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis
--enable-libopus --enable-libtheora --enable-libvidstab
--enable-libvo-amrwbenc --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d
--enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../MVI_1522.MOV':
Metadata:
major_brand : qt
minor_version : 537331968
compatible_brands: qt CAEP
creation_time : 2012-07-14T20:54:32.000000Z
Duration: 00:00:11.52, start: 0.000000, bitrate: 45262 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuvj420p(pc, smpte170m/bt709/bt709), 1920x1080, 43657 kb/s,
25 fps, 25 tbr, 25k tbn, 50k tbc (default)
Metadata:
creation_time : 2012-07-14T20:54:32.000000Z
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz,
stereo, s16, 1536 kb/s (default)
Metadata:
creation_time : 2012-07-14T20:54:32.000000Z
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> ffv1 (native))
Press [q] to stop, [?] for help
Incompatible pixel format 'yuvj420p' for codec 'ffv1', auto-selecting
format 'yuv420p'
[swscaler @ 0x7626480] deprecated pixel format used, make sure you did
set range correctly
Output #0, matroska, to 'out-jpeg.mkv':
Metadata:
major_brand : qt
minor_version : 537331968
compatible_brands: qt CAEP
encoder : Lavf58.45.100
Stream #0:0(eng): Video: ffv1 (FFV1 / 0x31564646), yuv420p(pc),
1920x1080, q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc (default)
Metadata:
creation_time : 2012-07-14T20:54:32.000000Z
encoder : Lavc58.91.100 ffv1
frame= 288 fps= 43 q=-0.0 Lsize= 255120kB time=00:00:11.48
bitrate=182035.0kbits/s speed=1.71x
video:255116kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.001690%
Source video:
0,v,MD5=521af382c5493165eda080c4a49c81e2
1,a,MD5=f21269116a847f887710cfc67ecc3e6e
Without setting color information:
0,v,MD5=4fbaea423bccbfa1a6d4a9701f09effc
Color information set:
0,v,MD5=4fbaea423bccbfa1a6d4a9701f09effc
0,v,MD5=4fbaea423bccbfa1a6d4a9701f09effc
More information about the ffmpeg-user
mailing list