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?

1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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