Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#6122 closed enhancement (fixed)

Clarify option on looping infinitely in movie filter

Reported by: slhck Owned by:
Priority: normal Component: documentation
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


The movie filter currently does not allow infinite input looping via the loop option.

The loop_count is decremented with every completed loop and stops at 0.

There should be a way to set the loop option to -1 which would enable infinite looping.

(I can have a try at this but I'm not sure if there's something that prevents it from being implemented in the filter section.)

Change History (4)

comment:1 by Carl Eugen Hoyos, 5 years ago

Resolution: worksforme
Status: newclosed

Please read the fine documentation again and please remember to post all usage questions on the user mailing list.

comment:2 by slhck, 5 years ago

I know I should post usage questions on the mailing list, but this wasn't one. I was sure that this wasn't implemented, because setting loop=-1 gives an error:

ffmpeg -i bbb.mp4 -filter_complex "movie=spinner-256-white.png:loop=-1[spinner]; [0:v][spinner]overlay[out]" -map "[out]" -t 5 out.avi


ffmpeg version N-83288-gacf1dd5-tessus Copyright (c) 2000-2017 the FFmpeg developers
[movie @ 0x7fb4834015c0] Error setting option loop to value -1.
[Parsed_movie_0 @ 0x7fb483401500] Error applying options to the filter.
[AVFilterGraph @ 0x7fb483600000] Error initializing filter 'movie' with args 'spinner-256-white.png:loop=-1'
Error initializing complex filters.
Result too large

The documentation says: "If the value is less than 1, the stream will be read again and again" — and -1 is less than 1. Also, -1 is used for the stream_loop option to declare "infinite looping", which is why I thought it would work. Setting the option to 0 does work, but then either the documentation needs to be changed to reflect that, or the options for infinite looping should be harmonized by making -1 work in this filtering case as well.

To me, having to set loop=0 to make something loop infinitely just seemed absolutely counterintuitive which is why I didn't even try it.

comment:3 by slhck, 5 years ago

If that's fine for you, you could merge this commit, which clarifies the documentation:

(I'm not on the devel mailing list at the moment, and your contribution docs now say it's fine to do this as well.)

comment:4 by llogan, 5 years ago

Component: avfilterdocumentation
Resolution: worksformefixed
Summary: Support infinite loops in movie filterClarify option on looping infinitely in movie filter
Note: See TracTickets for help on using tickets.