<div><font face="Arial">Hi</font></div>
<div> </div>
<div><font face="Arial">I checked <strong>doc/examples/muxingc.c</strong> 
file where an example generating MPEG AV file is explained. Then I try to change 
AV format to "<strong>webm</strong>" (video is encoded with VP8 and audio with 
vorbis encoder). I have problems with setting the right parameters for vorbis 
encoder. When I debugging through the code I figured out that vorbis only accepts 
(AV_SAMPLE_FMT_FLTP) sample format type. Example was done 
with (AV_SAMPLE_FMT_S16). I looked into source code to figure out that when I 
call <strong></strong></font></div>
<div><font face="Arial"><strong></strong></font> </div>
<div><font face="Arial"><strong>av</strong><font face="Consolas"><font face="Arial"><strong>codec_fill_audio_frame(AVFrame, channels, 
sample_format, buffer, buf_size, align)</strong>, </font></font></font></div>
<div> </div>
<div><font face="Arial"><font face="Consolas"><font face="Arial">in case of AV_SAMPLE_FMT_FLTP the buffer should be type 
<strong>float*</strong> and audio samples should have values between -1.0 to 
1.0. For more than one channel values are <strong>not interleaved </strong>(FLTP 
- float plain) but they are followed by each other (array: all values for 
channel0, all values for channel 1, ...).</font></font></font></div>
<div> </div>
<div><font face="Arial">When I accept those changes in my code, 
unfortunately I still don't get correct result. If I use mono (1 channel only) 
then the flag (<font face="Consolas"><font face="Arial">got_packet</font></font>) returned from function <font face="Consolas"><font face="Arial"><strong>avcodec_encode_audio2</strong> is 
set only once (after around 5 consecutive calls), with <font face="Consolas"><font face="Consolas"><strong><font face="Arial">AVPacket->pts</font></strong> </font></font>timestamp set to some 
huge values. Because of that only video is encoded.</font></font></font></div>
<div><font face="Arial">When I set stereo mode I get error from function 
<font face="Consolas"><font face="Arial"><strong>av_interleaved_write_frame</strong> 
(-12).</font></font></font></div>
<div> </div>
<div><font face="Arial">I tested the same code and setting AV format to 
"<strong>asf</strong>", where audio is encoded with WMA2 encoder and also 
accepts AV_SAMPLE_FMT_FLTP sample format type. I got correct AV file which can 
be played with VLC player or Windows media player.</font></div>
<div> </div>
<div><font face="Arial">I think I still need to set some flags for vorbis 
encoder, but I can't figure out. I would appreciate any suggestions.</font></div>
<div> </div>
<div><font face="Arial">Best regards</font></div>
<div> </div>
<div><font face="Arial">For audio encoder I set those 
parameters:</font></div>
<div> </div><font face="Consolas"><font face="Arial">
<div>c->sample_fmt = AV_SAMPLE_FMT_FLTP;</div>
</font></font><div><font face="Consolas"><font face="Consolas"><font face="Arial">c->sample_rate = 44100; </font></font></font></div><font face="Consolas"><font face="Consolas">
<div><font face="Arial">c->channels = 1; </font></div>
<div> </div>
<div><font face="Arial">My code to prepare samples in AV_SAMPLE_FMT_FLTP sample 
format:</font></div><font color="#0000ff" face="Consolas"><font color="#0000ff" face="Consolas"><font color="#0000ff" face="Consolas">
<div> </div>
</font></font></font><div><font color="#0000ff" face="Consolas"><font color="#0000ff" face="Consolas"><font color="#0000ff" face="Consolas"><font color="#000000" face="Arial">void</font></font></font></font><font face="Arial"><font><font> 
TT_Transcode::get_audio_frame_fltp(</font></font><font><font><font>float</font></font></font><font><font> *fsamples, 
</font></font><font><font><font>int</font></font></font><font><font> frame_size, 
</font></font><font><font><font>int</font></font></font></font><font><font><font face="Arial"> nb_channels)</font></font></font></div><font><font>
<div><font face="Arial">{</font></div>
</font></font><div><font color="#0000ff"><font color="#0000ff"><font color="#0000ff" face="Arial">    int</font></font></font><font><font><font face="Arial"> j, i;</font></font></font></div><font><font>
</font></font><div><font color="#0000ff"><font color="#0000ff"><font color="#0000ff" face="Arial">    float</font></font></font><font><font><font face="Arial"> v;</font></font></font></div><font><font>
</font></font><div><font color="#0000ff"><font color="#0000ff"><font color="#0000ff" face="Arial">    float</font></font></font><font><font><font face="Arial"> *q;</font></font></font></div><font><font>
</font></font><div><font><font><font face="Arial">    </font></font></font><font color="#0000ff"><font color="#0000ff"><font color="#0000ff" face="Arial">for</font></font></font><font><font><font face="Arial"> 
(j = 0; j < frame_size; j++) {</font></font></font></div><font><font>
<div><font face="Arial">        v = (sin(t) * 10000.0) / 32767.0f; //values 
between -1.0 and +1.0</font></div>
<div><font face="Arial">        fsamples[ j ] = v;</font></div>
</font></font><div><font color="#0000ff"><font color="#0000ff"><font color="#0000ff" face="Arial">        for</font></font></font><font face="Consolas"><font face="Consolas"><font face="Arial"> (i = 1; i < 
nb_channels; i++)</font></font></font></div><font face="Consolas"><font face="Consolas">
<div><font face="Arial">        {</font></div>
<div><font face="Arial">            fsamples[i * in_linesize + j] = 
v;</font></div>
<div><font face="Arial">        } </font></div>
<div><font face="Arial">        t += tincr;</font></div>
<div><font face="Arial">        tincr += tincr2;</font></div>
<div><font face="Arial">    }</font></div>
<div><font face="Arial">}</font></div></font></font></font></font>