Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm saddled with using ffmpeg for some video conversion on an older windows box. Unfortunately my app crawls to a halt whenever ffmpeg is running. Can any ffmpeg experts suggest any performance tips to optimize ffmpeg?

These are the arguments I am supplying ffmpeg with

['-i', _master, '-s', '720x540', '-sws_flags', 'lanczos', '-qscale:v', '1', '-y', _tempMaster]

Actually forgot 2 additional operations

2 CONCATENATE

['-i', "concat:" + _head + "|" + _tempMaster + "|" + _tail, '-c', 'copy', '-y', _concatALL] 

3 MUX WITH AUDIO AND HIGH QUALITY TRANSCODE

['-i', _audio, '-i', _concatALL, '-vcodec', 'libx264', '-crf', '22', '-vf', 'hqdn3d=1:1:1:1,unsharp=2:2:.7:2:2:0.0', '-y', _finalOutput] 
share|improve this question
    
Please show the actual ffmpeg commands and the complete console outputs. –  LordNeckbeard May 2 '13 at 17:30

1 Answer 1

  • Lanczos filtering is pretty expensive. Can you try a different image filter? fast_bilinear is pretty doggone fast compared to lanczos, but will reduce image quality slightly. Just replace lanczos with fast_bilinear and compare.

  • A lot of what's slow about ffmpeg has to do with codecs, and it's not clear from your commandline options what muxers/demuxers/encoders/decoders/filters you're using, other than libswscale. Codec options have a lot to do with the computational complexity of a video job.

  • Make sure you are running the latest version of ffmpeg.

  • Try swapping out libav/ffmpeg to see if it helps. They've diverged a bit lately.

  • Maybe compile a new version of ffmpeg from source, using a more advanced compiler with Link Time Optimization and other expensive optimizations, such as Visual Studio 2012's compiler, or Clang.

  • If the operating system is 64-bit, you can get at least a 5 to 10% performance speedup by using a 64-bit build of ffmpeg. The additional CPU registers will definitely help with the tight loops of an encoder or image resizing algorithm. I think all processors branded "i5" to date are 64-bit enabled, so installing a 64-bit OS would be an option if you're running 32-bit.

  • If you seriously need to shave off milliseconds and have a lot of time and knowledge of C, use a profiler to time a debug build of ffmpeg. See where (in what methods/filters/codecs) it spends most of its time. See if you can work out some micro-optimizations, or maybe cut corners in quality to speed it up.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.