[FFmpeg-trac] #8776(ffmpeg:new): ffmpeg pad filter in_w constant is wrong

FFmpeg trac at avcodec.org
Mon Jul 6 18:15:20 EEST 2020


#8776: ffmpeg pad filter in_w constant is wrong
--------------------------------------+----------------------------------
             Reporter:  abdullah2993  |                     Type:  defect
               Status:  new           |                 Priority:  normal
            Component:  ffmpeg        |                  Version:  4.2
             Keywords:  pad           |               Blocked By:
             Blocking:                |  Reproduced by developer:  0
Analyzed by developer:  0             |
--------------------------------------+----------------------------------
 Summary of the bug:
 with some images when using
 {{{
 -filter_complex "[0:v]pad=iw:ih+10:0:0"
 }}}
 the padded area is less then the input image eventhough we are using iw to
 set the width of the padding
 Sample Image: [https://i.imgur.com/e0ZQdcp.jpg]
 How to reproduce:

 {{{
 ffmpeg.exe -i in.jpg -filter_complex "[0:v]pad=iw:ih+10:0:0" out.jpg
 }}}

 Report log:
 {{{
 ffmpeg started on 2020-07-06 at 20:03:30
 Report written to "ffmpeg-20200706-200330.log"
 Command line:
 "C:\\ProgramData\\chocolatey\\lib\\ffmpeg\\tools\\ffmpeg\\bin\\ffmpeg.exe"
 -i e0ZQdcp.jpg -filter_complex "[0:v]pad=iw:ih+10:0:0"
 _tmp__1594044405775090000_c2769cf415c601ed85d2583664c62104.jpg -report
 ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
   built with gcc 9.1.1 (GCC) 20190807
   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. 31.100 / 56. 31.100
   libavcodec     58. 54.100 / 58. 54.100
   libavformat    58. 29.100 / 58. 29.100
   libavdevice    58.  8.100 / 58.  8.100
   libavfilter     7. 57.100 /  7. 57.100
   libswscale      5.  5.100 /  5.  5.100
   libswresample   3.  5.100 /  3.  5.100
   libpostproc    55.  5.100 / 55.  5.100
 Splitting the commandline.
 Reading option '-i' ... matched as input url with argument 'e0ZQdcp.jpg'.
 Reading option '-filter_complex' ... matched as option 'filter_complex'
 (create a complex filtergraph) with argument '[0:v]pad=iw:ih+10:0:0'.
 Reading option
 '_tmp__1594044405775090000_c2769cf415c601ed85d2583664c62104.jpg' ...
 matched as output url.
 Reading option '-report' ... matched as option 'report' (generate a
 report) with argument '1'.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option filter_complex (create a complex filtergraph) with
 argument [0:v]pad=iw:ih+10:0:0.
 Applying option report (generate a report) with argument 1.
 Successfully parsed a group of options.
 Parsing a group of options: input url e0ZQdcp.jpg.
 Successfully parsed a group of options.
 Opening an input file: e0ZQdcp.jpg.
 [NULL @ 000001b4fba4a500] Opening 'e0ZQdcp.jpg' for reading
 [file @ 000001b4fba4b580] Setting default whitelist 'file,crypto'
 [image2 @ 000001b4fba4a500] Format image2 probed with size=2048 and
 score=50
 [image2 @ 000001b4fba4a500] Before avformat_find_stream_info() pos: 0
 bytes read:12276 seeks:0 nb_streams:1
 [mjpeg @ 000001b4fba5c840] marker=d8 avail_size_in_buf=12274
 [mjpeg @ 000001b4fba5c840] marker parser used 0 bytes (0 bits)
 [mjpeg @ 000001b4fba5c840] marker=db avail_size_in_buf=12272
 [mjpeg @ 000001b4fba5c840] index=0
 [mjpeg @ 000001b4fba5c840] qscale[0]: 1
 [mjpeg @ 000001b4fba5c840] marker parser used 67 bytes (536 bits)
 [mjpeg @ 000001b4fba5c840] marker=db avail_size_in_buf=12203
 [mjpeg @ 000001b4fba5c840] index=1
 [mjpeg @ 000001b4fba5c840] qscale[1]: 1
 [mjpeg @ 000001b4fba5c840] marker parser used 67 bytes (536 bits)
 [mjpeg @ 000001b4fba5c840] marker=c0 avail_size_in_buf=12134
 [mjpeg @ 000001b4fba5c840] Changing bps from 0 to 8
 [mjpeg @ 000001b4fba5c840] sof0: picture: 623x640
 [mjpeg @ 000001b4fba5c840] component 0 2:2 id: 0 quant:0
 [mjpeg @ 000001b4fba5c840] component 1 1:1 id: 1 quant:1
 [mjpeg @ 000001b4fba5c840] component 2 1:1 id: 2 quant:1
 [mjpeg @ 000001b4fba5c840] pix fmt id 22111100
 [mjpeg @ 000001b4fba5c840] Format yuvj420p chosen by get_format().
 [mjpeg @ 000001b4fba5c840] marker parser used 17 bytes (136 bits)
 [mjpeg @ 000001b4fba5c840] marker=c4 avail_size_in_buf=12115
 [mjpeg @ 000001b4fba5c840] marker parser used 0 bytes (0 bits)
 [mjpeg @ 000001b4fba5c840] marker=c4 avail_size_in_buf=12083
 [mjpeg @ 000001b4fba5c840] marker parser used 0 bytes (0 bits)
 [mjpeg @ 000001b4fba5c840] marker=c4 avail_size_in_buf=11988
 [mjpeg @ 000001b4fba5c840] marker parser used 0 bytes (0 bits)
 [mjpeg @ 000001b4fba5c840] marker=c4 avail_size_in_buf=11960
 [mjpeg @ 000001b4fba5c840] marker parser used 0 bytes (0 bits)
 [mjpeg @ 000001b4fba5c840] escaping removed 74 bytes
 [mjpeg @ 000001b4fba5c840] marker=da avail_size_in_buf=11921
 [mjpeg @ 000001b4fba5c840] marker parser used 11847 bytes (94776 bits)
 [mjpeg @ 000001b4fba5c840] marker=d9 avail_size_in_buf=0
 [mjpeg @ 000001b4fba5c840] decode frame unused 0 bytes
 [image2 @ 000001b4fba4a500] After avformat_find_stream_info() pos: 12276
 bytes read:12276 seeks:0 frames:1
 Input #0, image2, from 'e0ZQdcp.jpg':
   Duration: 00:00:00.04, start: 0.000000, bitrate: 2455 kb/s
     Stream #0:0, 1, 1/25: Video: mjpeg (Baseline), yuvj420p(pc,
 bt470bg/unknown/unknown), 623x640, 25 tbr, 25 tbn, 25 tbc
 Successfully opened the file.
 [Parsed_pad_0 @ 000001b4fba5ce40] Setting 'width' to value 'iw'
 [Parsed_pad_0 @ 000001b4fba5ce40] Setting 'height' to value 'ih+10'
 [Parsed_pad_0 @ 000001b4fba5ce40] Setting 'x' to value '0'
 [Parsed_pad_0 @ 000001b4fba5ce40] Setting 'y' to value '0'
 Parsing a group of options: output url
 _tmp__1594044405775090000_c2769cf415c601ed85d2583664c62104.jpg.
 Successfully parsed a group of options.
 Opening an output file:
 _tmp__1594044405775090000_c2769cf415c601ed85d2583664c62104.jpg.
 Successfully opened the file.
 Stream mapping:
   Stream #0:0 (mjpeg) -> pad
   pad -> Stream #0:0 (mjpeg)
 Press [q] to stop, [?] for help
 cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
 if it occurs once at the start per stream)
 [mjpeg @ 000001b4fba54380] marker=d8 avail_size_in_buf=12274
 [mjpeg @ 000001b4fba54380] marker parser used 0 bytes (0 bits)
 [mjpeg @ 000001b4fba54380] marker=db avail_size_in_buf=12272
 [mjpeg @ 000001b4fba54380] index=0
 [mjpeg @ 000001b4fba54380] qscale[0]: 1
 [mjpeg @ 000001b4fba54380] marker parser used 67 bytes (536 bits)
 [mjpeg @ 000001b4fba54380] marker=db avail_size_in_buf=12203
 [mjpeg @ 000001b4fba54380] index=1
 [mjpeg @ 000001b4fba54380] qscale[1]: 1
 [mjpeg @ 000001b4fba54380] marker parser used 67 bytes (536 bits)
 [mjpeg @ 000001b4fba54380] marker=c0 avail_size_in_buf=12134
 [mjpeg @ 000001b4fba54380] sof0: picture: 623x640
 [mjpeg @ 000001b4fba54380] component 0 2:2 id: 0 quant:0
 [mjpeg @ 000001b4fba54380] component 1 1:1 id: 1 quant:1
 [mjpeg @ 000001b4fba54380] component 2 1:1 id: 2 quant:1
 [mjpeg @ 000001b4fba54380] pix fmt id 22111100
 [mjpeg @ 000001b4fba54380] Format yuvj420p chosen by get_format().
 [mjpeg @ 000001b4fba54380] marker parser used 17 bytes (136 bits)
 [mjpeg @ 000001b4fba54380] marker=c4 avail_size_in_buf=12115
 [mjpeg @ 000001b4fba54380] class=0 index=0 nb_codes=11
 [mjpeg @ 000001b4fba54380] marker parser used 30 bytes (240 bits)
 [mjpeg @ 000001b4fba54380] marker=c4 avail_size_in_buf=12083
 [mjpeg @ 000001b4fba54380] class=1 index=0 nb_codes=214
 [mjpeg @ 000001b4fba54380] marker parser used 93 bytes (744 bits)
 [mjpeg @ 000001b4fba54380] marker=c4 avail_size_in_buf=11988
 [mjpeg @ 000001b4fba54380] class=0 index=1 nb_codes=8
 [mjpeg @ 000001b4fba54380] marker parser used 26 bytes (208 bits)
 [mjpeg @ 000001b4fba54380] marker=c4 avail_size_in_buf=11960
 [mjpeg @ 000001b4fba54380] class=1 index=1 nb_codes=82
 [mjpeg @ 000001b4fba54380] marker parser used 37 bytes (296 bits)
 [mjpeg @ 000001b4fba54380] escaping removed 74 bytes
 [mjpeg @ 000001b4fba54380] marker=da avail_size_in_buf=11921
 [mjpeg @ 000001b4fba54380] component: 0
 [mjpeg @ 000001b4fba54380] component: 1
 [mjpeg @ 000001b4fba54380] component: 2
 [mjpeg @ 000001b4fba54380] marker parser used 11846 bytes (94765 bits)
 [mjpeg @ 000001b4fba54380] marker=d9 avail_size_in_buf=0
 [mjpeg @ 000001b4fba54380] decode frame unused 0 bytes
 detected 12 logical cores
 [Parsed_pad_0 @ 000001b4fba59780] Setting 'width' to value 'iw'
 [Parsed_pad_0 @ 000001b4fba59780] Setting 'height' to value 'ih+10'
 [Parsed_pad_0 @ 000001b4fba59780] Setting 'x' to value '0'
 [Parsed_pad_0 @ 000001b4fba59780] Setting 'y' to value '0'
 [graph 0 input from stream 0:0 @ 000001b4fba5c0c0] Setting 'video_size' to
 value '623x640'
 [graph 0 input from stream 0:0 @ 000001b4fba5c0c0] Setting 'pix_fmt' to
 value '12'
 [graph 0 input from stream 0:0 @ 000001b4fba5c0c0] Setting 'time_base' to
 value '1/25'
 [graph 0 input from stream 0:0 @ 000001b4fba5c0c0] Setting 'pixel_aspect'
 to value '0/1'
 [graph 0 input from stream 0:0 @ 000001b4fba5c0c0] Setting 'sws_param' to
 value 'flags=2'
 [graph 0 input from stream 0:0 @ 000001b4fba5c0c0] Setting 'frame_rate' to
 value '25/1'
 [graph 0 input from stream 0:0 @ 000001b4fba5c0c0] w:623 h:640
 pixfmt:yuvj420p tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
 [format @ 000001b4fbb07980] Setting 'pix_fmts' to value
 'yuvj420p|yuvj422p|yuvj444p'
 [AVFilterGraph @ 000001b4fba59680] query_formats: 4 queried, 3 merged, 0
 already done, 0 delayed
 [Parsed_pad_0 @ 000001b4fba59780] w:623 h:640 -> w:622 h:650 x:0 y:0
 color:0x000000FF
 [Parsed_pad_0 @ 000001b4fba59780] Input area 0:0:623:640 not within the
 padded area 0:0:622:650 or zero-sized
 [Parsed_pad_0 @ 000001b4fba59780] Failed to configure input pad on
 Parsed_pad_0
 Error reinitializing filters!
 Failed to inject frame into filter network: Invalid argument
 Error while processing the decoded data for stream #0:0
 [AVIOContext @ 000001b4fba53800] Statistics: 12276 bytes read, 0 seeks
 Conversion failed!

 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8776>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list