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

Dave Kleinschmidt dave.f.kleinschmidt at gmail.com
Sun Jul 3 19:29:10 CEST 2011


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
ffmpeg version N-31022-g721719d, Copyright (c) 2000-2011 the FFmpeg developers
built on Jun 27 2011 17:21:27 with gcc 4.2.1 (Apple Inc. build 5664)
configuration: --enable-libx264 --enable-libmp3lame --enable-libfaac --enable-libvorbis --enable-libtheora --enable-gpl --enable-shared --enable-nonfree --enable-libvpx
libavutil    51. 10. 0 / 51. 10. 0
libavcodec   53.  7. 0 / 53.  7. 0
libavformat  53.  4. 0 / 53.  4. 0
libavdevice  53.  1. 1 / 53.  1. 1
libavfilter   2. 24. 0 /  2. 24. 0
libswscale    2.  0. 0 /  2.  0. 0
libpostproc  51.  2. 0 / 51.  2. 0
Input #0, avi, from 'videos/VbA1.avi':
Duration: 00:00:02.49, start: 0.000000, bitrate: 2882 kb/s
  Stream #0.0: Video: indeo3, yuv410p, 352x288, 30 tbr, 30 tbn, 30 tbc
  Stream #0.1: Audio: pcm_s16le, 22050 Hz, 1 channels, s16, 352 kb/s
Incompatible pixel format 'yuv410p' for codec 'flv', auto-selecting format 'yuv420p'
[buffer @ 0x1014007c0] w:352 h:288 pixfmt:yuv410p tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x1014020a0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x101402380] w:352 h:288 fmt:yuv410p -> w:352 h:288 fmt:yuv420p flags:0x4
Output #0, flv, to 'videos/VbA1.flv':
Metadata:
  encoder         : Lavf53.4.0
  Stream #0.0: Video: flv, yuv420p, 352x288, q=2-31, 200 kb/s, 1k tbn, 25 tbc
  Stream #0.1: Audio: libmp3lame, 22050 Hz, 1 channels, s16, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop, [?] for help
frame=   63 fps=  0 q=12.5 Lsize=     184kB time=00:00:02.52 bitrate= 597.7kbits/s dup=0 drop=12    
video:141kB audio:40kB global headers:0kB muxing overhead 1.561042%



Finally, this is the output of ffmpeg -i from each of the files:


$ ffmpeg -i videos/VbA1.avi
ffmpeg version N-31022-g721719d, Copyright (c) 2000-2011 the FFmpeg developers
built on Jun 27 2011 17:21:27 with gcc 4.2.1 (Apple Inc. build 5664)
configuration: --enable-libx264 --enable-libmp3lame --enable-libfaac --enable-libvorbis --enable-libtheora --enable-gpl --enable-shared --enable-nonfree --enable-libvpx
libavutil    51. 10. 0 / 51. 10. 0
libavcodec   53.  7. 0 / 53.  7. 0
libavformat  53.  4. 0 / 53.  4. 0
libavdevice  53.  1. 1 / 53.  1. 1
libavfilter   2. 24. 0 /  2. 24. 0
libswscale    2.  0. 0 /  2.  0. 0
libpostproc  51.  2. 0 / 51.  2. 0
Input #0, avi, from 'videos/VbA1.avi':
Duration: 00:00:02.49, start: 0.000000, bitrate: 2882 kb/s
  Stream #0.0: Video: indeo3, yuv410p, 352x288, 30 tbr, 30 tbn, 30 tbc
  Stream #0.1: Audio: pcm_s16le, 22050 Hz, 1 channels, s16, 352 kb/s



dkleinschmidt$ ffmpeg -i videos/VbA1.flv
ffmpeg version N-31022-g721719d, Copyright (c) 2000-2011 the FFmpeg developers
built on Jun 27 2011 17:21:27 with gcc 4.2.1 (Apple Inc. build 5664)
configuration: --enable-libx264 --enable-libmp3lame --enable-libfaac --enable-libvorbis --enable-libtheora --enable-gpl --enable-shared --enable-nonfree --enable-libvpx
libavutil    51. 10. 0 / 51. 10. 0
libavcodec   53.  7. 0 / 53.  7. 0
libavformat  53.  4. 0 / 53.  4. 0
libavdevice  53.  1. 1 / 53.  1. 1
libavfilter   2. 24. 0 /  2. 24. 0
libswscale    2.  0. 0 /  2.  0. 0
libpostproc  51.  2. 0 / 51.  2. 0
[flv @ 0x101807c00] Estimating duration from bitrate, this may be inaccurate

Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1)
Input #0, flv, from 'videos/VbA1.flv':
Metadata:
  duration        : 3
  width           : 352
  height          : 288
  videodatarate   : 195
  framerate       : 25
  videocodecid    : 2
  audiodatarate   : 125
  audiosamplerate : 22050
  audiosamplesize : 16
  stereo          : false
  audiocodecid    : 2
  encoder         : Lavf53.4.0
  filesize        : 188283
Duration: 00:00:02.56, start: 0.000000, bitrate: 328 kb/s
  Stream #0.0: Video: flv, yuv420p, 352x288, 200 kb/s, 25 tbr, 1k tbn, 1k tbc
  Stream #0.1: Audio: mp3, 22050 Hz, mono, s16, 128 kb/s
At least one output file must be specified


More information about the ffmpeg-user mailing list