I'm creating some encoding templates for multi-bitrate streaming, and I want to create a fallback that is audio-only. So when the bandwidth of a users connection falls below x, it drops video playback and switches to audio-only.

The problem is alignment of said audio stream. I've aligned the videostream with

-x264opts keyint=48:min-keyint=48:no-scenecut 

This creates equal intervals in keyframes, allowing consistent GOP's for streaming. But such an option is not available for audio only.

I extracted the audio from the original file, like this:

ffmpeg -i Sample.avi -vn -ar 44100 -ac 2 -ab 128k -f mp3 audio_only.mp3

That creates a separate .MP3 file, equal to the audio-streams of the original file (.MP4). However, I have no way to ensure this is inline with the audio streams of the encoded .MP4's (the multi-bitrate set).

So, is there a way to make sure these files are aligned? Or should I extract the audio from one of the encoded files, instead of the mezzanine file?

1 Answer 1


One way to achieve this might be to create an .MP4 with your audio and an all-black image, which should encode to something not much larger than the audio file but still have the same internal structure as the full video files.

  • I could use that, and it wil probably work. However, the file wouldn't be technically audio only then. I don't see any other way though. Thank you for your suggestion!
    – Wouter Pol
    Commented Oct 21, 2016 at 12:19
  • Extracting the audio from one of the encoded files should get you audio only. Remember to add -copyts to the extraction command and extract to .mp4.
    – Gyan
    Commented Oct 21, 2016 at 12:23
  • @WouterPol Another possible advantage to this is that you could use a static image such as text over black saying "Low Bandwidth - Audio Only". This would take a little more space, but not much.
    – Jim Mack
    Commented Oct 21, 2016 at 20:44
  • Yes, that would be a great fallback technique, thank you!
    – Wouter Pol
    Commented Oct 24, 2016 at 12:27

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.