[FFmpeg-trac] #225(undetermined:new): Converting from YUVJ to YUV lose contrast

FFmpeg trac at avcodec.org
Fri May 20 10:40:18 CEST 2011


#225: Converting from YUVJ to YUV lose contrast
-------------------------------+-------------------------
 Reporter:  sghpunk            |        Type:  defect
   Status:  new                |    Priority:  important
Component:  undetermined       |     Version:  git-master
 Keywords:  YUV/YUVJ contrast  |  Blocked By:
 Blocking:                     |  Reproduced:  1
 Analyzed:  0                  |
-------------------------------+-------------------------
 I am trying to transcode video from my Nicon D90 mjpeg to x264.
 And output video contrast is lower than input.
 I use ffmpeg-HEAD-27614b1

 Command line:
 ffmpeg.exe -threads 2 -an -i input.mkv -f matroska -vcodec libx264
 -profile main -preset fast -cqp 27 -y x264-low_contract_yuv.mkv > enc.log
 2>&1
 {{{
 ffmpeg version UNKNOWN, Copyright (c) 2000-2011 the FFmpeg developers
   built on May 19 2011 17:41:01 with gcc 4.5.2
   configuration: --prefix=/mingw --disable-static --enable-shared
 --enable-gpl --enable-version3 --disable-doc --enable-postproc --disable-
 network --enable-memalign-hack --enable-libopencore-amrnb --enable-
 libopencore-amrwb --enable-libmp3lame --enable-libspeex --enable-libvorbis
 --enable-libx264 --enable-pthreads --enable-frei0r --extra-
 cflags='-mthreads -mtune=nocona -march=nocona -msse3 -m80387 -mfpmath=387
 -O2 -fgnu89-inline -Wno-error=missing-prototypes' --extra-ldflags='-Wl
 ,--enable-auto-image-base -Wl,--enable-auto-import' --extra-libs=-ldl
 --cpu=nocona
   libavutil    51.  2. 1 / 51.  2. 1
   libavcodec   53.  5. 0 / 53.  5. 0
   libavformat  53.  0. 3 / 53.  0. 3
   libavdevice  53.  0. 0 / 53.  0. 0
   libavfilter   2.  5. 0 /  2.  5. 0
   libswscale    0. 14. 0 /  0. 14. 0
   libpostproc  51.  2. 0 / 51.  2. 0
 [matroska,webm @ 00b70280] Estimating duration from bitrate, this may be
 inaccurate
 Input #0, matroska,webm, from 'input.mkv':
   Metadata:
     MAKER           : NIKON CORPORATION
     MODEL           : NIKON D90
     CREATION_TIME   : 2011-05-05 07:47:28
     ENCODER         : Lavf53.0.3
   Duration: 00:00:05.04, start: 0.000000, bitrate: N/A
     Stream #0.0: Video: mjpeg, yuvj422p, 1280x720, PAR 1:1 DAR 16:9, 24
 fps, 24 tbr, 1k tbn, 24 tbc (default)
 Incompatible pixel format 'yuvj422p' for codec 'libx264', auto-selecting
 format 'yuv420p'
 [buffer @ 00b83e00] w:1280 h:720 pixfmt:yuvj422p tb:1/1000000 sar:1/1
 [ffsink @ 003efee0] auto-inserting filter 'auto-inserted scaler 0' between
 the filter 'src' and the filter 'out'
 [scale @ 00b95920] w:1280 h:720 fmt:yuvj422p -> w:1280 h:720 fmt:yuv420p
 flags:0xa0000004
 [libx264 @ 00b60540] using SAR=1/1
 [libx264 @ 00b60540] using cpu capabilities: MMX2 SSE2 SSE3 Cache64
 [libx264 @ 00b60540] profile Main, level 3.1
 [libx264 @ 00b60540] 264 - core 114 - H.264/MPEG-4 AVC codec - Copyleft
 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=2
 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=6 psy=1 psy_rd=1.00:0.00
 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0
 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=2 sliced_threads=0
 nr=0 decimate=1 interlaced=0 constrained_intra=0 bframes=3 b_pyramid=2
 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250
 keyint_min=24 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=27
 ip_ratio=1.40 pb_ratio=1.30 aq=0
 Output #0, matroska, to 'x264-low_contract_yuv.mkv':
   Metadata:
     MAKER           : NIKON CORPORATION
     MODEL           : NIKON D90
     CREATION_TIME   : 2011-05-05 07:47:28
     encoder         : Lavf53.0.3
     Stream #0.0: Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9],
 q=2-31, 200 kb/s, 1k tbn, 24 tbc (default)
 Stream mapping:
   Stream #0.0 -> #0.0
 Press [q] to stop, [?] for help
 frame=   10 fps=  0 q=27.0 size=      33kB time=10000000000.00 bitrate=
 0.0kbits/s
 ...CUT...
 frame=  121 fps=  5 q=-1.0 Lsize=     864kB time=4.96
 bitrate=1427.9kbits/s
 video:863kB audio:0kB global headers:0kB muxing overhead 0.173612%
 frame I:1     Avg QP:24.00  size: 33897
 [libx264 @ 00b60540] frame P:41    Avg QP:27.00  size: 10846
 [libx264 @ 00b60540] frame B:79    Avg QP:28.66  size:  5118
 [libx264 @ 00b60540] consecutive B-frames:  6.6% 11.6% 22.3% 59.5%
 [libx264 @ 00b60540] mb I  I16..4: 44.1%  0.0% 55.9%
 [libx264 @ 00b60540] mb P  I16..4:  7.9%  0.0%  4.9%  P16..4: 42.7% 10.5%
 3.3%  0.0%  0.0%    skip:30.7%
 [libx264 @ 00b60540] mb B  I16..4:  3.9%  0.0%  0.6%  B16..8: 30.6%  7.4%
 0.3%  direct: 8.4%  skip:48.7%  L0:41.1% L1:53.7% BI: 5.2%
 [libx264 @ 00b60540] coded y,uvDC,uvAC intra: 29.7% 47.0% 14.1% inter:
 8.7% 11.9% 0.1%
 [libx264 @ 00b60540] i16 v,h,dc,p: 31% 31% 24% 14%
 [libx264 @ 00b60540] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 20% 20%  5%  7%
 7%  6%  6%  3%
 [libx264 @ 00b60540] i8c dc,h,v,p: 63% 18% 16%  3%
 [libx264 @ 00b60540] Weighted P-Frames: Y:2.4% UV:2.4%
 [libx264 @ 00b60540] ref P L0: 75.4% 24.6%
 [libx264 @ 00b60540] ref B L0: 80.3% 19.7%
 [libx264 @ 00b60540] ref B L1: 94.1%  5.9%
 [libx264 @ 00b60540] kb/s:1401.04
 }}}
 ffmpeg -v 9 -loglevel 99 -i input.mkv > v9.log 2>&1
 {{{
 ffmpeg version UNKNOWN, Copyright (c) 2000-2011 the FFmpeg developers
   built on May 19 2011 17:41:01 with gcc 4.5.2
   configuration: --prefix=/mingw --disable-static --enable-shared
 --enable-gpl --enable-version3 --disable-doc --enable-postproc --disable-
 network --enable-memalign-hack --enable-libopencore-amrnb --enable-
 libopencore-amrwb --enable-libmp3lame --enable-libspeex --enable-libvorbis
 --enable-libx264 --enable-pthreads --enable-frei0r --extra-
 cflags='-mthreads -mtune=nocona -march=nocona -msse3 -m80387 -mfpmath=387
 -O2 -fgnu89-inline -Wno-error=missing-prototypes' --extra-ldflags='-Wl
 ,--enable-auto-image-base -Wl,--enable-auto-import' --extra-libs=-ldl
 --cpu=nocona
   libavutil    51.  2. 1 / 51.  2. 1
   libavcodec   53.  5. 0 / 53.  5. 0
   libavformat  53.  0. 3 / 53.  0. 3
   libavdevice  53.  0. 0 / 53.  0. 0
   libavfilter   2.  5. 0 /  2.  5. 0
   libswscale    0. 14. 0 /  0. 14. 0
   libpostproc  51.  2. 0 / 51.  2. 0
 [NULL @ 00b70280] Format matroska,webm probed with size=2048 and score=100
 st:0 removing common factor 1000000 from timebase
 [mjpeg @ 00b7b700] buffer too small, expanding to 73330 bytes
 [mjpeg @ 00b7b700] marker=d8 avail_size_in_buf=73330
 [mjpeg @ 00b7b700] marker parser used 0 bytes (0 bits)
 [mjpeg @ 00b7b700] marker=db avail_size_in_buf=73328
 [mjpeg @ 00b7b700] index=0
 [mjpeg @ 00b7b700] qscale[0]: 3
 [mjpeg @ 00b7b700] index=1
 [mjpeg @ 00b7b700] qscale[1]: 6
 [mjpeg @ 00b7b700] marker parser used 132 bytes (1056 bits)
 [mjpeg @ 00b7b700] marker=c0 avail_size_in_buf=73194
 [mjpeg @ 00b7b700] sof0: picture: 1280x720
 [mjpeg @ 00b7b700] component 0 2:1 id: 0 quant:0
 [mjpeg @ 00b7b700] component 1 1:1 id: 1 quant:1
 [mjpeg @ 00b7b700] component 2 1:1 id: 2 quant:1
 [mjpeg @ 00b7b700] pix fmt id 21111100
 [mjpeg @ 00b7b700] marker parser used 17 bytes (136 bits)
 [mjpeg @ 00b7b700] marker=c4 avail_size_in_buf=73175
 [mjpeg @ 00b7b700] class=0 index=0 nb_codes=12
 [mjpeg @ 00b7b700] class=1 index=0 nb_codes=251
 [mjpeg @ 00b7b700] class=0 index=1 nb_codes=12
 [mjpeg @ 00b7b700] class=1 index=1 nb_codes=251
 [mjpeg @ 00b7b700] marker parser used 418 bytes (3344 bits)
 [mjpeg @ 00b7b700] escaping removed 115 bytes
 [mjpeg @ 00b7b700] marker=da avail_size_in_buf=72755
 [mjpeg @ 00b7b700] component: 0
 [mjpeg @ 00b7b700] component: 1
 [mjpeg @ 00b7b700] component: 2
 [mjpeg @ 00b7b700] marker parser used 72639 bytes (581110 bits)
 [mjpeg @ 00b7b700] marker=d9 avail_size_in_buf=3
 [mjpeg @ 00b7b700] mjpeg decode frame unused 3 bytes
 [matroska,webm @ 00b70280] All info found
 [matroska,webm @ 00b70280] Estimating duration from bitrate, this may be
 inaccurate
 Input #0, matroska,webm, from 'input.mkv':
   Metadata:
     MAKER           : NIKON CORPORATION
     MODEL           : NIKON D90
     CREATION_TIME   : 2011-05-05 07:47:28
     ENCODER         : Lavf53.0.3
   Duration: 00:00:05.04, start: 0.000000, bitrate: N/A
     Stream #0.0, 1, 1/1000: Video: mjpeg, yuvj422p, 1280x720, 1/24, PAR
 1:1 DAR 16:9, 24 fps, 24 tbr, 1k tbn, 24 tbc (default)
 At least one output file must be specified
 }}}

 Seems like contrast loosing when converting a pixel format from yuvj422p
 to yuv420p.
 I tryed to encode same video from mplayer yuv4mpeg raw file and in this
 case contrast on output video is the same.

 I cannot find mplayer ftp server to upload samples. Where can I upload it?

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/225>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list