[FFmpeg-user] Problem converting from FLV to MP4

Fernando Martinelli fernando.martinelli at gmail.com
Sun Jul 22 15:34:07 CEST 2012

Hi Carl,

I appreciate your quick answer!

Let me explain the reason why I'm not doing it with the sound:

I have as inputs:

   - Video 1 FLV + Audio 1
   - Video 2 FLV + Audio 2

The output I want:

   - Video 1 MP4 + Audio 1 + Audio 2
   - Video 2 MP4 + Audio 1 + Audio 2

So what I do is:

   1. Extract the audios of both files with ffmpeg and merge them with SOX
   2. Convert Video 1 and Video 2 to MP4 with ffmpeg
   3. Merge Video 1 with the merged Audios and then Video 2 with the same
   merged audios

I'm only doing it this way because I *did not manage to map two audio
streams to one output* video using ffmpeg. I would like to ideally map one
audio stream to one channel (left) of the output and the other audio input
to the other channel (right). Is there a way to do it that I don't know of?

Danke sehr für deine Hilfe!
Viele Grüße,

PS: The entire script is as follows (sorry but I can't paste the entire
output as it is huuuge - it has a lot of lines like this *invalid dropping
st:0** DTS 8520, next:10374000*...):

echo "Extracts sounds of video files"
ffmpeg -i $1$input_video_interviewer -vn -ar 44100 -ac 2 -ab 192 -f wav -y
ffmpeg -i $1$input_video_interviewee -vn -ar 44100 -ac 2 -ab 192 -f wav -y

#read -p "STEP 3- Extracted wav audio from flv videos"

echo "/n/nMixes both sounds for interviewer\`s video"
sox -M $2$3"audio_interviewer.wav" $2$4"audio_interviewee.wav"
#read -p "STEP 4- Sox mixed wav audio files"

echo "/n/nTransforms video 1 from flv to mp4"
ffmpeg -i $1$input_video_interviewer -i $2$3$4"both_audios.wav" -vcodec
libx264 -b:v 200k -r 24 -vf scale=320:240 -flags +loop+mv4 -cmp 256
-partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -me_method hex
-subq 7 -trellis 1 -refs 5 -bf 0 -coder 0 -me_range 16 -g 250 -keyint_min
25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10 -qmax 51 -qdiff 4 -ar 44100
-map 0:0 -map 1:0 -y $2$input_video_interviewer".mp4"

#read -p "STEP 1- Interviewer video has one audio track in mp4"

echo "/n/nTransforms video 2 from flv to mp4"
ffmpeg -i $1$input_video_interviewee -i $2$3$4"both_audios.wav" -vcodec
libx264 -b:v 200k -r 24 -vf scale=320:240 -flags +loop+mv4 -cmp 256
-partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -me_method hex
-subq 7 -trellis 1 -refs 5 -bf 0 -coder 0 -me_range 16 -g 250 -keyint_min
25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10 -qmax 51 -qdiff 4 -ar 44100
-map 0:0 -map 1:0 -y $2$input_video_interviewee".mp4"

#read -p "STEP 2- Interviewee video has one audio track in mp4"

echo "/n/nDeletes intermediate files"
rm -f $2$3"audio_interviewer.wav" $2$4"audio_interviewee.wav"

2012/7/22 Carl Eugen Hoyos <cehoyos at ag.or.at>

> Fernando Martinelli <fernando.martinelli <at> gmail.com> writes:
> > Although I managed to do that, some of my videos are changing a lot their
> > lengths, which is causing Audio-Video synchronization problems (as I'm
> > merging audio streams independently with SOX and merge audio and video at
> > the end).
> Why don't you process audio and video together?
> There will be samples where this is needed to keep A/V sync.
> > PS: Here is the command I'm using to convert the flv files and the
> > information of the input and output files (input has length 11:25 BUT
> > output 11:46)
> Please post complete, uncut console output together with your command
> line and if the problem is also reproducible without external
> libraries use -vcodec mpeg4.
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

Regards/ viele Grüße,

More information about the ffmpeg-user mailing list