Hi,

Thank you for your response. All my attempts to sort it out failed so far. 
Could you clarify how can I verify that I decoded the MP3 to linear PCM 
properly?

I mean as result of decoding I'm getting frames:
avcodec_decode_audio4(pMp3CodecCtx, frame, &gotFrame, &packet)

So what is next? Write frame to wav file? How? The function 
av_interleaved_write_frame despite its name accept packets not a frames?

How to check validity of wav container? I usually run  "ffprobe -i Output.wav" 
to see details. Is there other way? Thanks
    On Monday, December 6, 2021, 11:43:17 AM EST, Bob Kirnum 
<[email protected]> wrote:  
 
 Perhaps the AV_SAMPLE_FMT_S16 is referring to the sample format input to the 
G.711 uLaw encoder (input should be 16 bit linear PCM)?  Then this would be 
correct.  Perhaps split the effort and verify that you can decode the MP3 to 
linear PCM properly, and encode linear to uLaw properly for WAV separately?  
Using the wrong sample rate (not downsampling to 8 kHz) would not result in 
noise (what you reported), would just result in the wrong audio speed.  One 
additional thought, does decoding the MP3 result in 16 bit integer linear PCM 
or 32 bit float PCM?  If float, that would be a mismatch and result in noise 
when encoding to uLaw.
On Mon, Dec 6, 2021 at 10:40 AM Robert Smith via Libav-user 
<[email protected]> wrote:

 If I change

pCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16;

to

pCodecCtx->sample_fmt = AV_SAMPLE_FMT_U8;

Then I get the following error:

[pcm_mulaw @ 0x2d33450] Specified sample_fmt is not supported.

Any idea? Thanks
    On Friday, December 3, 2021, 06:15:54 PM EST, Bob Kirnum 
<[email protected]> wrote:  
 
 G.711 is 8 bits, could be an issue. Also, not sure if you need to downsample 
to 8kHz manually or not. 

> On Dec 3, 2021, at 5:36 PM, Robert Smith via Libav-user 
> <[email protected]> wrote:
> 
> pCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16;
_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".
  _______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".
  
_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to