Mix soundtracks with offset in SOX

From ASP.Net, I use FFMPEG to convert FLV files on Flash Media Server to wavs, which I need to mix into a single MP3 file. At first I tried to fully use FFMPEG, but in the end I refused the mixing stage, because I do not consider it possible to combine audio tracks in only one result file. I would like to be wrong.

Now I use FFMPEG to access FLV files and extract the audio track in wav so that SOX can mix them. The problem is that I have to compensate for one of the audio tracks for a few seconds so that they sync. Each file represents half the conversation between student and teacher. For example, teacher.wav might need to start 3.3 seconds after student.wav. I can only understand how to mix files with SOX, where both tracks start at the same time.

My best attempt at this point:

ffmpeg -y -i rtmp://server/appName/instance/student.flv -ac 1 student.wav ffmpeg -y -i rtmp://server/appName/instance/teacher.flv -ac 1 teacher.wav sox -m student.wav teacher.wav combined.mp3 splice 3.3 

These tools (FFMEG / SoX) were selected based on my best research, but are not required. Any working solution will allow ASP.Net to introduce two FMS flvs and create a combined MP3 using open or free tools.

EDIT: I was able to compensate for the files using the delay switch in SOX.

 sox -M student.wav teacher.wav combined.mp3 delay 2.8 

I leave the question open if anyone has a better approach than the FFMPEG / SOX combined solution.

+4
source share
3 answers

For what it's worth, it should be possible with a combination of -itsoffset and amix , but a bug with -itsoffset prevents this. If this works, the command will look something like this:

 ffmpeg -i student.flv -itsoffset 3.3 -i teacher.flv -vn -filter_complex amix out.mp3 
+1
source

mixing can be quite simple: how to mix two audio channels?

0
source

I suggest you use flash. it may seem strange, correct me if I'm wrong, but with the new Flash multimedia features you can mix a couple of tracks.

im not sure, but I'm just trying to help you, link 2 can help you in your goal (especially the second link, I think);

http://3d2f.com/programs/25-187-swf-to-mp3-converter-download.shtml

http://blog.debit.nl/2009/02/mp3-to-swf-converter-in-actionscript-3/

0
source

Source: https://habr.com/ru/post/1334132/


All Articles