<p>Plays fine here in VLC, ffplay and Potplayer. Doesn't play with mplayer. Its H265 decoder probably doesn't support <code>gray</code>.</p>

<p>Workaround is to store it as YUV420P after discarding the chroma.</p>

<pre><code>ffmpeg -i clip.mkv \
    -vf format=gray,format=yuv420p \
    -c:v libx265 -preset slow -x265-params "crf=24" \
    -c:a libopus -b:a 64k \
    -c:s copy \
    out.mkv
</code></pre>

CC BY-SA 3.0
2017-06-09T13:24:31.060Z
The file size when using -pix_fmt gray is actually a few percent larger than using the workaround by Mulvya. That was unexpected.
netjiro
CC BY-SA 3.0
2017-06-09T11:13:22.583Z
2017-06-09T11:13:22.583Z
Gyan
<p>What am I missing?
I encode an old black and white film clip with ffmpeg libx265 passing -pix_fmt gray. The output is unplayable in both vlc and mplayer (linux), so I assume I'm missing something...</p>

<p>encoding:</p>

<pre><code>ffmpeg -i clip.mkv \
    -c:v libx265 -preset slow -x265-params "crf=24" -pix_fmt gray \
    -c:a libopus -b:a 64k \
    -c:s copy \
    out.mkv
</code></pre>

<p>vlc errors:</p>

<pre><code>[00007f8a3ddfe328] blend blend error: no matching alpha blending routine (chroma: RGBA -&gt; GREY)
[00007f8a3ddfe328] core blend error: blending RGBA to GREY failed
... repeated ...
</code></pre>

<p>mplayer errors:</p>

<pre><code>Unexpected decoder output format Planar Y800
... repeated ...
</code></pre>

<p>ffmpeg encoding output:</p>

<pre><code>ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.9.4 (Gentoo 4.9.4 p1.0, pie-0.6.4)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --docdir=/usr/share/doc/ffmpeg-3.2.4/html --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -O2 -pipe' --disable-static --enable-avfilter --enable-avresample --disable-stripping --enable-nonfree --enable-version3 --disable-indev=oss --disable-indev=jack --disable-outdev=oss --enable-version3 --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-gcrypt --disable-gnutls --disable-gmp --enable-gpl --enable-hardcoded-tables --enable-iconv --enable-lzma --enable-network --enable-openssl --enable-postproc --disable-libsmbclient --enable-ffplay --enable-sdl2 --enable-vaapi --enable-vdpau --enable-xlib --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-zlib --enable-libcdio --disable-libiec61883 --disable-libdc1394 --disable-libcaca --enable-openal --enable-opengl --enable-libv4l2 --disable-libpulse --enable-libopencore-amrwb --enable-libopencore-amrnb --disable-libfdk-aac --enable-libopenjpeg --enable-libbluray --enable-libcelt --disable-libgme --disable-libgsm --disable-mmal --enable-libmodplug --enable-libopus --disable-libilbc --disable-librtmp --enable-libssh --enable-libschroedinger --enable-libspeex --enable-libvorbis --enable-libvpx --disable-libzvbi --disable-libbs2b --disable-chromaprint --disable-libebur128 --disable-libflite --disable-frei0r --disable-libfribidi --enable-fontconfig --disable-ladspa --disable-libass --enable-libfreetype --disable-librubberband --disable-libzimg --enable-libsoxr --enable-pthreads --enable-libvo-amrwbenc --enable-libmp3lame --disable-libkvazaar --disable-nvenc --disable-libopenh264 --enable-libsnappy --enable-libtheora --enable-libtwolame --enable-libwavpack --disable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --disable-amd3dnow --disable-amd3dnowext --disable-fma4 --disable-xop --cpu=host --disable-doc --disable-htmlpages --enable-manpages
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
x265 [info]: HEVC encoder version 2.2
x265 [info]: build info [Linux][GCC 4.9.4][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
x265 [info]: Unknown profile, Level-3.1 (Main tier)
x265 [warning]: No thread pool allocated, --wpp disabled
x265 [warning]: No thread pool allocated, --lookahead-slices disabled
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / none
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         : star / 57 / 3 / 3
x265 [info]: Keyframe min / max / scenecut / bias: 23 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 25 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 4 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-24.0 / 0.60
x265 [info]: tools: rect limit-modes rd=4 psy-rd=2.00 rdoq=2 psy-rdoq=1.00
x265 [info]: tools: rskip signhide tmvp strong-intra-smoothing deblock sao
Output #0, matroska, to 'out.mkv':
  Metadata:
    encoder         : Lavf57.56.101
    Metadata:
    Stream #0:0(eng): Video: hevc (libx265), gray, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 1k tbn, 23.98 tbc (default)
    Metadata:
      encoder         : Lavc57.64.101 libx265
    Stream #0:1(eng): Audio: opus (libopus) ([255][255][255][255] / 0xFFFFFFFF), 48000 Hz, stereo, flt, 64 kb/s (default)
    Metadata:
      encoder         : Lavc57.64.101 libopus
    Stream #0:2(eng): Subtitle: subrip (default)
Stream mapping:
  Stream #0:0 -&gt; #0:0 (h264 (native) -&gt; hevc (libx265))
  Stream #0:1 -&gt; #0:1 (eac3 (native) -&gt; opus (libopus))
  Stream #0:3 -&gt; #0:2 (copy)
Press [q] to stop, [?] for help
frame= 1439 fps=7.0 q=-0.0 Lsize=    5356kB time=00:01:00.01 bitrate= 731.1kbits/s speed=0.294x    
video:4940kB audio:382kB subtitle:1kB other streams:0kB global headers:2kB muxing overhead: 0.629434%
x265 [info]: frame I:      9, Avg QP:22.27  kb/s: 6064.82 
x265 [info]: frame P:    340, Avg QP:23.62  kb/s: 1950.21 
x265 [info]: frame B:   1090, Avg QP:29.65  kb/s: 230.75  
x265 [info]: Weighted P-Frames: Y:0.9% UV:0.0%
x265 [info]: consecutive B-frames: 2.9% 0.3% 1.4% 72.5% 22.9% 
</code></pre>

<ffmpeg><encoding><codec>
encoding with ffmpeg libx265 -pix_fmt gray gives unplayable vid
netjiro
# encoding with ffmpeg libx265 -pix_fmt gray gives unplayable vid

(Asked by: username_0 on 2017-06-09)

What am I missing?
I encode an old black and white film clip with ffmpeg libx265 passing -pix_fmt gray. The output is unplayable in both vlc and mplayer (linux), so I assume I'm missing something...
encoding:
ffmpeg -i clip.mkv \
    -c:v libx265 -preset slow -x265-params "crf=24" -pix_fmt gray \
    -c:a libopus -b:a 64k \
    -c:s copy \
    out.mkv

vlc errors:
[00007f8a3ddfe328] blend blend error: no matching alpha blending routine (chroma: RGBA -> GREY)
[00007f8a3ddfe328] core blend error: blending RGBA to GREY failed
... repeated ...

mplayer errors:
Unexpected decoder output format Planar Y800
... repeated ...

ffmpeg encoding output:
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.9.4 (Gentoo 4.9.4 p1.0, pie-0.6.4)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --docdir=/usr/share/doc/ffmpeg-3.2.4/html --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -O2 -pipe' --disable-static --enable-avfilter --enable-avresample --disable-stripping --enable-nonfree --enable-version3 --disable-indev=oss --disable-indev=jack --disable-outdev=oss --enable-version3 --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-gcrypt --disable-gnutls --disable-gmp --enable-gpl --enable-hardcoded-tables --enable-iconv --enable-lzma --enable-network --enable-openssl --enable-postproc --disable-libsmbclient --enable-ffplay --enable-sdl2 --enable-vaapi --enable-vdpau --enable-xlib --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-zlib --enable-libcdio --disable-libiec61883 --disable-libdc1394 --disable-libcaca --enable-openal --enable-opengl --enable-libv4l2 --disable-libpulse --enable-libopencore-amrwb --enable-libopencore-amrnb --disable-libfdk-aac --enable-libopenjpeg --enable-libbluray --enable-libcelt --disable-libgme --disable-libgsm --disable-mmal --enable-libmodplug --enable-libopus --disable-libilbc --disable-librtmp --enable-libssh --enable-libschroedinger --enable-libspeex --enable-libvorbis --enable-libvpx --disable-libzvbi --disable-libbs2b --disable-chromaprint --disable-libebur128 --disable-libflite --disable-frei0r --disable-libfribidi --enable-fontconfig --disable-ladspa --disable-libass --enable-libfreetype --disable-librubberband --disable-libzimg --enable-libsoxr --enable-pthreads --enable-libvo-amrwbenc --enable-libmp3lame --disable-libkvazaar --disable-nvenc --disable-libopenh264 --enable-libsnappy --enable-libtheora --enable-libtwolame --enable-libwavpack --disable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --disable-amd3dnow --disable-amd3dnowext --disable-fma4 --disable-xop --cpu=host --disable-doc --disable-htmlpages --enable-manpages
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
x265 [info]: HEVC encoder version 2.2
x265 [info]: build info [Linux][GCC 4.9.4][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
x265 [info]: Unknown profile, Level-3.1 (Main tier)
x265 [warning]: No thread pool allocated, --wpp disabled
x265 [warning]: No thread pool allocated, --lookahead-slices disabled
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / none
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         : star / 57 / 3 / 3
x265 [info]: Keyframe min / max / scenecut / bias: 23 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 25 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 4 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-24.0 / 0.60
x265 [info]: tools: rect limit-modes rd=4 psy-rd=2.00 rdoq=2 psy-rdoq=1.00
x265 [info]: tools: rskip signhide tmvp strong-intra-smoothing deblock sao
Output #0, matroska, to 'out.mkv':
  Metadata:
    encoder         : Lavf57.56.101
    Metadata:
    Stream #0:0(eng): Video: hevc (libx265), gray, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 1k tbn, 23.98 tbc (default)
    Metadata:
      encoder         : Lavc57.64.101 libx265
    Stream #0:1(eng): Audio: opus (libopus) ([255][255][255][255] / 0xFFFFFFFF), 48000 Hz, stereo, flt, 64 kb/s (default)
    Metadata:
      encoder         : Lavc57.64.101 libopus
    Stream #0:2(eng): Subtitle: subrip (default)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
  Stream #0:1 -> #0:1 (eac3 (native) -> opus (libopus))
  Stream #0:3 -> #0:2 (copy)
Press [q] to stop, [?] for help
frame= 1439 fps=7.0 q=-0.0 Lsize=    5356kB time=00:01:00.01 bitrate= 731.1kbits/s speed=0.294x    
video:4940kB audio:382kB subtitle:1kB other streams:0kB global headers:2kB muxing overhead: 0.629434%
x265 [info]: frame I:      9, Avg QP:22.27  kb/s: 6064.82 
x265 [info]: frame P:    340, Avg QP:23.62  kb/s: 1950.21 
x265 [info]: frame B:   1090, Avg QP:29.65  kb/s: 230.75  
x265 [info]: Weighted P-Frames: Y:0.9% UV:0.0%
x265 [info]: consecutive B-frames: 2.9% 0.3% 1.4% 72.5% 22.9%

**Tags:** ffmpeg, encoding, codec


---

## 1 answers

### Answer by username_1 on 2017-06-09. Score: 3 | Accepted answer

Plays fine here in VLC, ffplay and Potplayer. Doesn't play with mplayer. Its H265 decoder probably doesn't support gray.
Workaround is to store it as YUV420P after discarding the chroma.
ffmpeg -i clip.mkv \
    -vf format=gray,format=yuv420p \
    -c:v libx265 -preset slow -x265-params "crf=24" \
    -c:a libopus -b:a 64k \
    -c:s copy \
    out.mkv

> **Comments:**
> **username_0**: The file size when using -pix_fmt gray is actually a few percent larger than using the workaround by Mulvya. That was unexpected.  

---

