This question already has an answer here:

I have a simple video here I try to repeat it as background for other content. So I tried to loop it with the command

ffmpeg -y -r 25 \
-i cover.mp4 \
-filter_complex \
"\
[0:v]loop=loop=3:0:0[body]\

" -map "[body]" -c:v libx264 body-out.mp4

But the result is very weird with many froze or duplicated frames, and the video length is not 3 times of the original one.

here is the ffmpeg -version output

ffmpeg -version
ffmpeg version N-91135-g2c2d689c56-tessus Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 9.1.0 (clang-902.0.39.1)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static--disable-ffplay
libavutil      56. 18.102 / 56. 18.102
libavcodec     58. 19.102 / 58. 19.102
libavformat    58. 15.100 / 58. 15.100
libavdevice    58.  4.100 / 58.  4.100
libavfilter     7. 24.100 /  7. 24.100
libswscale      5.  2.100 /  5.  2.100
libswresample   3.  2.100 /  3.  2.100
libpostproc    55.  2.100 / 55.  2.100

Thanks for any hint

marked as duplicate by Rob, Michael Liebman, Dr Mayhem Jun 10 at 7:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I've read that thread before, so I tried to use loop filter, but the result is quite different. I also check the parameters and the command, I cannot figure out why. – davyzhang May 26 at 5:25
  • Just stream loop it: ffmpeg -stream_loop 2 -i cover.mp4 -c copy body-out.mp4 – Gyan May 26 at 5:42
  • Thanks, @Gyan I get the idea that loop function in FFmpeg is VERY buggy, -stream_loop might not work on mp4, the loop and movie filter is not reliable and the only working method might be the good old copy 😂 – davyzhang May 26 at 6:01
  • -stream_loop works on MP4. movie and loop filters are reliable. Which loop function are you referring to? Just remember to upgrade ffmpeg to 4.0 or latest git version. There were a bunch of bugs fixed in the last few months. – Gyan May 26 at 6:09
  • @davyzhang - There's this comment on the official ffmpeg download webpage (for Linux): "Note: It's highly recommended to use git builds, because bug fixes and other improvements are added on a daily basis." - Are you using a recent version? ffmpeg -version – Rob May 26 at 6:11

Browse other questions tagged or ask your own question.