PDA

View Full Version : FFMPEG Video conversions


Priyatam
9th April 2007, 15:53
Hi All,

I have a small problem with file conversion using FFMPEG.

I have an MP4 file which is a result of mixing a MP4[with default audio] and a WAV audio file.

code:

ffmpeg -i vid.mp4 -s qcif -i Aud.wav -ab 32 -b 144000 -acodec aac output.mp4 -acodec aac -ab 32 -newaudio

Now i want to convert this output.mp4 MP4 file to an MPEG file using FFMPEG with both the default and the overlaid wav audio prserved.


FFMPEG does write an output MPG file but it does not preserve the Aud.wav that was mixed to the vid.mp4.

This was my code: [ I have tried different options but in vain..so i removed the options here]

code :

ffmpeg -i output.mp4 output.mpg

what options would preserve the complete audio video details of the file.

Any help/suggestions would be appreciated.

Thanks in Advance.

foxyshadis
9th April 2007, 18:37
Try using adding -vcodec copy -acodec copy to the commandline, see if that helps. It may be difficult to extract a non-standard stream though.

Priyatam
10th April 2007, 14:29
I have successfully mixed the audios on to the video. But it encodes the audio as a separate track. How do we merge all the tracks into a single audio track. Where i try to play output mp4 file in VLC, the 3 different audio tracks are displayed. Only one audio track is playing upon selection. All the two tracks do not play along with the video. Your help is appreciated.

Thanks in advance.

mgh
10th April 2007, 18:12
You need to mix the audio from the original file and the wav file, mux with the video and then convert to mpg. What you are doing is making a file with two audio tracks. AFAIK, no encoder or player is going to mix the two audio tracks for you.

DarkZell666
10th April 2007, 22:43
Aha, having 2 audio tracks play at the same time has been a bug that happened with early versions of some players (sometimes because of the Morgan's stream switcher, sometimes not, but it isn't ffmpeg related anyway).

Mixing 2 audio tracks (and not muxing, which is a different term) is the job of audio editing software specifically, but you can get away with it using avisynth with very few lines of script.

Dunno if you actually found out by testing, but I think you would be better off specifying the -f switch explicitely (-f mpg or -f mpeg) for that 2nd cmd-line, since I'm not sure ffmpeg is capable of accurately detecting the output format just by the output filename extension (.mpg in your case). The file may work otherwise using ffplay or mplayer, but it can mislead you (it has mislead me quite a few times already =)), since ffplay/mplayer are ... tolerant, and play virtually anything without telling you something's wrong.

Just my 0.02€.