2pass crash when --pme is used,...

Issue #213 resolved
Selur created an issue

Took me a while to track it down, but from the looks of it as soon as I use '--pme' in combination with 2pass encoding the encoding crashes after a while.

x265 --input - --input-res 720x372 --fps 24 --no-high-tier --tu-intra-depth 2 --tu-inter-depth 2 --limit-modes --max-merge 3 --no-open-gop --bframes 8 --weightb --b-intra --rc-lookahead 30 --pass 1 --bitrate 1803 --ipratio 1.1 --pbratio 1.1 --psy-rd 0.50 --qcomp 0.8 --aq-strength 0.30 --vbv-init 0.9 --deblock=-2:-2 --range limited --colormatrix bt470bg --stats "H:\Temp\encounters-garmwarsdldruidrpk_1080p_06_48_26_6310_07.stats" --output NUL x265 --preset slower --input - --input-res 720x372 --fps 24 --no-high-tier --limit-modes --no-open-gop --pass 2 --bitrate 1803 --ipratio 1.1 --pbratio 1.1 --psy-rd 0.50 --qcomp 0.8 --aq-strength 0.30 --vbv-init 0.9 --deblock=-2:-2 --range limited --colormatrix bt470bg --stats "H:\Temp\encounters-garmwarsdldruidrpk_1080p_06_48_26_6310_07.stats" --output "H:\Temp\06_48_26_6310_08.265"

Problem is it only happens after a while and I couldn't reproduce it with short samples.

Comments (11)

  1. Ma0

    There are many crash reports from people with AVX2 CPU. Could you add extra option '--asm AVX' or '--asm SSE4.2' and report back if the crash still exists?

  2. Deepthi Nandakumar

    Not aware of any pending issues with AVX2. Hmm, pme with 2-pass may have race issues, not sure.

    Thanks for your patience - the Chennai development team has been thrown out of gear with floods.

  3. Selur reporter

    Adding -asm AVX' or '--asm SSE4.2' doesn't help. Encoding always crashes during the 2nd pass. Only thing that reliably seems to help is to disable '--pmode' and 'pme'. btw. I did update to the latest version: G:\Hybrid>x265.exe --version x265 [info]: HEVC encoder version 1.8+167-e951ab673b1c x265 [info]: build info [Windows][GCC 5.2.0][64 bit] 8bit+10bit+12bit x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2

  4. Ma0

    I've tried to reproduce this crash but I've encoded whole movie and nothing.

    i:\speed\s>ffmpeg -i g.avi -loglevel fatal -vf scale=720x372,setsar=1/1 -sws_flags lanczos -f yuv4mpegpipe - | x265 --y4m - --no
    -high-tier --tu-intra-depth 2 --tu-inter-depth 2 --limit-modes --max-merge 3 --no-open-gop --bframes 8 --weightb --b-intra --rc-
    lookahead 30 --pass 1 --bitrate 1803 --ipratio 1.1 --pbratio 1.1 --psy-rd 0.50 --qcomp 0.8 --aq-strength 0.30 --vbv-init 0.9 --d
    eblock=-2:-2 --range limited --colormatrix bt470bg --stats "H:\Temp\encounters-garmwarsdldruidrpk_1080p_06_48_26_6310_07.stats"
    --output NUL
    y4m  [info]: 720x372 fps 25/1 i420p8 sar 1:1 unknown frame count
    raw  [info]: output file: NUL
    x265 [info]: HEVC encoder version 1.8+167-e951ab673b1c
    x265 [info]: build info [Windows][GCC 5.2.0][64 bit] 8bit
    x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    x265 [info]: Main profile, Level-3 (Main tier)
    x265 [info]: Thread pool created using 4 threads
    x265 [info]: frame threads / pool features       : 2 / wpp(6 rows)
    x265 [warning]: Source height < 720p; disabling lookahead-slices
    x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
    x265 [info]: Residual QT: max TU size, max depth : 32 / 2 inter / 2 intra
    x265 [info]: ME / range / subpel / merge         : dia / 57 / 2 / 1
    x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 40
    x265 [info]: Lookahead / bframes / badapt        : 30 / 8 / 2
    x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 1
    x265 [info]: References / ref-limit  cu / depth  : 1 / 0 / 0
    x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 0.3 / 32 / 1
    x265 [info]: Rate Control / qCompress            : ABR-1803 kbps / 0.80
    x265 [info]: tools: limit-modes rd=2 psy-rd=0.50 early-skip signhide tmvp
    x265 [info]: tools: b-intra fast-intra strong-intra-smoothing
    x265 [info]: tools: deblock(tC=-2:B=-2) sao stats-write
    x265 [info]: frame I:    744, Avg QP:15.31  kb/s: 6786.98
    x265 [info]: frame P:  30319, Avg QP:15.47  kb/s: 3679.62
    x265 [info]: frame B:  84053, Avg QP:18.16  kb/s: 1052.53
    x265 [info]: Weighted P-Frames: Y:1.5% UV:1.0%
    x265 [info]: Weighted B-Frames: Y:1.2% UV:0.9%
    x265 [info]: consecutive B-frames: 3.7% 9.9% 2.0% 82.4% 0.9% 0.8% 0.1% 0.2% 0.0%
    
    encoded 115116 frames in 2551.32s (45.12 fps), 1781.51 kb/s, Avg QP:17.43
    
    i:\speed\s>ffmpeg -i g.avi -loglevel fatal -vf scale=720x372,setsar=1/1 -sws_flags lanczos -f yuv4mpegpipe - | x265 --preset slo
    wer --y4m - --no-high-tier --limit-modes --no-open-gop --pass 2 --bitrate 1803 --ipratio 1.1 --pbratio 1.1 --psy-rd 0.50 --qcomp
     0.8 --aq-strength 0.30 --vbv-init 0.9 --deblock=-2:-2 --range limited --colormatrix bt470bg --stats "H:\Temp\encounters-garmwar
    sdldruidrpk_1080p_06_48_26_6310_07.stats" --output "H:\Temp\06_48_26_6310_08.265"
    y4m  [info]: 720x372 fps 25/1 i420p8 sar 1:1 unknown frame count
    raw  [info]: output file: H:\Temp\06_48_26_6310_08.265
    x265 [info]: HEVC encoder version 1.8+167-e951ab673b1c
    x265 [info]: build info [Windows][GCC 5.2.0][64 bit] 8bit
    x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    x265 [info]: Main profile, Level-3 (Main tier)
    x265 [info]: Thread pool created using 4 threads
    x265 [info]: frame threads / pool features       : 2 / wpp(6 rows)
    x265 [warning]: Source height < 720p; disabling lookahead-slices
    x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
    x265 [info]: Residual QT: max TU size, max depth : 32 / 2 inter / 2 intra
    x265 [info]: ME / range / subpel / merge         : star / 57 / 3 / 3
    x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 40
    x265 [info]: Lookahead / bframes / badapt        : 30 / 8 / 2
    x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 1
    x265 [info]: References / ref-limit  cu / depth  : 3 / 0 / 0
    x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 0.3 / 32 / 1
    x265 [info]: Rate Control / qCompress            : ABR-1803 kbps / 0.80
    x265 [info]: tools: rect amp limit-modes rd=6 psy-rd=0.50 rdoq=2 psy-rdoq=1.00
    x265 [info]: tools: signhide tmvp b-intra strong-intra-smoothing
    x265 [info]: tools: deblock(tC=-2:B=-2) sao stats-read
    x265 [info]: frame I:    744, Avg QP:14.96  kb/s: 6323.20
    x265 [info]: frame P:  30319, Avg QP:15.55  kb/s: 3741.63
    x265 [info]: frame B:  84053, Avg QP:18.36  kb/s: 1063.41
    x265 [info]: Weighted P-Frames: Y:0.7% UV:0.4%
    x265 [info]: Weighted B-Frames: Y:0.3% UV:0.1%
    x265 [info]: consecutive B-frames: 3.7% 9.9% 2.0% 82.4% 0.9% 0.8% 0.1% 0.2% 0.0%
    
    encoded 115116 frames in 32583.77s (3.53 fps), 1802.78 kb/s, Avg QP:17.60
    

    Can you reproduce this crash without avisynth (only ffmpeg & x265)?

  5. Deepthi Nandakumar

    Agreed - our team has also been trying from x265 commandline and failed to reproduce this.

  6. Selur reporter

    Will try to reproduce it without avisynth. ( doubt this is avisynth related since then I would be confused why it does work when --pme and --pmode is not enabled) Another thing I have noticed, is that this doesn't happen with all sources.

  7. Mahesh Pittala

    I have tested with few sequences but couldn't reproduce crash, Are you able to reproduce without avisynth?

  8. Selur reporter

    Also did some more tests and it seems like Avisynth + pme&pmode cause the problem on some sources. So encoding works fine if I either don't use avisynth or disable pme&pmode.

  9. Log in to comment