[FFmpeg-user] Scaling legal video levels

Elliott Balsley elliottbalsley at gmail.com
Fri Feb 17 03:39:19 EET 2017


I am trying to convert a single-frame H.264 MKV to a JPEG image.  Unfortunately the output is always clipped at 235.  The source video is full-range, and I want to keep it full-range.  Sample attached to this email.  The clipping can be seen quite obviously with this test pattern.
If I instead rewrap from MKV to MOV with “vcodec copy”, it works correctly.  It seems like ffmpeg is treating the source as legal range, so I need to force it to treat the input as full range?

$ ffmpeg -i title01.mkv -q:v 1 title01.jpg
ffmpeg version 3.0.git Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libsoxr --enable-libspeex --enable-libass --enable-libbluray --enable-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-indev=jack --disable-outdev=xv --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --enable-vda --enable-audiotoolbox --enable-videotoolbox --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid --enable-nonfree --enable-libfdk-aac --enable-libfaac
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 51.100 / 57. 51.100
  libavformat    57. 46.100 / 57. 46.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 50.100 /  6. 50.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[h264 @ 0x7feb34804600] sps_id 1 out of range
[matroska,webm @ 0x7feb35000000] decoding for stream 0 failed
Input #0, matroska,webm, from 'title01.mkv':
  Metadata:
    encoder         : libmakemkv v1.10.4 (1.3.3/1.4.4) win(x64-release)
    creation_time   : 2017-02-17 04:27:15
  Duration: 00:00:00.04, bitrate: 9301 kb/s
    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:
      stereo_mode     : block_lr
      BPS-eng         : 8681560
      DURATION-eng    : 00:00:00.041708333
      NUMBER_OF_FRAMES-eng: 1
      NUMBER_OF_BYTES-eng: 44493
      SOURCE_ID-eng   : 001011
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.10.4 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-02-17 04:27:15
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Side data:
      stereo3d: frame alternate
[swscaler @ 0x7feb35009000] deprecated pixel format used, make sure you did set range correctly
[image2 @ 0x7feb34006400] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, image2, to 'title01.jpg':
  Metadata:
    encoder         : Lavf57.46.100
    Stream #0:0(eng): Video: mjpeg, yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc
    Metadata:
      stereo_mode     : block_lr
      BPS-eng         : 8681560
      DURATION-eng    : 00:00:00.041708333
      NUMBER_OF_FRAMES-eng: 1
      NUMBER_OF_BYTES-eng: 44493
      SOURCE_ID-eng   : 001011
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.10.4 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-02-17 04:27:15
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      encoder         : Lavc57.51.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[h264 @ 0x7feb3380d200] sps_id 1 out of range
frame=    1 fps=0.0 q=1.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed= 1.8x    
video:90kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown



-------------- next part --------------
A non-text attachment was scrubbed...
Name: title01.mkv
Type: application/octet-stream
Size: 47669 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20170216/8bfd765d/attachment.obj>


More information about the ffmpeg-user mailing list