<div dir="ltr">I assume there is a sample format for 32 bit float, try that instead of <span style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px">AV_SAMPLE_FMT_S16.  If that does not work you may need to convert samples from 32 bit float to 16 bit integer.</span></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 8, 2021 at 2:21 PM Robert Smith via Libav-user <<a href="mailto:libav-user@ffmpeg.org">libav-user@ffmpeg.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px"><div></div>
        <div dir="ltr">Dumped raw data to binary file, opened it in Audacity, found correct sampling rate and correctly played audio clip.<br>I noticed that Audacity shows "32 bit float", as you mentioned in your previous E-mail that could be the reason why transcoding <span><span style="color:rgb(38,40,42);font-family:Helvetica,Arial,sans-serif;font-size:16px">to uLaw </span></span>fails.<br><br>Could you clarify what is proper way to resolve the issue? Should I correct decoding? Thanks</div><div><br></div>
        
        </div><div id="gmail-m_-537549619685141958ydp7401e40byahoo_quoted_9228787237">
            <div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;color:rgb(38,40,42)">
                
                <div>
                    On Wednesday, December 8, 2021, 12:41:41 PM EST, Bob Kirnum <<a href="mailto:bkirnum@gmail.com" target="_blank">bkirnum@gmail.com</a>> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="gmail-m_-537549619685141958ydp7401e40byiv5566494881"><div><div dir="ltr">To verify the decoded audio from the MP3 I would simply write the decoded frames to file (fwrite or similar to a binary file).  The resulting file is a raw PCM file which can be imported with Audacity.  You specify the sample rate, sample format (i.e. 16 bit integer or 32 bit float), etc.  When you get the right settings the audio should play good.</div><br clear="none"><div><div id="gmail-m_-537549619685141958ydp7401e40byiv5566494881yqt00918"><div dir="ltr">On Wed, Dec 8, 2021 at 12:01 PM Robert Smith via Libav-user <<a shape="rect" href="mailto:libav-user@ffmpeg.org" rel="nofollow" target="_blank">libav-user@ffmpeg.org</a>> wrote:<br clear="none"></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div style="font-family:Helvetica,Arial,sans-serif;font-size:16px"><div></div>
        <div dir="ltr">Hi,<br clear="none"><br clear="none">Thank you for your response. All my attempts to sort it out failed so far. Could you clarify how can I verify that I <span><span style="color:rgb(38,40,42);font-family:Helvetica,Arial,sans-serif;font-size:16px">decoded the MP3 to linear PCM properly?<br clear="none"><br clear="none">I mean as result of decoding I'm getting frames:<br clear="none"><span>avcodec_decode_audio4(pMp3CodecCtx, frame, &gotFrame, &packet)<br clear="none"><br clear="none"></span>So what is next? Write frame to wav file? How? The function <span>av_interleaved_write_frame despite its name accept packets not a frames?<br clear="none"><br clear="none"></span></span></span></div><div dir="ltr">How to check validity of wav container? I usually run  "<span>ffprobe -i Output.wav" to see details. Is there other way? Thanks</span></div><div dir="ltr"><br clear="none"></div>
        
        </div><div id="gmail-m_-537549619685141958ydp7401e40byiv5566494881gmail-m_445885225468719375ydpe90b4074yahoo_quoted_9200757498">
            <div style="font-family:Helvetica,Arial,sans-serif;font-size:13px;color:rgb(38,40,42)">
                
                <div>
                    On Monday, December 6, 2021, 11:43:17 AM EST, Bob Kirnum <<a shape="rect" href="mailto:bkirnum@gmail.com" rel="nofollow" target="_blank">bkirnum@gmail.com</a>> wrote:
                </div>
                <div><br clear="none"></div>
                <div><br clear="none"></div>
                <div><div id="gmail-m_-537549619685141958ydp7401e40byiv5566494881gmail-m_445885225468719375ydpe90b4074yiv4218574043"><div><div dir="ltr">Perhaps the <span style="color:rgb(38,40,42);font-family:Helvetica,Arial,sans-serif;font-size:16px">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 </span><span style="color:rgb(38,40,42);font-family:Helvetica,Arial,sans-serif;font-size:16px">properly<span> </span></span><span style="color:rgb(38,40,42);font-family:Helvetica,Arial,sans-serif;font-size:16px">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.</span></div><br clear="none"><div><div id="gmail-m_-537549619685141958ydp7401e40byiv5566494881gmail-m_445885225468719375ydpe90b4074yiv4218574043yqt63059"><div dir="ltr">On Mon, Dec 6, 2021 at 10:40 AM Robert Smith via Libav-user <<a shape="rect" href="mailto:libav-user@ffmpeg.org" rel="nofollow" target="_blank">libav-user@ffmpeg.org</a>> wrote:<br clear="none"></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div style="font-family:Helvetica,Arial,sans-serif;font-size:16px"><div></div>
        <div dir="ltr">If I change<br clear="none"><br clear="none"><span><span style="color:rgb(38,40,42);font-family:Helvetica,Arial,sans-serif">pCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16;<br clear="none"></span></span><br clear="none">to<br clear="none"><br clear="none"><span><span style="color:rgb(38,40,42);font-family:Helvetica,Arial,sans-serif">pCodecCtx->sample_fmt = AV_SAMPLE_FMT_U8;<br clear="none"></span></span><br clear="none">Then I get the following error:<br clear="none"><br clear="none"><span>[pcm_mulaw @ 0x2d33450] Specified sample_fmt is not supported.<br clear="none"></span><br clear="none">Any idea? Thanks</div><div><br clear="none"></div>
        
        </div><div id="gmail-m_-537549619685141958ydp7401e40byiv5566494881gmail-m_445885225468719375ydpe90b4074yiv4218574043gmail-m_20558058468712755ydp31fd7335yahoo_quoted_9441686936">
            <div style="font-family:Helvetica,Arial,sans-serif;font-size:13px;color:rgb(38,40,42)">
                
                <div>
                    On Friday, December 3, 2021, 06:15:54 PM EST, Bob Kirnum <<a shape="rect" href="mailto:bkirnum@gmail.com" rel="nofollow" target="_blank">bkirnum@gmail.com</a>> wrote:
                </div>
                <div><br clear="none"></div>
                <div><br clear="none"></div>
                <div><div dir="ltr">G.711 is 8 bits, could be an issue. Also, not sure if you need to downsample to 8kHz manually or not. <br clear="none"><div id="gmail-m_-537549619685141958ydp7401e40byiv5566494881gmail-m_445885225468719375ydpe90b4074yiv4218574043gmail-m_20558058468712755ydp31fd7335yqtfd51216"><br clear="none">> On Dec 3, 2021, at 5:36 PM, Robert Smith via Libav-user <<a shape="rect" href="mailto:libav-user@ffmpeg.org" rel="nofollow" target="_blank">libav-user@ffmpeg.org</a>> wrote:<br clear="none">> <br clear="none">> pCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16;</div><br clear="none">_______________________________________________<br clear="none">Libav-user mailing list<br clear="none"><a shape="rect" href="mailto:Libav-user@ffmpeg.org" rel="nofollow" target="_blank">Libav-user@ffmpeg.org</a><br clear="none"><a shape="rect" href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="nofollow" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br clear="none"><br clear="none">To unsubscribe, visit link above, or email<br clear="none"><a shape="rect" href="mailto:libav-user-request@ffmpeg.org" rel="nofollow" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<div id="gmail-m_-537549619685141958ydp7401e40byiv5566494881gmail-m_445885225468719375ydpe90b4074yiv4218574043gmail-m_20558058468712755ydp31fd7335yqtfd92186"><br clear="none"></div></div></div>
            </div>
        </div></div>_______________________________________________<br clear="none">
Libav-user mailing list<br clear="none">
<a shape="rect" href="mailto:Libav-user@ffmpeg.org" rel="nofollow" target="_blank">Libav-user@ffmpeg.org</a><br clear="none">
<a shape="rect" href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="nofollow" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br clear="none">
<br clear="none">
To unsubscribe, visit link above, or email<br clear="none">
<a shape="rect" href="mailto:libav-user-request@ffmpeg.org" rel="nofollow" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br clear="none">
</blockquote></div></div>
</div></div><div id="gmail-m_-537549619685141958ydp7401e40byiv5566494881gmail-m_445885225468719375ydpe90b4074yqt65474">_______________________________________________<br clear="none">Libav-user mailing list<br clear="none"><a shape="rect" href="mailto:Libav-user@ffmpeg.org" rel="nofollow" target="_blank">Libav-user@ffmpeg.org</a><br clear="none"><a shape="rect" href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="nofollow" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br clear="none"><br clear="none">To unsubscribe, visit link above, or email<br clear="none"><a shape="rect" href="mailto:libav-user-request@ffmpeg.org" rel="nofollow" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br clear="none"></div></div>
            </div>
        </div></div>_______________________________________________<br clear="none">
Libav-user mailing list<br clear="none">
<a shape="rect" href="mailto:Libav-user@ffmpeg.org" rel="nofollow" target="_blank">Libav-user@ffmpeg.org</a><br clear="none">
<a shape="rect" href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="nofollow" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br clear="none">
<br clear="none">
To unsubscribe, visit link above, or email<br clear="none">
<a shape="rect" href="mailto:libav-user-request@ffmpeg.org" rel="nofollow" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br clear="none">
</blockquote></div></div>
</div></div><div id="gmail-m_-537549619685141958ydp7401e40byqt28614">_______________________________________________<br clear="none">Libav-user mailing list<br clear="none"><a shape="rect" href="mailto:Libav-user@ffmpeg.org" rel="nofollow" target="_blank">Libav-user@ffmpeg.org</a><br clear="none"><a shape="rect" href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="nofollow" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br clear="none"><br clear="none">To unsubscribe, visit link above, or email<br clear="none"><a shape="rect" href="mailto:libav-user-request@ffmpeg.org" rel="nofollow" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br clear="none"></div></div>
            </div>
        </div></div>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br>
</blockquote></div>