yuv4mpegpipe input handling broken

Issue #253 closed
Selur created an issue

when using raw output from ffmpeg everything looks fine

ffmpeg -y -loglevel fatal -threads 8 -i "H:\VIDEO0120.mp4" -map 0:0 -an -sn -vsync 0 -pix_fmt yuv420p -f rawvideo - | x265 --preset ultrafast --pmode --pme --input - --input-res 1920x1080 --fps 29.976 --no-open-gop --range limited --colormatrix bt709 --output "H:\Temp\21_31_57_9110_02.265"
yuv  [info]: 1920x1080 fps 29976/1000 i420p8 unknown frame count
raw  [info]: output file: H:\Temp\21_31_57_9110_02.265
x265 [info]: HEVC encoder version 1.9+96-b09998b1256ed8e6
x265 [info]: build info [Windows][GCC 5.3.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: frame threads / pool features       : 3 / wpp(34 rows)+pmode+pme
x265 [info]: Coding QT: max CU size, min CU size : 32 / 16
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : dia / 57 / 0 / 2
x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 0
x265 [info]: Lookahead / bframes / badapt        : 5 / 3 / 0
x265 [info]: b-pyramid / weightp / weightb       : 1 / 0 / 0
x265 [info]: References / ref-limit  cu / depth  : 1 / 0 / 0
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 0.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
x265 [info]: tools: rd=2 psy-rd=2.00 early-skip tmvp fast-intra
x265 [info]: tools: strong-intra-smoothing lslices=6 deblock
x265 [info]: frame I:      5, Avg QP:28.47  kb/s: 57180.35
x265 [info]: frame P:    274, Avg QP:32.15  kb/s: 8148.07
x265 [info]: frame B:    808, Avg QP:35.66  kb/s: 440.82
x265 [info]: consecutive B-frames: 3.2% 0.4% 0.0% 96.4%

encoded 1087 frames in 24.81s (43.81 fps), 2644.58 kb/s, Avg QP:34.

but when using:

ffmpeg -y -loglevel fatal -threads 8 -i "H:\VIDEO0120.mp4" -map 0:0 -an -sn -vsync 0 -pix_fmt yuv420p -f yuv4mpegpipe - | x265 --preset ultrafast --pmode --pme --input - --input-res 1920x1080 --fps 29.976 --no-open-gop --range limited --colormatrix bt709 --output "H:\Temp\21_31_57_9110_02.265"

color space isn't sampled properly uploaded the input (VIDEO0120.mp4) and the output (broken.265) file to my GoogleDrive: https://drive.google.com/folderview?id=0B_WxUS1XGCPASUZibG5XZkRfeTg&usp=sharing

(using 10bit instead of 8bit doesn't help either, when looking at the y4m output of ffmpeg everything looks fine)

Comments (7)

  1. Ma0

    I can confirm this wrong output. The solution is simple -- if you output 'yuv4mpegpipe' from ffmpeg please use only '--y4m -' as input options in x265.

    ffmpeg -y -loglevel fatal -threads 8 -i "..\VIDEO0120.mp4" -map 0:0 -an -sn -vsync 0 -pix_fmt yuv420p -f yuv4mp
    egpipe - | x265 --y4m - --preset ultrafast --pmode --pme --no-open-gop --range limited --colormatrix bt709 --output "new.265"
    y4m  [info]: 1920x1080 fps 89/3 i420p8 sar 1:1 unknown frame count
    raw  [info]: output file: new.265
    x265 [info]: HEVC encoder version 1.9+100-ed744166c37e
    x265 [info]: build info [Windows][MSVC 1900][64 bit] 10bit+8bit
    x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    x265 [info]: Main 10 profile, Level-4 (Main tier)
    x265 [info]: Thread pool created using 4 threads
    x265 [info]: frame threads / pool features       : 2 / wpp(34 rows)+pmode+pme
    x265 [info]: Coding QT: max CU size, min CU size : 32 / 16
    x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
    x265 [info]: ME / range / subpel / merge         : dia / 57 / 0 / 2
    x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 0
    x265 [info]: Lookahead / bframes / badapt        : 5 / 3 / 0
    x265 [info]: b-pyramid / weightp / weightb       : 1 / 0 / 0
    x265 [info]: References / ref-limit  cu / depth  : 1 / 0 / 0
    x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 0.0 / 32 / 1
    x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
    x265 [info]: tools: rd=2 psy-rd=2.00 early-skip tmvp fast-intra
    x265 [info]: tools: strong-intra-smoothing lslices=6 deblock
    x265 [info]: frame I:      5, Avg QP:28.41  kb/s: 56730.31
    x265 [info]: frame P:    274, Avg QP:32.13  kb/s: 8094.33
    x265 [info]: frame B:    808, Avg QP:35.66  kb/s: 432.16
    x265 [info]: consecutive B-frames: 3.2% 0.4% 0.0% 96.4%
    
    encoded 1087 frames in 68.92s (15.77 fps), 2622.53 kb/s, Avg QP:34.74
    
  2. Selur reporter

    will x265 also get bit-depth form the y4m headers or should I still set '--input-depth 10' in case of 10bit input?

  3. Ma0

    You don't need to set '--input-depth'. If you use '-pix_fmt yuv420p' in ffmpeg, the output from ffmpeg is 8-bit. For 10-bit output please use '-strict -1 -pix_fmt yuv420p10' in ffmpeg part, for 12-bit '-strict -1 -pix_fmt yuv420p12'. If your primary source is 10-bit and you don't specify '-pix_fmt' in ffmpeg part, you should add '-strict -1' to ffmpeg to process the source.

  4. Selur reporter

    the ffmpeg part was clear just wanted to know if x265 will get the input-depth from the y4m headers or not. :)

  5. Ma0

    x265 will get the input-depth from the y4m header:

    y4m  [info]: 1920x1080 fps 89/3 i420p12 sar 1:1 unknown frame count
    
  6. Log in to comment