Opened 10 years ago

Last modified 2 months ago

#4298 open defect

zoompan filter creates shaky image

Reported by: slhck Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: zoompan swscale
Cc: MasterQuestionable Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:

When using the zoompan filter and setting any x or y (or both) value, the effect is shaky and jerky.

How to reproduce:

 ffmpeg -framerate 25 -loop 1 -i in.jpg -vf "zoompan=z='min(zoom+0.0015,1.4)':x=50:d=150" -t 6 -s 640x380 out.mp4
ffmpeg version N-69568-g21051af Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 18.100 / 54. 18.100
  libavcodec     56. 21.102 / 56. 21.102
  libavformat    56. 19.100 / 56. 19.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5.  9.103 /  5.  9.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[mjpeg @ 0000000000342a60] ignoring invalid SAR: 540/409
Input #0, image2, from 'out.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 3236 kb/s
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 640x360, 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'out.mp4' already exists. Overwrite ? [y/N] y
[swscaler @ 0000000000307fe0] deprecated pixel format used, make sure you did set range correctly
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0000000004cf00a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000004cf00a0] profile High, level 3.0
[libx264 @ 0000000004cf00a0] 264 - core 144 r2525 40bb568 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf56.19.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 640x360, q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.21.102 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 0000000004ca5f80] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 1 times
[swscaler @ 0000000004ca5f80] Warning: data is not aligned! This can lead to a speedloss
[swscaler @ 0000000004ca5f80] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 55 times
[swscaler @ 0000000009502c80] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 41 times
[output stream 0:0 @ 00000000002cb160] 100 buffers queued in output stream 0:0, something may be wrong.
[swscaler @ 0000000009502c80] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 49 times
[swscaler @ 0000000007cc2780] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 1 times
frame=  150 fps=107 q=-1.0 Lsize=     122kB time=00:00:05.92 bitrate= 168.6kbits/s
video:119kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.158680%
[libx264 @ 0000000004cf00a0] frame I:1     Avg QP:18.48  size: 13916
[libx264 @ 0000000004cf00a0] frame P:38    Avg QP:18.97  size:  1965
[libx264 @ 0000000004cf00a0] frame B:111   Avg QP:23.90  size:   296
[libx264 @ 0000000004cf00a0] consecutive B-frames:  1.3%  0.0%  0.0% 98.7%
[libx264 @ 0000000004cf00a0] mb I  I16..4: 13.4% 64.7% 22.0%
[libx264 @ 0000000004cf00a0] mb P  I16..4:  0.6%  1.6%  0.2%  P16..4: 37.9% 10.8%  5.9%  0.0%  0.0%    skip:43.1%
[libx264 @ 0000000004cf00a0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 33.5%  0.3%  0.0%  direct: 0.1%  skip:66.0%  L0:47.5% L1:51.4% BI: 1.2%
[libx264 @ 0000000004cf00a0] 8x8 transform intra:65.9% inter:74.8%
[libx264 @ 0000000004cf00a0] coded y,uvDC,uvAC intra: 50.9% 30.8% 5.7% inter: 2.8% 1.3% 0.0%
[libx264 @ 0000000004cf00a0] i16 v,h,dc,p: 16% 37%  6% 42%
[libx264 @ 0000000004cf00a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 24% 29%  2%  3%  3%  4%  3%  4%
[libx264 @ 0000000004cf00a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 24% 15%  5%  7%  6%  6%  4%  4%
[libx264 @ 0000000004cf00a0] i8c dc,h,v,p: 62% 21% 16%  2%
[libx264 @ 0000000004cf00a0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000004cf00a0] ref P L0: 67.5%  6.2% 16.7%  9.6%
[libx264 @ 0000000004cf00a0] ref B L0: 91.5%  6.8%  1.7%
[libx264 @ 0000000004cf00a0] ref B L1: 95.3%  4.7%
[libx264 @ 0000000004cf00a0] kb/s:161.96

When x is not set, there is no shakiness (see correct output).

Also mentioned here:

Attachments (3)

in.jpg (15.8 KB ) - added by slhck 10 years ago.
input image
out.mp4 (121.9 KB ) - added by slhck 10 years ago.
faulty output
out-correct.mp4 (121.2 KB ) - added by slhck 10 years ago.
correct output without x set

Download all attachments as: .zip

Change History (18)

by slhck, 10 years ago

Attachment: in.jpg added

input image

by slhck, 10 years ago

Attachment: out.mp4 added

faulty output

by slhck, 10 years ago

Attachment: out-correct.mp4 added

correct output without x set

comment:1 by slhck, 10 years ago

Correct output:

ffmpeg -framerate 25 -loop 1 -i in.jpg -vf "zoompan=z='min(zoom+0.0015,1.4)':d=150" -t 6 -s 640x360 out-correct.mp4
ffmpeg version N-69568-g21051af Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 18.100 / 54. 18.100
  libavcodec     56. 21.102 / 56. 21.102
  libavformat    56. 19.100 / 56. 19.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5.  9.103 /  5.  9.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[mjpeg @ 000000000306c540] ignoring invalid SAR: 540/409
Input #0, image2, from 'in.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 3236 kb/s
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 640x360, 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'out-correct.mp4' already exists. Overwrite ? [y/N] y
[swscaler @ 00000000002f7fe0] deprecated pixel format used, make sure you did set range correctly
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 000000000306d920] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 000000000306d920] profile High, level 3.0
[libx264 @ 000000000306d920] 264 - core 144 r2525 40bb568 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out-correct.mp4':
  Metadata:
    encoder         : Lavf56.19.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 640x360, q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.21.102 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 00000000061b5080] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 11 times
[swscaler @ 000000000805ca60] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 87 times
[output stream 0:0 @ 000000000306b140] 100 buffers queued in output stream 0:0, something may be wrong.
[swscaler @ 000000000805ca60] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 49 times
[swscaler @ 00000000082d5420] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 1 times
frame=  150 fps=104 q=-1.0 Lsize=     121kB time=00:00:05.92 bitrate= 167.7kbits/s
video:119kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.164677%
[libx264 @ 000000000306d920] frame I:1     Avg QP:18.51  size: 13940
[libx264 @ 000000000306d920] frame P:39    Avg QP:18.97  size:  1900
[libx264 @ 000000000306d920] frame B:110   Avg QP:23.87  size:   297
[libx264 @ 000000000306d920] consecutive B-frames:  2.0%  0.0%  2.0% 96.0%
[libx264 @ 000000000306d920] mb I  I16..4: 12.9% 67.3% 19.8%
[libx264 @ 000000000306d920] mb P  I16..4:  0.5%  1.5%  0.2%  P16..4: 37.3% 10.1%  5.3%  0.0%  0.0%    skip:45.0%
[libx264 @ 000000000306d920] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 34.0%  0.4%  0.0%  direct: 0.1%  skip:65.5%  L0:45.6% L1:53.3% BI: 1.1%
[libx264 @ 000000000306d920] 8x8 transform intra:67.8% inter:76.0%
[libx264 @ 000000000306d920] coded y,uvDC,uvAC intra: 51.0% 30.4% 6.3% inter: 2.8% 1.2% 0.0%
[libx264 @ 000000000306d920] i16 v,h,dc,p: 19% 35%  9% 36%
[libx264 @ 000000000306d920] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 26% 28%  3%  3%  3%  4%  4%  4%
[libx264 @ 000000000306d920] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 26% 14%  4%  7%  6%  6%  4%  4%
[libx264 @ 000000000306d920] i8c dc,h,v,p: 61% 21% 16%  3%
[libx264 @ 000000000306d920] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000000000306d920] ref P L0: 67.0%  6.3% 17.2%  9.4%
[libx264 @ 000000000306d920] ref B L0: 93.9%  5.0%  1.1%
[libx264 @ 000000000306d920] ref B L1: 96.8%  3.2%
[libx264 @ 000000000306d920] kb/s:161.01

comment:2 by Carl Eugen Hoyos, 10 years ago

Reproduced by developer: set
Status: newopen

Workaround is to insert the scale filter:
-vf "scale=hd720,zoompan=z='min(zoom+0.0015,1.4)':x=50:d=150"

Do you know why this issue wasn't reported earlier to the developers?

comment:3 by slhck, 10 years ago

Ah, is the reason that the rescaling is done after filtering otherwise?

Not sure why it wasn't reported. I had not seen the old question raising the issue, otherwise I probably would have posted a report earlier.

comment:4 by slhck, 10 years ago

A similar thing happens with video – the output is shaky and lots of frames are dropped. (Could only test on recent stable though.)

ffmpeg -i test.mp4 -vf "zoompan=z='min(zoom+0.0015,1.5)':d=125:s=hd720" out.mp4
ffmpeg version 2.5.3 Copyright (c) 2000-2015 the FFmpeg developers
  built on Jan 18 2015 18:53:04 with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.5.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfontconfig --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-openssl --enable-libopus --enable-frei0r --enable-libcaca --enable-libsoxr --enable-libquvi --enable-libvidstab --enable-libx265 --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 ' --enable-nonfree --enable-vda
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 13.100 / 56. 13.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.15.102
  Duration: 00:00:20.48, start: 0.315375, bitrate: 3854 kb/s
    Chapter #0:0: start 0.000000, end 20.000000
    Metadata:
      title           : Opening Credits
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1036 [SAR 1:1 DAR 480:259], 3851 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Subtitle: mov_text (text / 0x74786574), 0 kb/s
    Metadata:
      handler_name    : SubtitleHandler
[libx264 @ 0x7ff5bb001800] using SAR=1/1
[libx264 @ 0x7ff5bb001800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7ff5bb001800] profile High, level 3.1
[libx264 @ 0x7ff5bb001800] 264 - core 142 r2479 dd79a61 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.15.102
    Chapter #0:0: start 0.315000, end 20.315000
    Metadata:
      title           : Opening Credits
    Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc56.13.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[output stream 0:0 @ 0x7ff5ba600820] 100 buffers queued in output stream 0:0, something may be wrong.
frame=  215 fps=1.8 q=-1.0 Lsize=    1555kB time=00:00:08.88 bitrate=1434.1kbits/s dup=0 drop=23410
video:1552kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.205884%
[libx264 @ 0x7fbf0b008600] frame I:3     Avg QP:18.52  size: 58670
[libx264 @ 0x7fbf0b008600] frame P:151   Avg QP:21.21  size:  8615
[libx264 @ 0x7fbf0b008600] frame B:61    Avg QP:22.90  size:  1830
[libx264 @ 0x7fbf0b008600] consecutive B-frames: 56.3% 17.7%  0.0% 26.0%
[libx264 @ 0x7fbf0b008600] mb I  I16..4:  6.3% 65.8% 27.9%
[libx264 @ 0x7fbf0b008600] mb P  I16..4:  2.4% 13.7%  1.7%  P16..4: 22.2%  4.8%  2.7%  0.0%  0.0%    skip:52.4%
[libx264 @ 0x7fbf0b008600] mb B  I16..4:  0.0%  0.1%  0.0%  B16..8: 48.4%  0.6%  0.0%  direct: 0.1%  skip:50.7%  L0:43.6% L1:56.2% BI: 0.2%
[libx264 @ 0x7fbf0b008600] 8x8 transform intra:75.8% inter:85.4%
[libx264 @ 0x7fbf0b008600] coded y,uvDC,uvAC intra: 49.8% 42.4% 12.5% inter: 8.2% 7.6% 0.1%
[libx264 @ 0x7fbf0b008600] i16 v,h,dc,p: 29% 17% 10% 44%
[libx264 @ 0x7fbf0b008600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 13% 22%  8%  7%  9%  6%  9%  5%
[libx264 @ 0x7fbf0b008600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 13% 18%  7%  8%  8%  6%  7%  3%
[libx264 @ 0x7fbf0b008600] i8c dc,h,v,p: 65% 14% 19%  2%
[libx264 @ 0x7fbf0b008600] Weighted P-Frames: Y:2.6% UV:0.0%
[libx264 @ 0x7fbf0b008600] ref P L0: 60.9% 10.7% 14.2% 14.1%  0.1%
[libx264 @ 0x7fbf0b008600] ref B L0: 88.8%  9.4%  1.8%
[libx264 @ 0x7fbf0b008600] ref B L1: 95.5%  4.5%
[libx264 @ 0x7fbf0b008600] kb/s:1417.20

Inserting the scale filter before (as Carl-Eugen suggested) with video magically makes the output 720p, without me requesting that.

ffmpeg -i test.mp4 -vf "scale=640:360, zoompan=z='min(zoom+0.0015,1.5)':d=125" out.mp4
ffmpeg version 2.5.3 Copyright (c) 2000-2015 the FFmpeg developers
  built on Jan 18 2015 18:53:04 with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.5.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfontconfig --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-openssl --enable-libopus --enable-frei0r --enable-libcaca --enable-libsoxr --enable-libquvi --enable-libvidstab --enable-libx265 --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 ' --enable-nonfree --enable-vda
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 13.100 / 56. 13.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.15.102
  Duration: 00:00:20.48, start: 0.315375, bitrate: 3854 kb/s
    Chapter #0:0: start 0.000000, end 20.000000
    Metadata:
      title           : Opening Credits
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1036 [SAR 1:1 DAR 480:259], 3851 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Subtitle: mov_text (text / 0x74786574), 0 kb/s
    Metadata:
      handler_name    : SubtitleHandler
File 'out.mp4' already exists. Overwrite ? [y/N] y
[libx264 @ 0x7fb5d182fe00] using SAR=270/259
[libx264 @ 0x7fb5d182fe00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7fb5d182fe00] profile High, level 3.1
[libx264 @ 0x7fb5d182fe00] 264 - core 142 r2479 dd79a61 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.15.102
    Chapter #0:0: start 0.315000, end 20.315000
    Metadata:
      title           : Opening Credits
    Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 270:259 DAR 480:259], q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc56.13.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[output stream 0:0 @ 0x7fb5d0e01140] 100 buffers queued in output stream 0:0, something may be wrong
...

When I use ffplay it shows everything correctly though:

ffplay test.mp4 -vf "zoompan=z='min(zoom+0.0015,1.5)':d=125:s=640x320"
Last edited 10 years ago by slhck (previous) (diff)

comment:5 by goran, 8 years ago

Priority: normalimportant

Could anyone working on this problem. Scaling didn't fix problem in whole. Also, when using scaling encoding time progressive growing. Without zoompan component ffmpeg is unuseful in my case.

comment:6 by slhck, 8 years ago

Priority: importantnormal

Changing priority back to normal – this doesn't classify as an important bug, in my opinion.

comment:7 by xavierts, 6 years ago

Any new workaround or fix for this issue? I am still able to reproduce in 4.0.2. Scaling beforehand consumes a lot of memory for 4k+ resolutions.

comment:8 by Jim DeLaHunt, 5 years ago

I suspect there were some errors copying and pasting the original "how to reproduce" command and output. It reads,

 ffmpeg -framerate 25 -loop 1 -i in.jpg -vf "zoompan=z='min(zoom+0.0015,1.4)':x=50:d=150" -t 6 -s 640x380 out.mp4
ffmpeg version N-69568-g21051af Copyright (c) 2000-2015 the FFmpeg developers
[... omitted for brevity ...]
Input #0, image2, from 'out.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 3236 kb/s
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 640x360, 25 fps, 25 tbr, 25 tbn, 25 tbc
[... omitted for brevity ...]
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf56.19.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 640x360, q=-1--1, 25 fps, 12800 tbn, 25 tbc
[... omitted for brevity ...]

First, the command line has the output size setting -s 640x380, but the command output says "output #0" has size 640x360, as does also the supplied "out.mp4" file. 380 is different than 360. Second, the command line specifies an input file named in.jpg, but the command output says the input is read from 'out.jpg'. "in.jpg" is not "out.jpg". If there are mistakes here, are there mistakes elsewhere?

in reply to:  4 comment:9 by Jim DeLaHunt, 5 years ago

Replying to slhck:

Inserting the scale filter before (as Carl-Eugen suggested) with video magically makes the output 720p, without me requesting that.

ffmpeg -i test.mp4 -vf "scale=640:360, zoompan=z='min(zoom+0.0015,1.5)':d=125" out.mp4
[... omitted for brevity ...]

The 720p output is expected. Note that the '''zoompan''' filter defaults to an output image size of hd720, unless the invocation asks for a different size by means of the s option. For a proper test, this command should be revised to
ffmpeg -i test.mp4 -vf "scale=640:360, zoompan=z='min(zoom+0.0015,1.5)':d=125:s=640x360" out.mp4

One of the example zoompan filter invocations in the documentation demonstrates setting the output size this way.

comment:10 by David, 2 months ago

Adding bilinear interpolation to this filter to prevent the jitter should be increased to priority critical.

The jitter makes the zoompan filter completely unusable for zooming into the center of a video. By default, it's so jittery that it looks like I deliberately added a shaking filter. For example, see this video I exported locally on VideoGen: https://app.videogen.io/view/ksabnn. Even with the trick of upscaling, zooming, and downscaling, the jitter is still noticeable when looking closely.

I tried using the geq filter and doing the math for zooming myself, but this is significantly slower. How is anyone supposed to use the zoompan filter in its current state? Why doesn't zoompan have interpolation while geq and many other filters do?

comment:11 by MasterQuestionable, 2 months ago

Cc: MasterQuestionable added
Keywords: swscale added

͏    So the root cause appears to be "swscale" havoc..?
͏    (for the various insensible defaults)

comment:12 by Gyan, 2 months ago

I'll look into it.

comment:13 by Gyan, 2 months ago

Using the other swscale algorithms made no difference to the jitter in the output.

What's needed is anti-aliasing.

comment:14 by MasterQuestionable, 2 months ago

͏    So is it really a problem of the source input..?
͏    Reproducible or not with other sources?

comment:15 by Gyan, 2 months ago

It is not related to the input - it is about sub-pixel rendering.
Maybe I should check with different dither methods as well.

Note: See TracTickets for help on using tickets.