I'm a software developer. My software produces animated video files with music.

The video files should be compatible with a wide range of software, and they should have excellent audio quality. The audio that users load into the program might have been encoded twice already, and the resulting video will be encoded one more time when uploading to YouTube. So I'd like to let my software output uncompressed audio into the video file.

For the longest time I wrote AVI files with WAV audio. Unfortunately, this format suffers from compatibility problems. Some versions of Sony Vegas cannot open it, same problem with some versions of Premiere.

MP4 files should be compatible with a wide range of software - unfortunately, there doesn't seem to be a widely supported way for MP4 files to contain lossless audio. Most common seems to be AAC audio, which is transparent at 320kbps - but I'd like to avoid that additional lossy step for reasons mentioned above.

MKV files support WAV audio, but are unsupported by Sony Vegas.

What container format and audio codec should I pick for wide compatibility and lossless audio? I'm using ffmpeg, so I have the ability to produce almost any format.

  • 5
    So, it has to be readable by Vegas and Youtube? Looks like Vegas will be the limiting factor here. Ask in their forums. My guess is, MOV container with ALAC or FLAC audio. Certainly MOV with PCM audio.
    – Gyan
    Commented Oct 8, 2020 at 15:49
  • 2
    I know you have your reasons, but AAC at 320 or 384 kbps, sampled at 48K, is indistinguishable from WAV in any real world setting. And it's widely compatible.
    – Jim Mack
    Commented Oct 15, 2020 at 3:13

3 Answers 3


According to Mozilla Developers MPEG-4 containers can include FLAC audio. Ditto for OGG containers.


To my knowledge, the only lossless audio format with really wide compatibility is plain old linear PCM. As container format, MP4 is the most wide-spread.


The MP4 container officially supports the Apple Lossless Audio Codec (ALAC). Doesn't mean it's supported by other software, though.

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.