Opened 10 months ago

Last modified 9 months ago

#6121 reopened defect

-stream_loop option does not work, while movie filter with loop option does

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

Description

I want to overlay a spinner on top of a video. When I use the -stream_loop option (either with -1 or an arbitrary number of repetitions), the input file is not looped, just played once:

Command used:

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

Output:

ffmpeg version N-83288-gacf1dd5-tessus Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
  libavutil      55. 45.100 / 55. 45.100
  libavcodec     57. 75.100 / 57. 75.100
  libavformat    57. 66.100 / 57. 66.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 72.100 /  6. 72.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/werner/Documents/Projects/bufferer/videos/bbb.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.56.100
  Duration: 00:00:45.08, start: 0.000000, bitrate: 1720 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 1289 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 425 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      handler_name    : TimeCodeHandler
      timecode        : 00:00:00:00
Input #1, apng, from '/Users/werner/Documents/Projects/bufferer/spinners/spinner-256-white.png':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #1:0: Video: apng, rgba(pc), 256x256, 11.08 fps, 22.25 tbr, 100k tbn, 100k tbc
File 'out.avi' already exists. Overwrite ? [y/N] y
Output #0, avi, to 'out.avi':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    ISFT            : Lavf57.66.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080, q=2-31, 200 kb/s, 24 fps, 24 tbn, 24 tbc (default)
    Metadata:
      encoder         : Lavc57.75.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 (h264) -> overlay:main
  Stream #1:0 (apng) -> overlay:overlay
  overlay -> Stream #0:0 (mpeg4)
Press [q] to stop, [?] for help
frame=  120 fps=109 q=31.0 Lsize=    1344kB time=00:00:05.00 bitrate=2201.8kbits/s speed=4.53x
video:1335kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.631020

However, with the movie filter it works. Here the only problem is that I cannot set an infinite loop… (any ideas how to?)

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

Output:

ffmpeg version N-83288-gacf1dd5-tessus Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
  libavutil      55. 45.100 / 55. 45.100
  libavcodec     57. 75.100 / 57. 75.100
  libavformat    57. 66.100 / 57. 66.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 72.100 /  6. 72.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/werner/Documents/Projects/bufferer/videos/bbb.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.56.100
  Duration: 00:00:45.08, start: 0.000000, bitrate: 1720 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 1289 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 425 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      handler_name    : TimeCodeHandler
      timecode        : 00:00:00:00
File 'out2.avi' already exists. Overwrite ? [y/N] y
Output #0, avi, to 'out2.avi':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    ISFT            : Lavf57.66.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080, q=2-31, 200 kb/s, 24 fps, 24 tbn, 24 tbc (default)
    Metadata:
      encoder         : Lavc57.75.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 (h264) -> overlay:main
  overlay -> Stream #0:0 (mpeg4)
Press [q] to stop, [?] for help
frame=  120 fps= 93 q=31.0 Lsize=    1354kB time=00:00:05.00 bitrate=2218.7kbits/s speed=3.89x
video:1346kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.626175%

Attachments (1)

spinner-256-white.png (73.4 KB) - added by slhck 10 months ago.

Download all attachments as: .zip

Change History (6)

Changed 10 months ago by slhck

comment:1 Changed 10 months ago by richardpl

  • Resolution set to invalid
  • Status changed from new to closed

-stream_loop must be before -i.

comment:2 Changed 10 months ago by richardpl

  • Resolution invalid deleted
  • Status changed from closed to reopened

Actually just provide input APNG file.

comment:3 Changed 10 months ago by slhck

You mean before all other inputs? Does it then apply to all of them? But even when I put it before, it doesn't work.

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

The APNG file is attached already.

comment:4 Changed 10 months ago by cehoyos

Seems reproducible with the following command:

$ ffmpeg -stream_loop -1 -i fate-suite/lena.pnm -stream_loop -1 -i fate-suite/lena.pnm -f null -
ffmpeg version N-83372-g08b0981 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      55. 46.100 / 55. 46.100
  libavcodec     57. 75.100 / 57. 75.100
  libavformat    57. 66.101 / 57. 66.101
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 72.100 /  6. 72.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, ppm_pipe, from 'fate-suite/lena.pnm':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: ppm, rgb24, 256x256, 25 tbr, 25 tbn, 25 tbc
Input #1, ppm_pipe, from 'fate-suite/lena.pnm':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: ppm, rgb24, 256x256, 25 tbr, 25 tbn, 25 tbc
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf57.66.101
    Stream #0:0: Video: wrapped_avframe, rgb24, 256x256, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.75.100 wrapped_avframe
Stream mapping:
  Stream #0:0 -> #0:0 (ppm (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=75.8x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

comment:5 Changed 9 months ago by mulvya

When I apply stream_loop to a MP4, it "works" haphazardly. Timestamps have discontinuities and the first GOP is omitted in the repetitions. However, if I wrap the input to MKV or TS and use that, the loop result is fine.

Last edited 9 months ago by mulvya (previous) (diff)
Note: See TracTickets for help on using tickets.