<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Hi all,</DIV>
<DIV>I have been trying to encode audio in g726 format using ffenc_g726.</DIV>
<DIV>I am using audiotestsrc plugin to generate the audio signal.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Here is the gst-launch-0.10 that I have used</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="arial, helvetica, sans-serif" size=2>&nbsp;gst-launch-0.10 -v audiotestsrc num-buffers=100 ! audio/x-raw-int,rate=8000,channels=1,depth=16,width=16,endianness=1234,signed=true ! ffenc_g726 bitrate=32000 ! filesink location=/home/chandresh/Linux/Temp/test.726</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>The output status information and property notification from the&nbsp;command is </DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="arial, helvetica, sans-serif" size=2>&nbsp;Setting pipeline to PAUSED ...<BR>/pipeline0/audiotestsrc0.src: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)8000, channels=(int)1<BR>Pipeline is PREROLLING ...<BR>/pipeline0/capsfilter0.src: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)8000, channels=(int)1<BR>/pipeline0/capsfilter0.sink: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)8000, channels=(int)1<BR><BR>&nbsp;Inside G726_init/pipeline0/ffenc_g7260.src: caps = audio/x-adpcm, rate=(int)8000, channels=(int)1, layout=(string)g726, block_align=(int)0, bitrate=(int)16000<BR>/pipeline0/ffenc_g7260.sink: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)8000,
 channels=(int)1<BR>/pipeline0/filesink0.sink: caps = audio/x-adpcm, rate=(int)8000, channels=(int)1, layout=(string)g726, block_align=(int)0, bitrate=(int)16000<BR>Pipeline is PREROLLED ...<BR>Setting pipeline to PLAYING ...<BR>New clock: GstSystemClock<BR></FONT><BR>There is no data written to the test.726 output file. And the pipeline never exits untill I press Ctrl+C.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Inorder to check whether any other adpcm encoder of ffmpeg gives the same problem I tried the following command</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;<FONT face="arial, helvetica, sans-serif" size=2>gst-launch-0.10 -v audiotestsrc num-buffers=100 ! audio/x-raw-int,rate=8000,channels=1,depth=16,width=16,endianness=1234,signed=true ! ffenc_adpcm_ms bitrate=16000 ! filesink location=/home/chandresh/Linux/Temp/test.adpcm</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="times new roman, new york, times, serif">The output status information and property notification from the command is </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="arial, helvetica, sans-serif" size=2>Setting pipeline to PAUSED ...<BR>/pipeline0/audiotestsrc0.src: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)8000, channels=(int)1<BR>Pipeline is PREROLLING ...<BR>/pipeline0/capsfilter0.src: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)8000, channels=(int)1<BR>/pipeline0/capsfilter0.sink: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)8000, channels=(int)1<BR>/pipeline0/ffenc_adpcm_ms0.src: caps = audio/x-adpcm, rate=(int)8000, channels=(int)1, layout=(string)microsoft, block_align=(int)1024, bitrate=(int)16000<BR>/pipeline0/ffenc_adpcm_ms0.sink: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)8000, channels=(int)1<BR>/pipeline0/filesink0.sink: caps =
 audio/x-adpcm, rate=(int)8000, channels=(int)1, layout=(string)microsoft, block_align=(int)1024, bitrate=(int)16000<BR>Pipeline is PREROLLED ...<BR>Setting pipeline to PLAYING ...<BR>New clock: GstSystemClock<BR>Got EOS from element "pipeline0".<BR>Execution ended after 7954818 ns.<BR>Setting pipeline to PAUSED ...<BR>Setting pipeline to READY ...<BR>/pipeline0/filesink0.sink: caps = NULL<BR>/pipeline0/ffenc_adpcm_ms0.src: caps = NULL<BR>/pipeline0/ffenc_adpcm_ms0.sink: caps = NULL<BR>/pipeline0/capsfilter0.src: caps = NULL<BR>/pipeline0/capsfilter0.sink: caps = NULL<BR>/pipeline0/audiotestsrc0.src: caps = NULL<BR>Setting pipeline to NULL ...<BR>FREEING pipeline ...</FONT><BR><BR>In this case the pipeline exits normally and data is written to the test.adpcm file.<BR><BR>From the debug messages I see that the only difference is that the src caps of the encoders are different.<BR>in the ffenc_adpcm_ms case the block_align=1024 and in the ffenc_g726
 block_align=0.</DIV>
<DIV>Is this the reason&nbsp;why the pipeline with ffenc_g726 hangs??</DIV>
<DIV>&nbsp;</DIV>
<DIV>I debugged both the pipelines with gdb</DIV>
<DIV>&nbsp;</DIV>
<DIV>and checked the </DIV>
<DIV><FONT face="arial, helvetica, sans-serif" size=2>gst_ffmpegenc_chain_audio (GstPad * pad, GstBuffer * inbuf)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="times new roman, new york, times, serif">In the case of ffenc_adpcm_ms once the ffmpegenc-&gt;cache has been loaded the&nbsp;value&nbsp;of ffmpegenc-&gt;context-&gt;frame_size &gt; 0</FONT></DIV>
<DIV><FONT face="times new roman, new york, times, serif">But in the case of ffenc_g726 once the ffmpegenc-&gt;cache has been loaded the value of ffmpegenc-&gt;context-&gt;frame_size = 0</FONT></DIV>
<DIV><FONT face="times new roman, new york, times, serif">I will try to describe what happens using the code below for ffenc_g726</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>gst_ffmpegenc_chain_audio (GstPad * pad, GstBuffer * inbuf)<BR>{</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; :</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; :<BR></FONT><FONT face=Arial size=2>&nbsp; in_size = size;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* For the first call of&nbsp;chain function when there is a valid input buffer the size == in_size*/<BR>&nbsp; if (ffmpegenc-&gt;cache)<BR>&nbsp;&nbsp;&nbsp; in_size += GST_BUFFER_SIZE (ffmpegenc-&gt;cache); &nbsp;&nbsp;&nbsp; /* This&nbsp;increments the size of the incoming buffer once there is a valid ffmpegenc-&gt;cache*/</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; :</FONT></DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; :</DIV>
<DIV><FONT face=Arial size=2>&nbsp; while (1) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* do we have enough data for one frame? */<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (in_size / (2 * ffmpegenc-&gt;context-&gt;channels) &lt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* Number of channels == 1 */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ffmpegenc-&gt;context-&gt;frame_size) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* Here the frame_size is 0 (for ffenc_g726) once the&nbsp;ffmpegenc-&gt;cache has been loaded above */</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; :</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; :</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return GST_FLOW_OK; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* So it never returns GST_FLOW_OK as long as the frame_size is 0 */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* create the frame */<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (in_size &gt; size) {<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; :</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else { &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* Since in_size == size it enters here&nbsp;and creates a buffer of 0 size */<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; subbuf = gst_buffer_create_sub (inbuf, size - in_size, frame_size);<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GST_BUFFER_DURATION (subbuf) =<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE
 (subbuf) / size;<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GST_BUFFER_TIMESTAMP (subbuf) =<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; GST_BUFFER_TIMESTAMP (inbuf) + (GST_BUFFER_DURATION (inbuf) *<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (size - in_size) / size);<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; :</FONT></DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; :</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ret = gst_pad_push (ffmpegenc-&gt;srcpad, outbuf);</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; in_size -= frame_size;</FONT></DIV>
<DIV><FONT face=Arial size=2>/* Here is the catch. Since the first frame_size is 0 the in_size&nbsp;never decrements and the</FONT></DIV>
<DIV><FONT face=Arial size=2>execution is stuck in&nbsp;an infinite loop. As the&nbsp; value of </FONT><FONT face="Times New Roman" size=3><FONT face=Arial size=2>ffmpegenc-&gt;context-&gt;frame_size&nbsp;never</FONT></FONT></DIV>
<DIV><FONT face="Times New Roman" size=3>c</FONT><FONT face=Arial size=2>hanges from 0 as the ffmpegenc-&gt;cache is never reloaded */</FONT><BR></DIV>
<DIV><FONT face=Arial size=2>&nbsp; return ret;<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="times new roman, new york, times, serif">If someone can please help me by telling me how and who sets the ffmpegenc-&gt;context-&gt;frame_size as I see from the code that the value comes from one of the parent pad.</FONT></DIV>
<DIV>&nbsp; <FONT face="arial, helvetica, sans-serif" size=2>GstFFMpegEnc *ffmpegenc = (GstFFMpegEnc *) (GST_OBJECT_PARENT (pad));</FONT></DIV>
<DIV>I would like to know&nbsp;who sets the value of framesize in the pad and how is it set? I have not seen any settable property or caps value on either audiotestsrc or ffenc_g726.</DIV>
<DIV>&nbsp;</DIV>
<DIV>If I have missed something or am doing something wrong please let me know.</DIV>
<DIV>If there is an alternate solution please let me know.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Please help me resolve this problem.</DIV>
<DIV>I would like to thank all the people who have taken the time in reading my mail.</DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV>The&nbsp;versions of software I use are as follows:</DIV>
<DIV>glib-2.18.0</DIV>
<DIV>gst-ffmpeg-0.10.5</DIV>
<DIV>gstreamer-0.10.20</DIV>
<DIV>gst-plugins-ugly-0.10.9</DIV>
<DIV>gst-plugins-good-0.10.10</DIV>
<DIV>gst-plugins-base-0.10.20</DIV>
<DIV>2.6.24-19 ubuntu linux running on VMware.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I appreciate any help you can provide in resolving this problem.</DIV>
<DIV>Thankyou in advance for your time and help</DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>Kind Regards</DIV>
<DIV>-Chandresh</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></div><br>



      </body></html>