Hi all,
I have been trying to encode audio in g726 format using ffenc_g726.
I am using audiotestsrc plugin to generate the audio signal.
Here is the gst-launch-0.10 that I have used
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
The output status information and property notification from the command is
Setting pipeline to PAUSED ...
/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 Pipeline is PREROLLING ... /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 /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 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 /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 /pipeline0/filesink0.sink: caps = audio/x-adpcm, rate=(int)8000, channels=(int)1, layout=(string)g726, block_align=(int)0, bitrate=(int)16000 Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock There is no data written to the test.726 output file. And the pipeline never exits untill I press Ctrl+C. Inorder to check whether any other adpcm encoder of ffmpeg gives the same problem I tried the following command
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
The output status information and property notification from the command is
Setting pipeline to PAUSED ...
/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 Pipeline is PREROLLING ... /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 /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 /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 /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 /pipeline0/filesink0.sink: caps = audio/x-adpcm, rate=(int)8000, channels=(int)1, layout=(string)microsoft, block_align=(int)1024, bitrate=(int)16000 Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock Got EOS from element "pipeline0". Execution ended after 7954818 ns. Setting pipeline to PAUSED ... Setting pipeline to READY ... /pipeline0/filesink0.sink: caps = NULL /pipeline0/ffenc_adpcm_ms0.src: caps = NULL /pipeline0/ffenc_adpcm_ms0.sink: caps = NULL /pipeline0/capsfilter0.src: caps = NULL /pipeline0/capsfilter0.sink: caps = NULL /pipeline0/audiotestsrc0.src: caps = NULL Setting pipeline to NULL ... FREEING pipeline ... In this case the pipeline exits normally and data is written to the test.adpcm file. From the debug messages I see that the only difference is that the src caps of the encoders are different. in the ffenc_adpcm_ms case the block_align=1024 and in the ffenc_g726 block_align=0. Is this the reason why the pipeline with ffenc_g726 hangs??
I debugged both the pipelines with gdb
and checked the
gst_ffmpegenc_chain_audio (GstPad * pad, GstBuffer * inbuf)
In the case of ffenc_adpcm_ms once the ffmpegenc->cache has been loaded the value of ffmpegenc->context->frame_size > 0
But in the case of ffenc_g726 once the ffmpegenc->cache has been loaded the value of ffmpegenc->context->frame_size = 0
I will try to describe what happens using the code below for ffenc_g726
gst_ffmpegenc_chain_audio (GstPad * pad, GstBuffer * inbuf)
{ :
:
in_size = size; /* For the first call of chain function when there is a valid input buffer the size == in_size*/ if (ffmpegenc->cache) in_size += GST_BUFFER_SIZE (ffmpegenc->cache); /* This increments the size of the incoming buffer once there is a valid ffmpegenc->cache*/ :
:
while (1) {
/* do we have enough data for one frame? */ if (in_size / (2 * ffmpegenc->context->channels) < /* Number of channels == 1 */ ffmpegenc->context->frame_size) { /* Here the frame_size is 0 (for ffenc_g726) once the ffmpegenc->cache has been loaded above */ :
:
return GST_FLOW_OK; /* So it never returns GST_FLOW_OK as long as the frame_size is 0 */
} /* create the frame */
if (in_size > size) { : :
} else { /* Since in_size == size it enters here and creates a buffer of 0 size */ subbuf = gst_buffer_create_sub (inbuf, size - in_size, frame_size); GST_BUFFER_DURATION (subbuf) = GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size; GST_BUFFER_TIMESTAMP (subbuf) = GST_BUFFER_TIMESTAMP (inbuf) + (GST_BUFFER_DURATION (inbuf) * (size - in_size) / size); } :
:
ret = gst_pad_push (ffmpegenc->srcpad, outbuf);
in_size -= frame_size;
/* Here is the catch. Since the first frame_size is 0 the in_size never decrements and the
execution is stuck in an infinite loop. As the value of ffmpegenc->context->frame_size never
changes from 0 as the ffmpegenc->cache is never reloaded */
return ret;
} If someone can please help me by telling me how and who sets the ffmpegenc->context->frame_size as I see from the code that the value comes from one of the parent pad.
GstFFMpegEnc *ffmpegenc = (GstFFMpegEnc *) (GST_OBJECT_PARENT (pad));
I would like to know 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.
If I have missed something or am doing something wrong please let me know.
If there is an alternate solution please let me know.
Please help me resolve this problem.
I would like to thank all the people who have taken the time in reading my mail.
The versions of software I use are as follows:
glib-2.18.0
gst-ffmpeg-0.10.5
gstreamer-0.10.20
gst-plugins-ugly-0.10.9
gst-plugins-good-0.10.10
gst-plugins-base-0.10.20
2.6.24-19 ubuntu linux running on VMware.
I appreciate any help you can provide in resolving this problem.
Thankyou in advance for your time and help Kind Regards
-Chandresh
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |