[FFmpeg-user] Encoding FLV: video plays back slow relative to audio, etc.

Lou lou at lrcd.com
Tue Jul 5 00:02:16 CEST 2011


On Sun, 3 Jul 2011 13:29:10 -0400
Dave Kleinschmidt <dave.f.kleinschmidt at gmail.com> wrote:

> Hi all, I'm having a bit of trouble with encoding .avi files as .flv
> for flowplayer. I know this is a bit of a black art, and I've done
> quite a bit of looking around, but haven't seen much of anything.
> The symptoms: the audio plays back fine, but the video plays back at
> a slightly slower rate. In addition, the onFinish() events fires
> really late, a second or two after the video has finished.
> 
> I suspect that this is a problem with how I encoded my .flv file,
> since the Flowplayer sample .flv plays fine, with no lag, and the
> onFinish() event fires essentially immediately after the last frame.
> 
> Any suggestions would be very much appreciated. Unfortunately, I
> don't have a test site to link to, but here is a link to the
> original .avi file: http://db.tt/fpLLGSP
> 
> and here is the .flv: http://db.tt/CnjPIrI
> 
> Here is the ffmpeg call and its output for the actual conversion:
> 
> dkleinschmidt$ ffmpeg -y -i videos/VbA1.avi -ab 128000 -vcodec flv -r
> 25 videos/VbA1.flv

Is there a reason why you're changing the frame rate? Secondly, the
encoder called "flv" in FFmpeg is very poor compared to x264, and since
H.264 can work in the flv container just fine, and you already have it
enabled apparently, I don't see any reason not to use x264 instead:

ffmpeg -i input -vcodec libx264 -preset medium -crf 26 -threads 0 \
	-acodec libmp3lame -aq 5 output.flv

You may then have to run this output through flvtool++, flvtool2,
flvmeta, or any other similar tool. I'm not sure if this step is
necessary for flowplayer these days, but it's something to keep in mind
if it has trouble with the output from FFmpeg (such as incorrectly
displaying the duration for example).


More information about the ffmpeg-user mailing list