0

I'm trying to use FFmpeg to create a new video with some frames repeated and black frames inserted inside. Here is my command:

#! /bin/sh
fn="Drifting with Cars.mp4"

#
ffmpeg -y -i "${fn}" -ss 00:00:05 -to 00:00:06 -r 1/1 _05.png
ffmpeg -y -i "${fn}" -ss 00:00:10 -to 00:00:11 -r 1/1 _10.png
ffmpeg -y -i "${fn}" -ss 00:00:15 -to 00:00:16 -r 1/1 _15.png
ffmpeg -y -i "${fn}" -ss 00:00:20 -to 00:00:21 -r 1/1 _20.png
ffmpeg -y -i "${fn}" -ss 00:00:25 -to 00:00:26 -r 1/1 _25.png
ffmpeg -y -i "${fn}" -ss 00:00:30 -to 00:00:31 -r 1/1 _30.png
ffmpeg -y -i "${fn}" -ss 00:00:35 -to 00:00:36 -r 1/1 _35.png

#
ffmpeg -y -i "${fn}" \
-i _05.png \
-i _10.png \
-i _15.png \
-i _20.png \
-i _25.png \
-i _30.png \
-i _35.png \
-filter_complex "
[0:v]trim=0:5,setpts=PTS-STARTPTS[0v_1];
[1:v]loop=loop=25*3:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=2:d=1[pause1];
[0:v]trim=5:10,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_2];
[2:v]loop=loop=25*4:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=1[pause2];
[0:v]trim=10:15,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_3];
[3:v]loop=loop=25*5:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=2[pause3];
[0:v]trim=15:20,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_4];
[4:v]loop=loop=25*6:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=3[pause4];
[0:v]trim=20:25,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_5];
[5:v]loop=loop=25*7:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=4[pause5];
[0:v]trim=25:30,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_6];
[6:v]loop=loop=25*5:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=2[pause6];
[0:v]trim=30:35,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_7];
[7:v]loop=loop=25*3:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=2:d=1[pause7];
[0:v]trim=35,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_8];

[0v_1][pause1]
[0v_2][pause2]
[0v_3][pause3]
[0v_4][pause4]
[0v_5][pause5]
[0v_6][pause6]
[0v_7][pause7]
[0v_8]
concat=n=15:a=0:v=1[v]
" -map '[v]' -an "DriftingWithCars_pf.mp4"

But when running (the filter part), I get the following error:

[AVFilterGraph @ 0x2261560] No such filter: 'loop'
Error initializing complex filters.
Invalid argument

What is the problem? Where does it come from? I'm using an updated version of ffmpeg: version 2.8.15 Copyright (c) 2000-2018

2

The 2.8 branch is too old. The loop filter was added on 2016-02-18. The 2.8 branch was cut from the master branch on 2015-09-05. Release branches do not get new features backported (only occasional bug fixes).

Don't use such an old FFmpeg. Compile or download a recent build.

You can see a list of available filters for your build with ffmpeg -filters.

  • Yes my update did the trick! Didn't know loop was added recently! Thanks. – Tina J Apr 24 at 22:38
  • 1
    @TinaJ It was added more than three years ago which is a few epochs in terms of FFmpeg development. Always use a recent version. – llogan Apr 24 at 22:40
  • 1
    @TinaJ Experiment with the values for the two options. My example only used the default values. – llogan Apr 24 at 22:44
  • 1
    @TinaJ According to the contents of libavfilter/vf_freezedetect.c it is licensed LGPL 2.1 or later. Not sure what you are asking in your 2nd question. – llogan May 2 at 0:27
  • 1
    @TinaJ Of course you can. You Just need to comply with the LGPL. – llogan May 2 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.