简体   繁体   中英

Converting audio from MP4 to Ogg Vorbis

I am trying to write a C# program that can read an MP4 file and convert the audio in Ogg Vorbis format, here's the catch though: I need 100 ms samples so that I can base64 encode them individually.

So audio from MP4 file to ogg vorbis, 100ms at a time.

As whacky as that sounds, that's the only way I can feed the audio data into the target application.

Does anyone know the easiest way to do this?

You need more focus with this question to make it valid for StackOverflow.

You need to take into consideration two things:

  1. There is no such thing as 100 ms of audio sharp in MP4 file. Typical MP4 AAC frame is 21⅓ milliseconds long and you can take a few to make 100 ms of audio data.
  2. Vorbis out of AAC means you need to fully transcode the data: decode from AAC into PCM and then encode

As you tagged this means you need to use one of the media APIs for Windows, or a library on top of them, to read an MP4 file, select audio track of interest, start reading its data, decode it through AAC decoder and obtain raw decoded audio content.

Then separately use Vorbis audio encoder and encode audio per stated requirements.

This is the way to do it programmatically. You cna probably use one of the readily available well-known tools to have it done for you "the easiest way".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM