<p>The location of the audio <code>-i</code> input within the ffmpeg command makes a difference. If the audio is input right after the FPS value, then the FPS value doesn't work and instead uses a default FPS. Put your sound input after your existing images input then the FPS value you input will work.</p>
<p>The working command is:</p>
<pre><code>ffmpeg -r 7 -i &quot;$IMAGEPATH/%06d.jpg&quot; -i /path/to/audio/file/audioexample.ogg -vcodec mjpeg -shortest &quot;$VIDEOFILE&quot;.mov
</code></pre>

CC BY-SA 4.0
2022-10-07T22:51:27.873Z
2022-10-08T17:34:53.153Z
2022-10-08T17:34:53.153Z
John Doe
<p>How can I export a video to .mjpeg at my selected FPS value (7 FPS for stop motion video) while including audio in the export?</p>
<p>I use the -i input command in ffmpeg to include my .ogg audio file:</p>
<pre><code>ffmpeg -r 7 -i /path/to/audio/file/audioexample.ogg -i &quot;$IMAGEPATH/%06d.jpg&quot; -vcodec mjpeg -shortest &quot;$VIDEOFILE&quot;.mov
</code></pre>
<p>This doesn't export at 7 fps, it's much faster, looks like about 25 FPS. The -shortest option works and cuts the audio length to the video length, otherwise without -shortest the audio goes on longer than the video, so about 25 FPS either way regardless of -shortest.</p>
<p>The FPS will only correctly export at 7 FPS if I remove the audio from the ffmpeg export like this:</p>
<pre><code>ffmpeg -r 7 -i &quot;$IMAGEPATH/%06d.jpg&quot; -vcodec mjpeg &quot;$VIDEOFILE&quot;.mov
</code></pre>
<p>I'm using Linux Stopmotion video creation software which uses this ffmpeg command.</p>
<p>How can I include my audio but still have control of the FPS value using ffmpeg?</p>

<ffmpeg><framerate>
ffmpeg: Changes to FPS only work if I don't include audio in the export, how can I keep audio and choose the FPS value?
John Doe
# ffmpeg: Changes to FPS only work if I don't include audio in the export, how can I keep audio and choose the FPS value?

(Asked by: username_0 on 2022-10-06)

How can I export a video to .mjpeg at my selected FPS value (7 FPS for stop motion video) while including audio in the export?
I use the -i input command in ffmpeg to include my .ogg audio file:
ffmpeg -r 7 -i /path/to/audio/file/audioexample.ogg -i "$IMAGEPATH/%06d.jpg" -vcodec mjpeg -shortest "$VIDEOFILE".mov

This doesn't export at 7 fps, it's much faster, looks like about 25 FPS. The -shortest option works and cuts the audio length to the video length, otherwise without -shortest the audio goes on longer than the video, so about 25 FPS either way regardless of -shortest.
The FPS will only correctly export at 7 FPS if I remove the audio from the ffmpeg export like this:
ffmpeg -r 7 -i "$IMAGEPATH/%06d.jpg" -vcodec mjpeg "$VIDEOFILE".mov

I'm using Linux Stopmotion video creation software which uses this ffmpeg command.
How can I include my audio but still have control of the FPS value using ffmpeg?

**Tags:** ffmpeg, framerate


---

## 1 answers

### Answer by username_0 on 2022-10-07. Score: 0

The location of the audio -i input within the ffmpeg command makes a difference. If the audio is input right after the FPS value, then the FPS value doesn't work and instead uses a default FPS. Put your sound input after your existing images input then the FPS value you input will work.
The working command is:
ffmpeg -r 7 -i "$IMAGEPATH/%06d.jpg" -i /path/to/audio/file/audioexample.ogg -vcodec mjpeg -shortest "$VIDEOFILE".mov


---

