Back to Support
Troubleshooting

-loop and -framerate Errors

Why -loop or -framerate stops a job on audio or video, and how to check what your file really is

You will see this when an input has -loop on it and the file is not a format that option works on:


> Invalid input option: -loop does not work on inputs[0] (format: mp3). It works on still image formats such as PNG and JPEG, and a file's name does not settle its format, so check that this input is the file you meant to send. To repeat audio, video or a GIF, use -stream_loop.


-framerate on an audio file or an MP4 stops the same way, in FFmpeg's words with our advice after them:


> FFmpeg command failed: Option framerate not found. Invalid option for this file type. -loop works only on image inputs, and -framerate only on image and raw video inputs. A file's name does not settle its format, so check that each input is the file you meant to send. To repeat a file, use -stream_loop. To set a frame rate, use -r on the output.


-loop belongs to FFmpeg's image readers, and audio and video readers do not have it, so FFmpeg stops before reading a frame. -framerate also works on raw video streams such as .h264. The -loop refusal stops a job before it is billed.


File Check


A file named image.jpg can still be audio. Check what is inside it:


ffprobe -v error -show_entries format=format_name -of csv=p=0 image.jpg

OutputWhat the file is
image2, png_pipeA still image: -loop applies
Another name ending in _pipe, such as jpeg_pipe or webp_pipeAn image we cannot use as a still yet. Convert it to PNG, or to JPEG with a .jpg name
gif, apngAn animation: use -stream_loop
mp3, avi, mov,mp4,m4a,3gp,3g2,mj2Audio or video, whatever the file is called
An error line before the format, such as No JPEG data found in imageNot a usable image. A web page or error response saved as image.jpg looks like this

Common Causes


  • The wrong file reached this input. An automation can pass the audio from an earlier step where it meant to pass the image. Uploading it as image.jpg hides the mistake, because the stored file keeps that extension.
  • The inputs are in a different order than the options assume. Options apply to the input they are listed under, so -loop has to sit on the image.
  • You want to repeat audio or video. That takes -stream_loop.
  • A quote card with the wrong image. @quote-card adds -loop to its profile image, and to a background whose URL ends in .png, .jpg, .jpeg or .webp, so check the files at profileImageUrl and backgroundUrl.

  • Solutions


    -loop


    Put it on the image:


    {
      "inputs": [
        {
          "url": "gs://your-bucket/image.jpg",
          "options": [{ "option": "-loop", "argument": "1" }]
        },
        { "url": "gs://your-bucket/audio.mp3" }
      ],
      "outputFormat": "mp4",
      "options": [
        { "option": "-c:v", "argument": "libx264" },
        { "option": "-c:a", "argument": "aac" },
        { "option": "-shortest" },
        { "option": "-pix_fmt", "argument": "yuv420p" }
      ]
    }
    

    -stream_loop


    This repeats audio, video or a GIF. The argument is how many extra times it plays:


    {
      "inputs": [
        {
          "url": "gs://your-bucket/clip.mp4",
          "options": [{ "option": "-stream_loop", "argument": "1" }]
        }
      ],
      "outputFormat": "mp4"
    }
    

    -r


    To set the frame rate of a video, put -r on the output in options.


    Still Need Help?

    Can't find what you're looking for?