[FFmpeg-user] ffmpeg makes some sources darker

Jim Worrall coniophora at gmail.com
Mon Jan 4 20:08:14 CET 2016


I’ve been using ffmpeg with libx265 to transcode Star Wars blurays to smaller files.  
Episodes 1 and 2 went perfectly.  I made screenshots from identical points and 
they were virtually indistinguishable.

When I did Episode 3, I noticed that the screenshots from the transcode were
darker than the source.  I thought it was a problem with x265
and posted a ticket with them.  To prove it was(n’t) x265, I had to first convert 
a minute to raw YUV in ffmpeg, then use the x265 command line to transcode
as I had done previously, resulting in an HEVC stream.

When I compared screenshots from the YUV and HEVC streams, they were
indistinguishable, but both were darker than the source.  

In other words, ffmpeg apparently was doing something to make the video darker, 
both when transcoding and converting to raw video.  This happened with Episode
3 but not 1 and 2.

Unfortunately I can’t attach the screenshots here, but here are links to them: one
from the source and other from the ffmpeg transcode.  You might have to rock 
back and forth between them, then the difference is obvious.
https://www.dropbox.com/s/5anl2l17hl75t73/source.png?dl=0 <https://www.dropbox.com/s/5anl2l17hl75t73/source.png?dl=0>
https://www.dropbox.com/s/q83buel9792gmjd/transcode.png?dl=0 <https://www.dropbox.com/s/q83buel9792gmjd/transcode.png?dl=0>

And here is a minute from the source (216 MB with original video but squashed audio):
https://www.dropbox.com/s/h1a5yird75n3am6/Episode3_1minute.mkv?dl=0 <https://www.dropbox.com/s/h1a5yird75n3am6/Episode3_1minute.mkv?dl=0>

Below is the original ffmpeg commandline and initial output for the first pass.  The
source is an mkv with streams copied from the bluray (for my own use).

ffmpeg -i in.mkv -pass 1 -map 0 -c:v libx265 -b:v 3M -an -sn -f matroska -y /dev/null && \
ffmpeg -i in.mkv -pass 2 -map 0 -c:v libx265 -b:v 3M -c:a copy -c:s copy -y out.mkv

ffmpeg version N-76705-g35bbc19 Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 7.0.0 (clang-700.1.76)
  configuration: --prefix=/Volumes/Ramdisk/sw --enable-nonfree --enable-gpl --enable-version3 --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libgsm --enable-libvpx --enable-libfdk-aac --enable-libvorbis --enable-libass --enable-libfreetype --enable-libfontconfig --enable-libfribidi --disable-outdevs --disable-ffserver --disable-network
  libavutil      55.  6.100 / 55.  6.100
  libavcodec     57. 15.100 / 57. 15.100
  libavformat    57. 15.100 / 57. 15.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 15.100 /  6. 15.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[matroska,webm @ 0x7fa85380a600] Could not find codec parameters for stream 5 (Subtitle: hdmv_pgs_subtitle): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[matroska,webm @ 0x7fa85380a600] Could not find codec parameters for stream 6 (Subtitle: hdmv_pgs_subtitle): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, matroska,webm, from 'in.mkv':
  Metadata:
    title           : Star Wars Episode III. Revenge of the Sith
    encoder         : libmakemkv v1.9.7 (1.3.0/1.4.1) darwin(x86-release)
    creation_time   : 2015-12-17 18:10:26
  Duration: 02:20:05.89, start: 0.000000, bitrate: 34490 kb/s
/ ******** Chapter list deleted *********** /
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc
    Metadata:
      title           : Video
    Stream #0:1(eng): Audio: dts (DTS-HD MA), 48000 Hz, 6.1, fltp (default)
    Metadata:
      title           : DTS-HD Master Audio 6.1
    Stream #0:2(eng): Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s
    Metadata:
      title           : Commentary by George Lucas, Rick McCallum, Rob Coleman, John Knoll and Roger Gayetta
    Stream #0:3(eng): Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s
    Metadata:
      title           : Commentary from archival interviews with the team of actors and crew
    Stream #0:4(eng): Subtitle: hdmv_pgs_subtitle, 1920x1080
    Metadata:
      title           : Full English Subs
    Stream #0:5(eng): Subtitle: hdmv_pgs_subtitle
    Metadata:
      title           : Commentary 1 Speaker ID Subs
    Stream #0:6(eng): Subtitle: hdmv_pgs_subtitle
    Metadata:
      title           : Commentary 2 Speaker ID Subs
x265 [info]: HEVC encoder version 1.8+1-5dcc9d3a928c400b
x265 [info]: build info [Mac OS X][clang 7.0.0][64 bit] 8bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 4 threads
x265 [info]: frame threads / pool features       : 2 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut       : 23 / 250 / 40
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / 0 / 0
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : ABR-3000 kbps / 0.60
x265 [info]: tools: rd=3 psy-rd=0.30 signhide tmvp strong-intra-smoothing
x265 [info]: tools: deblock sao
Output #0, matroska, to '/dev/null':
  Metadata:
    title           : Star Wars Episode III. Revenge of the Sith
    encoder         : Lavf57.15.100
/ ******** Chapter list deleted *********** /
    Stream #0:0(eng): Video: hevc (libx265), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, pass 1, 3000 kb/s, 23.98 fps, 1k tbn, 23.98 tbc
    Metadata:
      title           : Video
      encoder         : Lavc57.15.100 libx265
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
Press [q] to stop, [?] for help
frame=  188 fps=5.3 q=-0.0 size=    6986kB time=00:00:06.58 bitrate=8685.6kbits/s    


More information about the ffmpeg-user mailing list