Opened 3 weeks ago

Last modified 3 weeks ago

#7177 reopened defect

crash when using scale with dst_format on 10 bit HEVC source file

Reported by: Rollinnn Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: libx264
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:I was trying to convert from HEVC 10 bit to x264 8 bit and found that with -vf "scale=1280:534:flags=lanczos:dst_format=yuv420p" -vcodec libx264 -crf 18 -preset ultrafast ffmpeg crashes.
ffmpeg is static 32 bit windows build from Zeranoe.
I guess that using dst_format in such way can be wrong, but with some files it works aithout any warnings.
File that causes crash is attached.

d:\ffmpeg.exe -i "D:\0\hevc10bit -dst_format yuv420p crash.mkv" -vf "scale=1280:534:flags=lanczos:dst_format=yuv420p" -vcodec libx264 -crf 18 -preset ultrafast -an "D:\0\output.mkv"
ffmpeg version N-90884-g19c3df0cd6 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 17.100 / 56. 17.100
  libavcodec     58. 19.100 / 58. 19.100
  libavformat    58. 13.100 / 58. 13.100
  libavdevice    58.  4.100 / 58.  4.100
  libavfilter     7. 20.100 /  7. 20.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
Input #0, matroska,webm, from 'D:\0\hevc10bit -dst_format yuv420p crash.mkv':
  Metadata:
    ENCODER         : Lavf58.10.100
  Duration: 00:00:10.09, start: 0.000000, bitrate: 2473 kb/s
    Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709/unknown/unknown), 1920x800, SAR 1:1 DAR 12:5, 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default) (forced)
    Metadata:
      BPS             : 7373812
      BPS-eng         : 7373812
      DURATION-eng    : 02:09:07.240000000
      NUMBER_OF_FRAMES: 185748
      NUMBER_OF_FRAMES-eng: 185748
      NUMBER_OF_BYTES : 7140836609
      NUMBER_OF_BYTES-eng: 7140836609
      _STATISTICS_WRITING_APP: mkvmerge v9.9.0 ('Pick Up') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v9.9.0 ('Pick Up') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2017-09-14 16:29:54
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-09-14 16:29:54
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      DURATION        : 00:00:10.093000000
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 04c56380] using SAR=801/800
[libx264 @ 04c56380] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 04c56380] profile High 10, level 3.1, 4:2:0 10-bit
[libx264 @ 04c56380] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=23 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=18.0 qcomp=0.60 qpmin=0 qpmax=81 qpstep=4 ip_ratio=1.40 aq=0
Output #0, matroska, to 'D:\0\output.mkv':
  Metadata:
    encoder         : Lavf58.13.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p10le, 1280x534 [SAR 801:800 DAR 12:5], q=-1--1, 23.98 fps, 1k tbn, 23.98 tbc (default) (forced)
    Metadata:
      BPS             : 7373812
      BPS-eng         : 7373812
      DURATION-eng    : 02:09:07.240000000
      NUMBER_OF_FRAMES: 185748
      NUMBER_OF_FRAMES-eng: 185748
      NUMBER_OF_BYTES : 7140836609
      NUMBER_OF_BYTES-eng: 7140836609
      _STATISTICS_WRITING_APP: mkvmerge v9.9.0 ('Pick Up') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v9.9.0 ('Pick Up') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2017-09-14 16:29:54
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-09-14 16:29:54
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      DURATION        : 00:00:10.093000000
      encoder         : Lavc58.19.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Assertion failed!

Program: d:\ffmpeg.exe
File: ../src/x264-20180118-7d0ff22/encoder/slicetype.c, Line 1988

Expression: cost >= 0

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Attachments (1)

hevc10bit -dst_format yuv420p crash.mkv (994.7 KB) - added by Rollinnn 3 weeks ago.

Download all attachments as: .zip

Change History (6)

Changed 3 weeks ago by Rollinnn

comment:1 in reply to: ↑ description Changed 3 weeks ago by cehoyos

  • Keywords libx264 added
  • Resolution set to invalid
  • Status changed from new to closed

Replying to Rollinnn:

Summary of the bug: I was trying to convert from HEVC 10 bit to x264 8 bit and found that with -vf "scale=1280:534:flags=lanczos:dst_format=yuv420p" -vcodec libx264 -crf 18 -preset ultrafast ffmpeg crashes.
ffmpeg is static 32 bit windows build from Zeranoe.
I guess that using dst_format in such way can be wrong, but with some files it works aithout any warnings.

Are you indicating that the following command line does not cause the crash?

$ ffmpeg -i "hevc10bit -dst_format yuv420p crash.mkv" -vf "scale=1280:534:flags=lanczos" -pix_fmt yuv420p -vcodec libx264 -f null -
Assertion failed!

Program: d:\ffmpeg.exe
File: ../src/x264-20180118-7d0ff22/encoder/slicetype.c, Line 1988

Expression: cost >= 0

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

This indicates that the bug cannot be fixed in FFmpeg.

comment:2 Changed 3 weeks ago by Rollinnn

So, this is x264 bug and i should report it to x264 developers?

comment:3 Changed 3 weeks ago by cehoyos

Yes.

comment:4 Changed 3 weeks ago by Gramner

convert from HEVC 10 bit to x264 8 bit
-vf "scale=1280:534:flags=lanczos:dst_format=yuv420p"

This does not seem to do what you think it does (no idea if it's the intended behavior or not though. Actually I'm not really sure what the output from that even is). Use -pix_fmt yuv420p instead of dst_format=yuv420p and it works. Just dropping the dst_format produces 10-bit H.264.

*edit* this is not an x264 bug as far as I can see, it's FFmpeg that feeds x264 with invalid data (out-of-range pixels) which causes overflows.

Last edited 3 weeks ago by Gramner (previous) (diff)

comment:5 Changed 3 weeks ago by Gramner

  • Resolution invalid deleted
  • Status changed from closed to reopened
Note: See TracTickets for help on using tickets.