Hey,
I read through the GStreamer manual and searched in the internet but I don't really find a way to write an audio stream (bytes of audio data) to a file, preferably a wav file. I found a plugin called 'afsink' which seems to be able to write a wav file. But I don't know what my data source shall be. Is there a sort of buffer which I can hand over my data stream? Or can I directly feed the sink? I only found examples which read audio data from a file! Currently I'm using GStreamer 0.8.7 due restrictions. Please tell me if this version is too old for this kind of job. greetings.. ..Markus ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Markus Luttenberger schrieb:
> I read through the GStreamer manual and searched in the internet but I > don't really find a way to write an audio stream (bytes of audio data) ^^^^^^^^^^^^ > to a file, preferably a wav file. Data from memory, to be more specific... greetings.. ..Markus ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Administrator
|
If your task as simple as just to encode audio samples from memory and write them to a file in any suitable format (WAV, ASF, MP3, something else), I'd recommend using FFmpeg and its API (libavformat, libavcodec, etc). You just do the following: //init. av_register_all(); AVCodecContext *codec_ctx = avcodec_alloc_context(); AVCodec *m_codec = avcodec_find_decoder(CODEC_ID_MJPEG); avcodec_open(codec_ctx, codec); uint8_t *buf; short *samples; int buf_size; int bytes_used; // allocate buf // assign samples to point to your data //encode avcodec_encode_audio(codec_cts,buf,buf_size,samples); //write buf to a disk //cleanup avcodec_close(codec_ctx); av_free(codec_ctx); Details are here: http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/avcodec_8h.html#c41ab8ea9bc0fd3bcf8dc9d3b446f5d3 Even simpler, you can exec ffmpeg and feed it with data via a pipe. |
Vladimir Eremeev schrieb:
> Markus Luttenberger wrote: >>> I read through the GStreamer manual and searched in the internet but I >>> don't really find a way to write an audio stream (bytes of audio data) >> ^^^^^^^^^^^^ >>> to a file, preferably a wav file. >> Data from memory, to be more specific... >> > > If your task as simple as just to encode audio samples from memory and write > them to a file in any suitable format (WAV, ASF, MP3, something else), I'd > recommend using FFmpeg and its API (libavformat, libavcodec, etc). Yes, I know it's quite simple. Actually, I've already done it using the C library SNDFILE. But I need GStreamer as a cross-platform audio library to play sound (also from memory!) and first I wanted to re-write my WAVE file writer in order to get into GStreamer. I cannot use FFmpeg because it's not installed. I am only allowed to work with installed libraries that's why my GStreamer library is a little bit old. So, any specific tips for GStreamer? greetings.. ..Markus ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Markus Luttenberger
On Thu, 2009-12-17 at 15:03 +0100, Markus Luttenberger wrote:
Hi, > I read through the GStreamer manual and searched in the internet but I > don't really find a way to write an audio stream (bytes of audio data) > to a file, preferably a wav file. > > I found a plugin called 'afsink' which seems to be able to write a wav > file. But I don't know what my data source shall be. Is there a sort of > buffer which I can hand over my data stream? Or can I directly feed the > sink? I only found examples which read audio data from a file! > > Currently I'm using GStreamer 0.8.7 due restrictions. Please tell me if > this version is too old for this kind of job. GStreamer 0.8.7? From October 2004? Are you serious? I'm fairly sure what you want to do is doable even with such an old version. However, not only is that version more than five years old, but we've also had a major API/ABI change since then, so don't be surprised if no one remembers anything at all about 0.8.x. If all you want to do is write raw audio PCM data to disk as a .wav file, something like libsndfile might be a better fit. I wouldn't recommend using an ancient and unsupported GStreamer version. Cheers -Tim ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Administrator
|
In reply to this post by Markus Luttenberger
Not so many. I'm not familiar with it. You have to have a source, which would read your data from memory. Probably, you will have to write it yourself. And then, you'll need a sink, probably, autoaudiosink will do the job. Then, you have to create a pipe, put everything in it, connect and run a pipe. |
In reply to this post by Tim-Philipp Müller-2
Tim-Philipp Müller schrieb:
> I'm fairly sure what you want to do is doable even with such an old > version. However, not only is that version more than five years old, but > we've also had a major API/ABI change since then, so don't be surprised > if no one remembers anything at all about 0.8.x. Yes, you're probably right. I will talk about an upgrade. If this is not possible I'll have to stick to ALSA / DirectSound. And guess what, the ALSA version is already five years old... :/ greetings.. ..Markus ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |