17

I'm trying to create looping apng files from mkvs. My problem is that they don't loop. The files play once, but stop.

This is what I'm doing:

 ffmpeg -ss 16:43 -i ./10.mkv -loop 10 -t 1 -filter:v "setpts=PTS-STARTPTS, crop=1200:800, hqdn3d=1.5:1.5:6:6, scale=600:400"  10-file-2.apng

I've tried -loop -1 -loop 10 -loop 1 but there is no looping done. My version is

ffmpeg-3.3.el_capitan.bottle.tar.gz

Harry
  • 52,711
  • 71
  • 177
  • 261
  • `ffmpeg -i 'input.mp4' -framerate 5 -plays 0 screenshot.webp` was a helpful command for me – Ryan Nov 17 '21 at 19:15

1 Answers1

17

The parameter for looping APNGs is -plays.

ffmpeg -ss 16:43 -i ./10.mkv -plays 10 -t 1 -vf "setpts=PTS-STARTPTS, crop=1200:800, hqdn3d=1.5:1.5:6:6, scale=600:400"  10-file-2.apng
  • -plays 0: loops forever
  • -plays 1: plays once (i.e. no loop)
  • etc.
mwfearnley
  • 3,303
  • 2
  • 34
  • 35
Gyan
  • 85,394
  • 9
  • 169
  • 201
  • 1
    Do you have a documentation link? And how do I set infinite loops? -1 `Value -1.000000 for parameter 'plays' out of range [0 - 4.29497e+09]` – Harry May 06 '17 at 01:56
  • 13
    No doc for apng muxer at all! Strange. Anyway, `0` for infinite loops. – Gyan May 06 '17 at 04:51
  • 9
    https://github.com/FFmpeg/FFmpeg/blob/c463b81d037fd88fdda432324b995d82510a5bc7/libavformat/apngenc.c#L278 – Ken Sharp Feb 12 '18 at 14:05
  • What does this part do hqdn3d=1.5:1.5:6:6 ? – Ricardo Bohner Mar 07 '22 at 21:23
  • That's a denoiser. See docs at http://www.ffmpeg.org/ffmpeg-filters.html#hqdn3d-1 – Gyan Mar 08 '22 at 04:11
  • I just get "option plays not found". :-( EDIT: actually, you have to put `-plays 0` after the `-i file` option for some reason and then it works. – Jez Sep 12 '22 at 17:00
  • @Jez The plays option belongs to the APNG muxer so it goes along with the output options. Have a read of http://www.ffmpeg.org/ffmpeg.html#Description – Gyan Sep 13 '22 at 04:54
  • Yeah I had to put it after the `-i` argument and then it worked. – Jez Sep 14 '22 at 10:51