user3043: 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.

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

3043: <p>I'm a software developer. My software produces animated video files with music.</p>
<p>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.</p>
<p>For the longest time I wrote <strong>AVI</strong> 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.</p>
<p><strong>MP4</strong> 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.</p>
<p><strong>MKV</strong> files support WAV audio, but are unsupported by Sony Vegas.</p>
<p><strong>What container format and audio codec</strong> should I pick for wide compatibility and lossless audio? I'm using ffmpeg, so I have the ability to produce almost any format.</p>
 38574: <p>According to <a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers" rel="nofollow noreferrer">Mozilla Developers</a> MPEG-4 containers can include FLAC audio.  Ditto for OGG containers.</p>
