[FFmpeg-trac] #8922(undetermined:new): Effect of framerate Filter on an Image Source

FFmpeg trac at avcodec.org
Wed Oct 7 21:09:03 EEST 2020


#8922: Effect of framerate Filter on an Image Source
-------------------------------------+-------------------------------------
             Reporter:               |                     Type:  defect
  richardgravy                       |
               Status:  new          |                 Priority:  minor
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Hello,
 I was trying to accomplish something in a downstream project (mpv) and was
 having trouble.  It was suggested to me to try the a similar action
 against ffmpeg directly and it has the same behaviour.
 I'm not sure if this is a bug or simply undocumented behaviour.

 My task:-
 Generate video output from horizontally panning across an image larger
 than the display.

 Source:-
 An image file (JPEG/PNG), ideally larger than 1920x1080.

 Problem:-
 Image files are treated as single-frame videos with a default fps of 25.
 Applying a filter such as
 "crop=1920:1200:[st\(0,479\)\;ld\(0\)-abs\(mod\(n,2*ld\(0\)\)-ld\(0\)\)]:0"
 results in a single frame of output.

 Solution:-
 Duplicate the frame for the required duration.

 Whilst trying to find the solution, I inserted the framerate filter ahead
 of the crop, as the filters documentation indicated that it could
 duplicate frames (if the new rate is higher).

 Upon trying this, I found that the duration became unbounded; the filter
 produces infinite frames.

 I was able to reproduce this without involving the crop filter, as simply
 as the following:-

 ffmpeg -i http://trac.ffmpeg.org/ffmpeg-logo.png -vf framerate -map 0:v -f
 null -

 If this is "expected", is there an easy way to limit the filter's output?
 I know about the "-t" argument, but that is specific to the ffmpeg
 frontend.

 Log Output (from Fedora 31 packaged version):-
 ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
   built with gcc 9 (GCC)
   configuration: --prefix=/usr --bindir=/usr/bin
 --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg
 --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man
 --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security
 -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-
 protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-
 hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64
 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-
 protection' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now
 -specs=/usr/lib/rpm/redhat/redhat-hardened-ld ' --extra-cflags=' '
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-
 amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-
 fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa
 --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray
 --enable-libcdio --enable-libdrm --enable-libjack --enable-libfreetype
 --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc
 --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg
 --enable-libopus --enable-libpulse --enable-librsvg --enable-libsrt
 --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora
 --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf
 --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid
 --enable-libzimg --enable-libzvbi --enable-avfilter --enable-avresample
 --enable-postproc --enable-pthreads --disable-static --enable-shared
 --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64
 --enable-libmfx --enable-runtime-cpudetect
   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
   libavresample   4.  0.  0 /  4.  0.  0
   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 '-v' ... matched as option 'v' (set logging level) with
 argument '9'.
 Reading option '-loglevel' ... matched as option 'loglevel' (set logging
 level) with argument '99'.
 Reading option '-i' ... matched as input url with argument
 'http://trac.ffmpeg.org/ffmpeg-logo.png'.
 Reading option '-vf' ... matched as option 'vf' (set video filters) with
 argument 'framerate'.
 Reading option '-map' ... matched as option 'map' (set input stream
 mapping) with argument '0:v'.
 Reading option '-f' ... matched as option 'f' (force format) with argument
 'null'.
 Reading option '-' ... matched as output url.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option v (set logging level) with argument 9.
 Successfully parsed a group of options.
 Parsing a group of options: input url http://trac.ffmpeg.org/ffmpeg-
 logo.png.
 Successfully parsed a group of options.
 Opening an input file: http://trac.ffmpeg.org/ffmpeg-logo.png.
 [NULL @ 0x555a03ca0d00] Opening 'http://trac.ffmpeg.org/ffmpeg-logo.png'
 for reading
 [http @ 0x555a03ca1780] Setting default whitelist
 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
 [tcp @ 0x555a03ca3600] Original list of addresses:
 [tcp @ 0x555a03ca3600] Address 79.124.17.101 port 80
 [tcp @ 0x555a03ca3600] Interleaved list of addresses:
 [tcp @ 0x555a03ca3600] Address 79.124.17.101 port 80
 [tcp @ 0x555a03ca3600] Starting connection attempt to 79.124.17.101 port
 80
 [tcp @ 0x555a03ca3600] Successfully connected to 79.124.17.101 port 80
 [http @ 0x555a03ca1780] request: GET /ffmpeg-logo.png HTTP/1.1
 User-Agent: Lavf/58.29.100
 Accept: */*
 Range: bytes=0-
 Connection: close
 Host: trac.ffmpeg.org
 Icy-MetaData: 1


 [http @ 0x555a03ca1780] header='HTTP/1.1 206 Partial Content'
 [http @ 0x555a03ca1780] http_code=206
 [http @ 0x555a03ca1780] header='Date: Wed, 07 Oct 2020 18:01:42 GMT'
 [http @ 0x555a03ca1780] header='Server: Apache/2.4.18 (Ubuntu)'
 [http @ 0x555a03ca1780] header='X-Frame-Options: SAMEORIGIN'
 [http @ 0x555a03ca1780] header='Last-Modified: Sun, 24 Nov 2013 12:56:54
 GMT'
 [http @ 0x555a03ca1780] header='ETag: "2217-4ebebc81c9180"'
 [http @ 0x555a03ca1780] header='Accept-Ranges: bytes'
 [http @ 0x555a03ca1780] header='Content-Length: 8727'
 [http @ 0x555a03ca1780] header='Content-Range: bytes 0-8726/8727'
 [http @ 0x555a03ca1780] header='Connection: close'
 [http @ 0x555a03ca1780] header='Content-Type: image/png'
 [http @ 0x555a03ca1780] header=''
 Probing image2 score:50 size:2048
 Probing png_pipe score:99 size:2048
 [png_pipe @ 0x555a03ca0d00] Format png_pipe probed with size=2048 and
 score=99
 [png_pipe @ 0x555a03ca0d00] Before avformat_find_stream_info() pos: 0
 bytes read:3770 seeks:0 nb_streams:1
 [png_pipe @ 0x555a03ca0d00] stream 0: start_time: -368934881474191040.000
 duration: -368934881474191040.000
 [png_pipe @ 0x555a03ca0d00] format: start_time: -9223372036854.775
 duration: -9223372036854.775 bitrate=0 kb/s
 [png_pipe @ 0x555a03ca0d00] After avformat_find_stream_info() pos: 8727
 bytes read:8727 seeks:0 frames:1
 Input #0, png_pipe, from 'http://trac.ffmpeg.org/ffmpeg-logo.png':
   Duration: N/A, bitrate: N/A
     Stream #0:0, 1, 1/25: Video: png, 1 reference frame, rgba(pc),
 396x100, 0/1, 25 tbr, 25 tbn, 25 tbc
 Successfully opened the file.
 Parsing a group of options: output url -.
 Applying option vf (set video filters) with argument framerate.
 Applying option map (set input stream mapping) with argument 0:v.
 Applying option f (force format) with argument null.
 Successfully parsed a group of options.
 Opening an output file: -.
 Successfully opened the file.
 detected 4 logical cores
 Stream mapping:
   Stream #0:0 -> #0:0 (png (native) -> wrapped_avframe (native))
 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)
     Last message repeated 1 times
 [graph 0 input from stream 0:0 @ 0x555a03cc0b00] Setting 'video_size' to
 value '396x100'
 [graph 0 input from stream 0:0 @ 0x555a03cc0b00] Setting 'pix_fmt' to
 value '26'
 [graph 0 input from stream 0:0 @ 0x555a03cc0b00] Setting 'time_base' to
 value '1/25'
 [graph 0 input from stream 0:0 @ 0x555a03cc0b00] Setting 'pixel_aspect' to
 value '0/1'
 [graph 0 input from stream 0:0 @ 0x555a03cc0b00] Setting 'sws_param' to
 value 'flags=2'
 [graph 0 input from stream 0:0 @ 0x555a03cc0b00] Setting 'frame_rate' to
 value '25/1'
 [graph 0 input from stream 0:0 @ 0x555a03cc0b00] w:396 h:100 pixfmt:rgba
 tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
 [auto_scaler_0 @ 0x555a03cc3000] Setting 'flags' to value 'bicubic'
 [auto_scaler_0 @ 0x555a03cc3000] w:iw h:ih flags:'bicubic' interl:0
 [Parsed_framerate_0 @ 0x555a03cc0600] auto-inserting filter
 'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' and the
 filter 'Parsed_framerate_0'
 [AVFilterGraph @ 0x555a03cab400] query_formats: 3 queried, 1 merged, 1
 already done, 0 delayed
 [auto_scaler_0 @ 0x555a03cc3000] picking yuv444p out of 20 ref:rgba
 alpha:1
 [auto_scaler_0 @ 0x555a03cc3000] w:396 h:100 fmt:rgba sar:0/1 -> w:396
 h:100 fmt:yuv444p sar:0/1 flags:0x4
 [Parsed_framerate_0 @ 0x555a03cc0600] config_output()
 [Parsed_framerate_0 @ 0x555a03cc0600] config_output() input time base:1/25
 (0.040000)
 [Parsed_framerate_0 @ 0x555a03cc0600] time base:1/25 -> 1/50 exact:1
 [Parsed_framerate_0 @ 0x555a03cc0600] config_output() output time
 base:1/50 (0.020000) w:0 h:0
 [Parsed_framerate_0 @ 0x555a03cc0600] fps -> fps:50/1 scene score:8.200000
 interpolate start:15 end:240
 Output #0, null, to 'pipe:':
   Metadata:
     encoder         : Lavf58.29.100
     Stream #0:0, 0, 1/50: Video: wrapped_avframe, 1 reference frame,
 yuv444p, 396x100, 0/1, q=2-31, 200 kb/s, 50 fps, 50 tbn, 50 tbc
     Metadata:
       encoder         : Lavc58.54.100 wrapped_avframe
 cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless
 if it occurs once at the start per stream)
     Last message repeated 1 times
 frame=116611 fps=0.0 q=-0.0 size=N/A time=00:38:52.22 bitrate=N/A
 speed=4.66e+03x
 frame=241634 fps=241633 q=-0.0 size=N/A time=01:20:32.68 bitrate=N/A
 speed=4.83e+03x
 frame=368854 fps=245902 q=-0.0 size=N/A time=02:02:57.08 bitrate=N/A
 speed=4.92e+03x
 frame=495932 fps=247965 q=-0.0 size=N/A time=02:45:18.64 bitrate=N/A
 speed=4.96e+03x
 frame=623023 fps=249208 q=-0.0 size=N/A time=03:27:40.46 bitrate=N/A
 speed=4.98e+03x
 frame=750524 fps=250173 q=-0.0 size=N/A time=04:10:10.48 bitrate=N/A
 speed=5e+03x
 frame=878364 fps=250959 q=-0.0 size=N/A time=04:52:47.28 bitrate=N/A
 speed=5.02e+03x
 frame=1005924 fps=251479 q=-0.0 size=N/A time=05:35:18.48 bitrate=N/A
 speed=5.03e+03x
 frame=1031312 fps=251533 q=-0.0 Lsize=N/A time=05:43:46.24 bitrate=N/A
 speed=5.03e+03x
 video:539827kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: unknown
 Input file #0 (http://trac.ffmpeg.org/ffmpeg-logo.png):
   Input stream #0:0 (video): 1 packets read (8727 bytes); 1 frames
 decoded;
   Total: 1 packets (8727 bytes) demuxed
 Output file #0 (pipe:):
   Output stream #0:0 (video): 1031312 frames encoded; 1031312 packets
 muxed (552783232 bytes);
   Total: 1031312 packets (552783232 bytes) muxed
 1 frames successfully decoded, 0 decoding errors
 [AVIOContext @ 0x555a03cad280] Statistics: 8727 bytes read, 0 seeks

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


More information about the FFmpeg-trac mailing list