What settings can I use to maximize FFMpeg performance?

35,800

If you have old computer any codec will make problems for real time encoding (not just for CPU but for disk as well). I suggest to find resolution which is low enough to reduce file size. I you want to have custom resolutions and framerate (mpeg1/mpeg2 can't be used). Resolution and framerate choose wisely.

Here is my suggestions for switches in ffmpeg:

-vcodec libx264 
-r 15
-preset ultrafast
-s 800x600

here I put 800x600 (this is maybe too low) and framerate is 15 fps. For better performance set framerate from 15 to 10 FPS. In my experience x264 is fast codec and allows custom resolutins and framerates.

Here is setup for MPEG2 (which is faster but is limited by resolutions & framerate)

-r 25 
-s 720x480 
-preset ultrafast 
-vcodec mpeg2video
Share:
35,800

Related videos on Youtube

odemolliens
Author by

odemolliens

Updated on September 18, 2022

Comments

  • odemolliens
    odemolliens almost 2 years

    I'm trying to do some screencasting, but since my computer is much too old and slow the video being produced is laggy and the application I'm trying to record becomes unresponsive due to the CPU consumption. Since I can't upgrade at the moment, I'm looking to optimize what I have.
    I switched from GNOME to OpenBox, and I've killed unnecessary processes, etc. Still no good. I've also optimized the application I'm recording, so the only thing left would be the recorder itself, which is FFMpeg.

    What are some options and flags that can be used to get the best performance out of FFMpeg? Are there any specific codecs that are easier to process than others? I'll be recording about 10-15 mins at a time, so something that doesn't produce HUGE files sizes would also be appreciated. Any ideas?

    • Admin
      Admin over 12 years
      As a rough guideline: small size, good quality, high speed: pick any two. I'd record to a format with less compression/higher bitrate per second first and afterwards re-compress that file to something smaller at a lower-than-realtime speed.
    • Admin
      Admin over 12 years
      @UlrichSchwarz, Excellent reply. I agree with him completely.
  • derobert
    derobert over 11 years
    I must check, you may be the first person in history to refer to H.264 encoding as "fast"... :-P But yeah, the key thing there is the preset to turn off all the expensive options.
  • manuel
    manuel over 11 years
    You are right! if 720x480 is good enough here this is faster: -r 25 -s 720x480 -preset ultrafast -vcodec mpeg2video (I live in Full HD world and complitly forgot someone use 800x600 resolution :()