Gstreamer audio input to mp3 - c

I am trying to create a simple program using Gstreamer to take the input from a microphone and save it to a mp3 file. I keep getting
Internal data flow error
and canĀ“t seem to find the problem(I am new to Gstreamer).
Here is a link to my code:
http://pastebin.com/QDexe8Fz

Your code is not handling return codes from the functions. As a result your in the dark when it fails. Anyway in your code you forgot to link the elements. Right after line 70, also do gst_element_link_many(....);

Traditionally, the GStreamer package doesn't include support for MP3. However, you can go after codecs and plugins to make it support.

Related

I cant use auxiliary functions from zephyr ( tty.h) file

I am building a project and I have the board stm nucleo_l496zg. All i want to do is to use the drivers from the board in order to communicate the board after west flash with minicom, it is a simple string transfer and response program. I am building this project with zephyr and my issue is that I cant use the functions tty_init , tty_read and tty_set_rx_buf despite that I use the proper include " #include <console/tty.h> ". The compiler returns an undefined reference to thoose three functions but in my program I am using another one function from tty.h header which is tty_set_timeout but at this function it doesnt say nothing. Though I notiched in that in here(documentation of tty.h) tty_Set_timeout is the only function that has something inside. I cant understand why I am getting that please if someone can help me let me know !
I had the same problem and I solve it by adding those lines to my .conf file:
CONFIG_SERIAL=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_CONSOLE_SUBSYS=y
CONFIG_CONSOLE_GETCHAR=y
And don't forget to mention the file (.conf file) also in your CMakeList.txt file:
set(CONF_FILE ***.conf)
Hope that it will work with you as well

How to add a file to the playlist of the mpd (Music Player Daemon)?

I wonder what I'm doing wrong?
I want to add a file to the mpd playlist with C.
The connection works and I can play a file, which I manually put in Gnome Music Player Client for example with:
mpd_send_play(conn);
but adding the file within a C code results in an error.
Thanks for any help?
const char *path = "/home/user/foo.mp3";
mpd_send_add(conn,path);
It's really hard for us to help you if you provide this little information. I'm assuming you're using libmpdclient to try to write an MPD client.
What error are you getting?
Did you #include <mpd/client.h> or are you picking and choosing header files that that one includes for you? mpd_send_add() is a function from mpd/queue.h, are you including that header?
Could you show more code or detail your build steps so we can try to recreate your error?

Allegro load_bitmap not working

i'm trying to load bitmap like this:
BITMAP *image = load_bitmap("picture.bmp", NULL);
when I test it:
if (image == NULL)
printf("No image loaded\n");
it prints No image loaded so load_bitmap doesn't work ... i have also tried absolute path but still nothing.
Im using Ubuntu and allegro 4.2
Some suggestions?
Did you try placing the image on the same location as the executable? After that is solved check this things also if still getting the error:
Is really a *.bmp file? A file of a different type can not be converted by just renaming it.
Is the file you are trying to read actually called like that? Check for spelling both in code and in the file explorer.
Does the program run correctly if executed from the file explorer or command-line but not from the IDE? If that is the case, then you should change the configuration of the workspace or project you are currently using so that the execution directory is the same as the one where the image file is located.
If all else fails then try following the steps of the tutorial again, perhaps you made something wrong. By the way, if this is your first C++ project I recommend you that instead go to more basic stuff and stick to the command-line for a while until you get the hang of the facilities the language and its libraries have to offer.

fetching waveform for visualization in c on any music files format (mp3/ogg/etc..)

I would like to know how can i fetch the a waveform from any music file format in order to visualize it using some kind of gui. i would like to use already written libraries instead of writing my own.
any ideas?
thanks!
And for a library to do what you ask, check out libsndfile.
That depends on the music file format. LameLib can be used for decoding mp3s, and libogg can be used for decoding oggs. Uncompressed wav files don't need to be decoded, since the file stores the raw PCM data; you just need to read in the file headers, and there's lots of sample code out there that shows you how to do that.
If a program that lets you visualize an audio waveform would help, try Audacity.

How would I use gstreamer to stitch a set of images together to form a video slideshow

I'd like to take a set of images and a sound track and use that to form a basic video slideshow using gstreamer.
There seems to be a lot of documentation and examples of basic gstreamer usage like playing a video or audio file, or even transcoding and the like. But I can't seem to find anything particularly useful for, I suppose, video editing tasks.
I feel that I have a decent grasp of the fundamentals of gstreamer, but I'm having trouble conceptualising how I would join the dots, so to speak. Specifically the bit where I take a set of images and turn them into a single video output.
The module MultiFileSrc will do that for you.
From the doc
The multifilesrc element is used to read a collection of sequentially named files, e.g., 00001.jpg, 00002.jpg, 00003.jpg, etc., into a GStreamer pipeline.
== Example Pipeline ==
This pipeline reads the files 00001.png, 00002.png, etc., decodes them, and then reencodes the video into Ogg/Theora.
gst-launch multifilesrc location=%05d.png \
caps="image/png,framerate=30/1,pixel-aspect-ratio=1/1" ! \
pngdec ! ffmpegcolorspace ! video/x-raw-yuv,format=(fourcc)I420 ! \
theoraenc ! oggmux ! filesink location=output.ogg
Use pitivi.
If you want to write the program anyway you should use gnonlin, the library pitivi is built upon. You would be putting together a gnlcompositon. See also http://wiki.pitivi.org/wiki/PyGST_Tutorial
Images Slideshow in Gstreamer
try this for an alternative solution. Worked for me.
Do you want to write a program? I think you should check out ffmpeg for making a video by providing a set of images. Its cross platform and hence may suit your need.
I hope it helps.
If you want related to gstreamer library then you can check out source code of various gstreamer based open source applications here.

Resources