Menu

Double your speed

2009-06-07
2013-05-02
  • Andrew Stevens

    Andrew Stevens - 2009-06-07

    The current options that Video Monkey feeds to ffmpeg use the default single thread. Fortunately Video Monkey is setup in a rather clever way, and we are able change the commands used easily.

    To use all of your CPU cores:

    - Open your applications folder, right click on Video Monkey, select "Show Package Contents"
    - a new finder window appears, open "Contents" and then "Resources"
    - open "commands.xml" in your favorite text editor
    - find the section "<device_group title="iTunes">"
    - go down a few more lines to get to the element "<command id="ffmpeg_options">"

    This is the command line that is executed when you encode a video usting any of the devices that are under the "iTunes" group in the UI.
    On the end of that list of command line parameters add "-threads 2". Use the number of CPU cores you have.

    Your finished product should look something like this:

                    <command id="ffmpeg_options">
                        -vcodec $ffmpeg_vcodec -b $output_video_bitrate -s $(output_video_width)x$(output_video_height)
                            -aspect $(output_video_width):$(output_video_height) -r $(output_video_frame_rate)
                        -acodec $ffmpeg_acodec -ab $output_audio_bitrate -ar $output_audio_sample_rate -ac $output_audio_channels
                        -threads 2
                    </command>

    Grab a new video to encode, and watch your CPU meter.

     
    • Jason D

      Jason D - 2009-08-23

      I've gone from using 8% of my CPU to 12% with this little fix. There has to be a way to utilize most of our cores on our Mac Pros.

       
    • taffjones

      taffjones - 2009-09-01

      Andrew's tip works if you have 2 cores / CPUs.

      To allow ffmpeg to automatically determine how many cores to use (i.e. the maximum) it should be -threads 0

       
  • Sean

    Sean - 2009-10-09

    After making this -threads 2 change on my iMac (intel Core 2 Duo) I did notice that my CPU usage jumped way up close to the max, however, on the console I get this message:

         -&gt; Warning: not compiled with thread support, using thread emulation

    I'm assuming that &quot;thread emulation&quot; is way less efficient than &quot;thread support&quot;.  Can the ffmpeg embedded in VideoMonkey be replaced with a copy that has this thread support turned on?  If so, has anyone been able to build a copy of ffmpeg on Snow Leopard with this option, or at all for that matter?  I've tried downloading the source and building it, but all my attempts have failed.

     
  • Casemon

    Casemon - 2009-12-12

    Cheers for this, halved my compress times… amazing! :)

     
  • MoonDogg

    MoonDogg - 2010-02-07

    behis1

    yes I have been able to compile ffmepg in snow loepard and replace the one that comes with video monkey.. it has made a nice improvement… it is now 64 bit and runs 4 threads cutting my encoding in half. 

     
  • Dylan

    Dylan - 2010-10-05

    You can easily install an optimized version of the latest ffmpeg with homebrew
    - install homebrew
    - type:

    brew update
    brew install ffmpeg

     
  • Jim Terryberry

    Jim Terryberry - 2010-12-02

    moondogg any chance you could share the compiled ffmepg?  I would be most appreciative.

    - Jim

     
  • Casemon

    Casemon - 2011-03-24

    Is this tweak still applicable in v.10 ?

    Asking, as I've switched to using an intel i3 CPU based mac and am seeing much longer compress times compared to a 3yr old macbook pro with an Intel core 2 duo CPU.

     
  • Casemon

    Casemon - 2011-07-05

    bump?

     

Log in to post a comment.