5

From ASP.Net, I am using FFMPEG to convert flv files on a Flash Media Server to wavs that I need to mix into a single MP3 file. I originally attempted this entirely with FFMPEG but eventually gave up on the mixing step because I don't believe it it possible to combine audio only tracks into a single result file. I would love to be wrong.

I am now using FFMPEG to access the FLV files and extract the audio track to wav so that SOX can mix them. The problem is that I must offset one of the audio tracks by a few seconds so that they are synchronized. Each file is one half of a conversation between a student and a teacher. For example teacher.wav might need to begin 3.3 seconds after student.wav. I can only figure out how to mix the files with SOX where both tracks begin at the same time.

My best attempt at this point is:

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 chosen based on my best research, but are not required. Any working solution would allow an ASP.Net service to input the two FMS flvs and create a combined MP3 using open-source or free tools.

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

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

I'm leaving the question open in case someone has a better approach than the combined FFMPEG/SOX solution.

Laramie
  • 5,457
  • 2
  • 39
  • 46
  • "sox -M student.wav teacher.wav combined.mp3 delay 2.8" solution works if each audio has one channel. if each sample is stereo I believe you can do "sox -M student.wav teacher.wav combined.mp3 delay 2.8 2.8 0 0". I think sox automatically alters the volume/gain though and something else has to be added to the command to make is sound right... Thanks for the solution! – sequenceGeek Sep 11 '12 at 21:20
  • Nvm, this is possibly a better generalized way to go about it: http://stackoverflow.com/questions/9327262/sox-mix-and-delay/12378408#12378408 – sequenceGeek Sep 11 '12 at 21:48

3 Answers3

1

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

ffmpeg -i student.flv -itsoffset 3.3 -i teacher.flv -vn -filter_complex amix out.mp3
blahdiblah
  • 33,069
  • 21
  • 98
  • 152
0

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

Community
  • 1
  • 1
Andriy Tylychko
  • 15,967
  • 6
  • 64
  • 112
0

well i suggest you should use flash. it may sounds weird, correct me if im wrong but with Flash's new multimedia abilities you can mix a couple tracks.

im not sure, but i'm just trying to help you, theese 2 link can help you for your aim (specially second link i guess);

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/

siniradam
  • 2,727
  • 26
  • 37