<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Arghh, I forgot to add in my previous mail these settings :</p>
<p>c->sample_fmt = SAMPLE_FMT_S16;</p>
<p>c->flags = CODEC_FLAG_GLOBAL_HEADER;<br>
</p>
<br>
<div class="moz-cite-prefix">On 9/23/2016 2:16 PM, Alex Grosu wrote:<br>
</div>
<blockquote cite="mid:f4e11892-b0c5-e9db-9716-ef9c96527b97@c-s.ro"
type="cite">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<p>One correction,</p>
<p>c->frame_size = 2560 (not 2650, typo)</p>
<p>Sorry for this</p>
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 9/23/2016 2:13 PM, Alex Grosu
wrote:<br>
</div>
<blockquote cite="mid:0e0998f8-1d31-e09b-ba8d-1225e5769f75@c-s.ro"
type="cite">
<meta http-equiv="content-type" content="text/html;
charset=utf-8">
Dear all<br>
<br>
I am having some issues in creating a G711 audio mkv container
with libavcodec on windows.<br>
I set the codec context (header) like this: <br>
c->codec_id = CODEC_ID_PCM_ALAW;<br>
c->codec_type = CODEC_TYPE_AUDIO;<br>
c->bit_rate = 64000;<br>
c->sample_rate = 8000;<br>
c->channels = 1;<br>
c->frame_size = 2650;<br>
c->channel_layout = 1;<br>
waveFormatEX = malloc(sizeof(WAVEFORMATEXTENSIBLE) +
FF_INPUT_BUFFER_PADDING_SIZE);<br>
waveFormatEX->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;<br>
waveFormatEX->Format.nChannels = 1;<br>
waveFormatEX->Format.nSamplesPerSec = 8000; <br>
waveFormatEX->Format.wBitsPerSample = 16;<br>
waveFormatEX->Format.nBlockAlign = 2;<br>
waveFormatEX->Format.nAvgBytesPerSec = 16000;<br>
waveFormatEX->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE);<br>
waveFormatEX->Samples.wSamplesPerBlock = 0;<br>
waveFormatEX->dwChannelMask = KSAUDIO_SPEAKER_MONO;<br>
waveFormatEX->SubFormat = KSDATAFORMAT_SUBTYPE_ALAW;<br>
c->extradata = (uint8_t*)waveFormatEX; <br>
c->extradata_size = waveFormatEX->Format.cbSize;<br>
<br>
The mkv container is created, ffplay can play it without
problems:<br>
<br>
This is the what ffplay outputs when playing the file:<br>
<br>
Input #0, matroska,webm, from 'c:\Users\alex\Bus
standard-37-Enregistreur Xebra3<br>
--2016-09-15(0h 1m 0s)\Cam 1 Flux audio.mkv':<br>
Metadata:<br>
encoder : Lavf52.78.1<br>
Duration: 00:01:52.00, start: 0.000000, bitrate: 34 kb/s<br>
Stream #0:0: Audio: pcm_alaw ([6][0][0][0] / 0x0006), 8000
Hz, 1 channels, s<br>
16, 64 kb/s (default)<br>
Stream #0:1(fra): Subtitle: subrip (default)<br>
8.94 M-A: -0.000 fd= 0 aq= 421KB vq= 0KB sq= 0B
f=0/0<br>
<br>
The sound can be heard witthout problems. The file should have ~
1 minute, but ffplay say the duration is 1:52<br>
<br>
The vlc player instead has issues in playing the file. The sound
is heard but with "gaps", something related to pts?<br>
This is the info from vlc about the file:<br>
Type: Audio<br>
Codec: PCM ALAW(alaw)<br>
Channels: Mono<br>
Sample rate: 8000 Hz<br>
Bits per sample: 16<br>
And here are some warnings while playing the file:<br>
<span style=" font-style:italic; color:#00008b;">core</span><span
style=" font-style:italic; color:#008000;"> warning: </span>playback
way too early (-170000): playing silence
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-style:italic; color:#00008b;">core</span><span
style=" font-style:italic; color:#808080;"> debug: </span>inserting
1360 zeroes</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-style:italic; color:#00008b;">core</span><span
style=" font-style:italic; color:#008000;"> warning: </span>playback
way too early (-150000): playing silence</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-style:italic; color:#00008b;">core</span><span
style=" font-style:italic; color:#808080;"> debug: </span>inserting
1200 zeroes</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-style:italic; color:#00008b;">core</span><span
style=" font-style:italic; color:#008000;"> warning: </span>playback
way too early (-170000): playing silence</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-style:italic; color:#00008b;">core</span><span
style=" font-style:italic; color:#808080;"> debug: </span>inserting
1360 zeroes</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-style:italic; color:#00008b;">core</span><span
style=" font-style:italic; color:#008000;"> warning: </span>playback
way too early (-150000): playing silence</p>
<br>
<br>
Can somebody please guide how to properly set G.711
(CODEC_ID_PCM_ALAW) in libavcodec?<br>
Thank you a lot for reading this long post<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Libav-user mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a>
</pre>
</blockquote>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Libav-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
<a class="moz-txt-link-freetext" href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a>
</pre>
</blockquote>
<br>
</body>
</html>