Reputation: 176
I've inherited an application that opens a proprietary file which has a video stream and an audio stream (G.711 ULAW format). The application already writes the video to an AVI but without the audio. I want to add code that inserts the audio stream in the same format to the AVI file.
Are there any code samples/documentation that show how to write a G.711 stream into AVI?
Upvotes: 1
Views: 1139
Reputation: 176
This is an update on the solution:
Basically I was doing the right thing and passing the correct codec code (WAVE_FORMAT_MULAW) as Richard suggested.
However, each API call: AVIFileCreateStream and AVIStreamSetFormat accepts a different structure. But not all the fields are relevant for the call, so the rest of the structure has to be filled with zeros before setting each field.
For example:
AVISTREAMINFO aviHeader;
ZeroMemory(&aviHeader, sizeof(aviHeader));
aviHeader.fccType = streamtypeAUDIO;
...
Thanks!
Upvotes: 0
Reputation: 1474
The AVIFile services can be used to write streams into AVI format.
G.711 u-law is a standard "wave" audio format in Windows. When you set the format of the audio stream using AVIStreamSetFormat, use the WAVEFORMATEX structure, with wFormatTag
set to WAVE_FORMAT_MULAW
(0x0007).
[Update] There is a decent-looking walkthrough of how to read and write AVI files on CodeProject: Steganography IV - Reading and Writing AVI files
Upvotes: 1