Slashdot Mirror


Which Open Source Video Apps Use SMP Effectively?

ydrol writes "After building my new Core 2 Quad Q6600 PC, I was ready to unleash video conversion activity the likes of which I had not seen before. However, I was disappointed to discover that a lot of the conversion tools either don't use SMP at all, or don't balance the workload evenly across processors, or require ugly hacks to use SMP (e.g. invoking distributed encoding options). I get the impression that open source projects are a bit slow on the uptake here? Which open source video conversion apps take full native advantage of SMP? (And before you ask, no, I don't want to pick up the code and add SMP support myself, thanks.)"

14 of 262 comments (clear)

  1. ffmpeg by bconway · · Score: 5, Informative

    Use the -threads switch.

    --
    Interested in open source engine management for your Subaru?
    1. Re:ffmpeg by morgan_greywolf · · Score: 5, Informative

      Similarly, mencoder supports threads=# where # is something between 1 and 8.

    2. Re:ffmpeg by mweather · · Score: 5, Informative

      Apple computers ARE PCs. They coined the damn term.

    3. Re:ffmpeg by Tanktalus · · Score: 5, Interesting

      That sounds like a lot of work... I just used make:

      %.mpg: %.avi
      tovid -ntsc -dvd -noask -ffmpeg -in "$<" -out "$(basename $@)"

      all: $(subst .avi,.mpg,$(wildcard */*.avi))

      Then I just ran "make -j4". All four processors working like mad, with a minimal of effort.

      (You may need to change the wildcard for your own scenario.)

    4. Re:ffmpeg by maglor_83 · · Score: 5, Funny

      On a single core system this would result in not being able to run anything!

    5. Re:ffmpeg by hedwards · · Score: 5, Insightful

      Apple has spent a lot of time and money convincing everybody that they don't sell PCs, they sell Macs. I'm not sure what the point of arguing with both the general public as well as Apple is.

      At this point, the term PC does not include Apple computers. It's a change to the definition which happens when the vast majority of people decide amongst themselves that the definition should change.

      In terms of the topic at hand, most video apps really should be capable of using multiple cores, tasks of this sort are quite easy to finish in parallel. Either by doing ever n frames or subdividing the image into a number of regions which can be completed separately and joined at the end before writing the frame to disk.

    6. Re:ffmpeg by 3vi1 · · Score: 5, Insightful

      No - HP did (for their calculators), way before there "was" an Apple.

      Also, I don't even think Apple marketing would agree with you - or they wouldn't have "I'm a Mac... and I'm a PC" adverts.

    7. Re:ffmpeg by ksheff · · Score: 5, Informative

      That's the point. If the xvid encoder is single threaded, then to keep all the cores busy, one must run multiple instances of ffmpeg with each one encoding a different file. For the given Makefile, that is what make will do when the -j switch is used.

      --
      the good ground has been paved over by suicidal maniacs
  2. transcode, of course! by morgan_greywolf · · Score: 5, Informative

    transocde uses separate processes for everything.

  3. Handbrake by vfs · · Score: 5, Informative

    Handbrake has always used both of the cores on my system for transcoding.

  4. F(next) = F(current) + Delta(F(current:next)) by Lumenary7204 · · Score: 5, Insightful

    The problem with MPEG encoding and decoding is that the data itself is not well suited to multi-threaded analysis.

    Multi-threading is most efficient when it is applied to discrete data sets that have little or no dependency on each other.

    For example, suppose I have a table with four columns -- three holding input values (A, B, and C) and one holding an output value (X). If the data in a given row of the table has nothing to do with the data in any other row, multi-threading works efficiently, because none of the threads are waiting for data from any of the other threads. If I want to process multiple rows at once, I simply spawn additional threads.

    On the other hand, for data such as MPEG video, the composition of the next frame is equal to the composition of the current frame, plus some delta transformation - the changed pixels.

    This introduces a dependency which precludes efficient multi-threaded processing, because each succeeding frame depends on the output of the calculations used to generate the prior frame. Even if more than one core is dedicated to processing the video stream, one core would wind up waiting on another, because the output from the first core would be used as the input to the second.

  5. Re:Simple... by j00r0m4nc3r · · Score: 5, Informative

    Running multiple instances of the same code concurrently in multiple threads is simple. Even running mutually exclusive parts of the same code concurrently in separate threads is easy. Converting complex serial algorithms to effectively utilize multiple cores is generally not simple. And writing code that can scale and balance across n number of cores/threads is extremely hard. There are all sorts of synchronization issues to deal with, scheduling issues, data transport issues, etc.. and it becomes increasingly hard to debug code the more cores/threads you throw in. I think the stigma is justified.

  6. keyframes by Anonymous Coward · · Score: 5, Informative

    Actually, the MPEG stream resets itself every n frames or so (n is often a number like 8, but can vary depending on the video content). These are called keyframes (K) and the delta frames (called P and I frames) are generated against them. Because of this, it is really easy to apply parallel processing to video encoding.

  7. avidemux by Unit3 · · Score: 5, Informative

    I've noticed a lot of talk about commandline options, but not the nice guis that use them. Avidemux is open source, cross-platform, gives you a decent interface, and uses multithreaded libraries like ffmpeg and x264 on the backend to do the encoding, so it generally makes optimal use of your multicore system.

    --
    -- sudo.ca