gmf icon indicating copy to clipboard operation
gmf copied to clipboard

Extract audio and resample example

Open expd opened this issue 5 years ago • 2 comments

Hi,

Can you provide an example of how to use the resampler to downsample an audio stream and get access to the raw pcm audio data?

expd avatar Mar 29 '20 19:03 expd

Hi, @expd. It's pretty easy, I'll writre it ASPA. The main thing is pretty the same you can find in trancode.go:

  • Open input context
  • Select AUDIO streams
  • Open output codecs (e.g. pcm_s16le)
  • Initialize Swr context
  • Do converrtion
  • Write output

Just wait a bit, and I'll write it.

3d0c avatar Mar 31 '20 16:03 3d0c

I think some of the conversion functionality is missing ffmpeg docs show that there's a different calculation for the number of samples required. I'm trying to convert 48/stereo to 16/mono.

expd avatar Mar 31 '20 16:03 expd