How to convert audio file using ffmpeg API? - ffmpeg

How to convert PCM to flac using only ffmpeg API, but not the ffmpeg binary? I am looking for the full explanation of the process, but not only a solution

The best way is to look at the source of the ffmpeg binary itself, it uses the ffmpeg APIs itself. There are also code samples there. Here's the ffmpeg source code.

Related

Use FFMpeg libraries to read an audio file while it is being generated

I got an audio engine, which generates aac files. I want to mux this audio with some video. I'm using ffmpeg libraries to do just that - meaning, after the audio file is ready, I read it and mux it.
Now - for performance reasons, I don't want to wait until the audio engine completes the audio generation, I want the muxer to start reading the audio while it is being generated.
Can I achieve that using the FFMpeg libraries?
Which approach should I take?
Couldn't find any examples doing that

merge/mix multiple audio using ffmpeg

I need to merge/mix multiple audio file into one single audio file using ffmpeg api, I googled a lot but didn't find any useful code samples, could anyone help to provide some guide on how to do this with ffmpeg apis?
You can use SOX for this task. Check documentation http://sox.sourceforge.net/sox.html. FFMPEG is widely used for audio conversions from one format to another. SOX is the best library which is widely used for mixing or concatenating audios.

Media Foundation Encoder MF_E_TRANSCODE_NO_MATCHING_ENCODER

I am trying to convert from wmv to mp4.
First of do I need to implement my IMFTransform to do this ?
Do i need to convert the video to MFVideoFormat_I420 ?
As far as I know if you create the topology correctly this should be handled automatically.
So I created my profile showed in the
http://msdn.microsoft.com/en-us/library/windows/desktop/ff819476%28v=vs.85%29.aspx
but i get a MF_E_TRANSCODE_NO_MATCHING_ENCODER.
I have windows 7 so, i should have the encoder.
Also Does anyone know where the source code for that tutorial is. It is not under SDK samples.
Thanks.
You don't show code - noone knows what is wrong.
Take a look at this transcoding sample, which comes with source code and does exactly what you are trying to do: transcoding from ASF into MP4.
http://blogs.msdn.com/b/mf/archive/2009/12/02/mfsimpleencode.aspx
MFSimpleEncode.exe - This is a command line tool that transcodes files
from one media format to another. The source code is provided to use
as a reference if you write your own transcode application. This tool
uses the Media Foundation transcode API, which was introduced in
Windows 7.
Examples:
Transcode ASF to MPEG-4:
MFSimpleencode.exe –i Input.wmv –o output.mp4 –p TranscodeProfileMPEG4.xml

How do VLC and ffmpeg work together?

I compiled VLC from the source code and it works well. When I do ". / Vlc" vlc runs. I also compiled ffmpeg from source and it works well too. When I do "ffmpeg-i-f toto.flv mp3-vn-acodec copy new_toto.mp3", the file named "new_toto.mp3" is generated.
What I cannot understand is how VLC and ffmpeg work together? What part of VLC code uses ffmpeg code?
Is there a ffmpeg command to play (read) a video?
VLC does not embed FFmpeg as a sort of slave binary used internally, as you possibly could suppose. Instead, both FFmpeg and VLC are using libavcodec, a library which implement what ffmpeg exposes through its command line interface. So, FFmpeg supports VLC through supplying its libavcodec library to be one of the essential components on which the VLC is built as a player app.
Is there a ffmpeg command to play (read) a video?
ffplay video.mp4
ffplay is however a very stripped down video viewer, mostly only suitable for debugging video things and not for daily usage.
ffplay may be more accurate than VLC for some quirky formats, for example it can handle very low FPS video where VLC 2.2.4 could not: How to resize a picture using ffmpeg's sws_scale()?
Tested in Ubuntu 16.04, ffmpeg 2.8 with this minimal procedurally generated videos from: How to resize a picture using ffmpeg's sws_scale()?

FFMPEG command to combine a WAV file and a video file?

I use Qt & OpenCV to record video and QAudioInput to record audio into wav format. I want to combine them into one video file. How can I accomplish this? I have researched so much but I can't seem to find a command to accomplish this.
I use both Windows and Mac.
FYI, this operation seems to be accomplished through the cmd-line in this thread. This approach may turn into an easy hack since you can call this command using system().
But if you still want to do it programatically, I suggest you take a look at Dranger's FFmpeg tutorials. It provides 8 interesting tutorials that shows how to do simple stuff, from taking snapshots of a video to more complex stuffs like writing a simple video player with audio/video sync.
These tutorials teach how to work independently with audio and video streams, which is what you need to do: read the audio stream from the WAV file and then insert it as the audio stream of a video file.
Maybe not directly related to what you are aim for, but this answer demonstrates how to use FFmpeg to retrieve the audio stream of one file and play it with SDL, while simultaneously using OpenCV to retrieve video frames and display them in a SDL window.

Resources