[FFmpeg-user] Problem: extracted alpha plane from a grayscale PNG is shifted by 1 pixel to the left

Mikhail V mikhailwas at gmail.com
Sun Apr 7 03:17:59 EEST 2019


I have a strange problem with extracting alpha plane from an grayscale
PNG with alpha channel.
So I have an image with alpha in it and use this command:

ffmpeg -i 1-open-patch.png  -vf alphaextract   -pix_fmt gray  testgray_alpha.png
or
ffmpeg -i 1-open-patch.png  -vf alphaextract   testgray_alpha.png
(wich works same way I think)

Problem:  the output alpha plane is shifted 1 pixel to the left. The
data is ok - but the position is 1 pixel shifted.
The problem appears only with ya8 pixel format. If I use same but RGBa
image the output plane is correctly positioned.

Windows 10 latest build

Console  output:

ffmpeg -i 1-open-patch.png  -vf alphaextract  testgray_alpha.png
ffmpeg version N-93532-g772c73e61f Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20190212
  configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libdav1d --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 --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 48.101 / 58. 48.101
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, png_pipe, from '1-open-patch.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, ya8(pc), 800x600 [SAR 2835:2835 DAR 4:3],
25 tbr, 25 tbn, 25 tbc
File 'testgray_alpha.png' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to 'testgray_alpha.png':
  Metadata:
    encoder         : Lavf58.26.101
    Stream #0:0: Video: png, gray, 800x600 [SAR 2835:2835 DAR 4:3],
q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.48.101 png
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.853x
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown



Mikhail


More information about the ffmpeg-user mailing list