I am working in C++ with ogg/vorbis
I have an array with raw PCM data decoded from a vorbis file (.ogg). The .ogg file has been decoded using libvorbis using vorbis_synthesis_pcmout. This fills a multidimentional array with the raw PCM for each channel.
I'm sure Gstreamer is capable of reading pure PCM, I have searched for the pluginto but to no avail. I'm sure I am just overlooking something simple here.
You might be looking for appsrc .
A PCM file is generally stored in .wav format. SO you can use wavparse plugin to play raw PCM.
Related
I have some question about Gstreamer. I want to use Gstreamer to write buffer to file descriptor when receiving audio/video. I've tried to look up in GstBuffer function but It's cannot decoding binary file to audio. (I've been using Audacity to convert this raw binary file to media.) Please suggest me to implement that.
PS. Sorry for my bad in English, I'll try to more practices. :)
I'm developing app which sends mpeg2ts stream using FFMPEG API.(avio_open, avformat_new_stream etc..)
The problem is that the app already has AAC-LC audio so audio frame does not need to be encoded because my app just bypass data received from socket buffer.
To open and send mpegts using FFMPEG, I must have AVFormattContext data which is created from FFMPEG API for encoder as far as I know.
Can I create AVFormatContext manually with encoded AAC-LC data? or I should decode and encode the data? The information I know is samplerate, codec, bitrate..
Any help will be greatly appreciated. Thanks in advance.
Yes, you can use the encoded data as-is if your container supports it. There are two steps involved here - encoding and muxing. Encoding compress the data, muxing mixes it together in the output file, so the packets are properly interleaved. Muxing example in FFMpeg distribution helped me with this.
You might also take a look at the following class: https://sourceforge.net/p/karlyriceditor/code/HEAD/tree/src/ffmpegvideoencoder.cpp - this file is from one of my projects, and contains video encoder. Starting from the line 402 you'll see the setup for non-converted audio - it is kind of a hackish way, but it worked. Unfortunately I still end up reencoding audio because for my formats it was not possible to achieve frame-perfect synchronization which I needed
Currently I am receiving video stream(H264 encoded buffer) and audio stream(PCMU encoded buffer) from remote end from which I can decode and render these as audio and video. Now I want to provide some APIs like -
string fileName = "dir/dir2/..../rec.mp4";
startRecord()
stopRecord()
User can start recording from any time and stop recording and the video & audio stream will be written as combined mp4 file. I can use ffmpeg by which I can merge a .h264 and .wav file as .mp4 file. But I want to do it programmatically directly from streams(not .h264 or .wav file) using any library or write my own. Is it possible?
See this answer for details. However, mp4 doesn't support G.711 PCM mu-law encoded data, either avi or mov can be used or trans-code the data from pcm to aac will work.
I currently working on a project simulate webcam video transmission in C++, at sender side, I capture the raw webcame video with v4l2, encoded with FFmpeg, video file are put into an array and transmitted. And at decoder side, video data received to an array, decoded and play. The program works fine with codec_id AV_CODEC_ID_MPEG1VIDEO, but when I try replace it with AV_CODEC_ID_H264, some problem happen in decoding, please refer to FFmpeg c++ H264 decoding error. Some people suggest me to use parser but I have no idea how is a parse in ffmpeg looks like. Any simple example of how to build a parser for H.264 in FFmepg? I cannot find such tutorial in google.....
I learned how to encode wav into an mp3 using lame_encode_buffer_interleaved from this question: Is there any LAME c++ wraper\simplifier (working on Linux Mac and Win from pure code)?
Now I want to decode the mp3 back into wav. I know there's lame_decode but I don't know how to use it since it requires two pcm buffers (pcm_l and pcm_r). I don't understand how to put them together into a well-formed wav file, because I don't really know how they works.
Now can someone provide a simple working example on decoding an mp3 into a wav using lame in C/C++?
Thanks.
Take a look into the lame frontend source code. Start at the lame_decoder() function in the .../frontend/lame_main.c file, it decodes an MP3 file and writes the wave header.