[FFmpeg-user] remap filter, unmapped pixels

Paul B Mahol onemda at gmail.com
Thu Feb 20 14:14:24 EET 2020


On 2/20/20, Michael Koch <astroelectronic at t-online.de> wrote:
> Am 20.02.2020 um 12:49 schrieb Paul B Mahol:
>> On 2/20/20, Michael Koch <astroelectronic at t-online.de> wrote:
>>> Am 20.02.2020 um 11:07 schrieb Paul B Mahol:
>>>> On 2/20/20, Michael Koch <astroelectronic at t-online.de> wrote:
>>>>> I'd like to understand how the new "fill" option in the remap filter
>>>>> works.
>>>>> What is an "unmapped pixel"? How is it possible that pixels are
>>>>> unmapped, if the xmap and ymap files have the same size as the output
>>>>> image? Is a pixel "unmapped" if it has invalid coordinates (negative or
>>>>> too big) in the xmap or ymap files?
>>>> Previously all unmapped pixels were set to black for rgba or dark
>>>> green for y420p.
>>>> It is very obvious to understand even for every little kid in the block.
>>> Finally I got it working. A pixel can be declared as "unmapped" by
>>> setting the values to 65535 in the xmap and ymap files. However using a
>>> negative value (for example -1) doesn't work. In this case the pixel is
>>> mapped to the top left pixel of the input image.
>>> This behaviour might be obvious for little kids, but not for me. Should
>>> be added to documentation.
>> Nope. Documentation does not need trivial information.
>> Obviously by having even limited programming experience one would
>> found out that remaps are unsigned short, thus can not be negative.
>> You never showed your map files. so I assume everything is wrong on
>> your end.
>
> This is an example that produces a crash abort in the third command
> line. All pixels are mapped to themselves, except pixel (1,1) which is
> mapped to (65535,65535)
>
> c:\ffmpeg\ffmpeg -f lavfi -i nullsrc=size=20x20 -vf
> format=pix_fmts=gray16le,geq='if(bitand(eq(X,1),eq(Y,1)),65535,X)'
> -frames 1 -y xmap.pgm
> c:\ffmpeg\ffmpeg -f lavfi -i nullsrc=size=20x20 -vf
> format=pix_fmts=gray16le,geq='if(bitand(eq(X,1),eq(Y,1)),65535,Y)'
> -frames 1 -y ymap.pgm
> c:\ffmpeg\ffmpeg -f lavfi -i color=blue:size=20x20 -i xmap.pgm -i
> ymap.pgm -lavfi "format=pix_fmts=rgb24,remap=fill=red" -frames 1 -y out.png
>
> Console output for third command line:
>
> F:\Wormhole_2020>c:\ffmpeg\ffmpeg -f lavfi -i color=blue:size=20x20 -i
> xmap.pgm
> -i ymap.pgm -lavfi "format=pix_fmts=rgb24,remap=fill=red" -frames 1 -y
> out.png
> ffmpeg version git-2020-02-18-ebee808 Copyright (c) 2000-2020 the FFmpeg
> develop
> ers
>    built with gcc 9.2.1 (GCC) 20200122
>    configuration: --enable-gpl --enable-version3 --enable-sdl2
> --enable-fontconfi
> g --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d
> --enable-libb
> luray --enable-libfreetype --enable-libmp3lame
> --enable-libopencore-amrnb --enab
> le-libopencore-amrwb --enable-libopenjpeg --enable-libopus
> --enable-libshine --e
> nable-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 --enab
> le-libvidstab --enable-libvorbis --enable-libvo-amrwbenc
> --enable-libmysofa --en
> able-libspeex --enable-libxvid --enable-libaom --enable-libmfx
> --enable-ffnvcode
> c --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec
> --enable-dxva2 -
> -enable-avisynth --enable-libopenmpt --enable-amf
>    libavutil      56. 41.100 / 56. 41.100
>    libavcodec     58. 70.100 / 58. 70.100
>    libavformat    58. 38.101 / 58. 38.101
>    libavdevice    58.  9.103 / 58.  9.103
>    libavfilter     7. 76.100 /  7. 76.100
>    libswscale      5.  6.100 /  5.  6.100
>    libswresample   3.  6.100 /  3.  6.100
>    libpostproc    55.  6.100 / 55.  6.100
> Input #0, lavfi, from 'color=blue:size=20x20':
>    Duration: N/A, start: 0.000000, bitrate: N/A
>      Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 20x20
> [SAR 1:1 DA
> R 1:1], 25 tbr, 25 tbn, 25 tbc
> Input #1, pgm_pipe, from 'xmap.pgm':
>    Duration: N/A, bitrate: N/A
>      Stream #1:0: Video: pgm, gray16le, 20x20, 25 tbr, 25 tbn, 25 tbc
> Input #2, pgm_pipe, from 'ymap.pgm':
>    Duration: N/A, bitrate: N/A
>      Stream #2:0: Video: pgm, gray16le, 20x20, 25 tbr, 25 tbn, 25 tbc
> Stream mapping:
>    Stream #0:0 (rawvideo) -> format
>    Stream #1:0 (pgm) -> remap:xmap
>    Stream #2:0 (pgm) -> remap:ymap
>    remap -> Stream #0:0 (png)
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


Not remap bug, please report this swscale bug on trac.


More information about the ffmpeg-user mailing list