Log in

View Full Version : how fast can free decoders go? (h.264 n00b alert!)


Mug Funky
13th February 2009, 03:44
hi all. excuse my laziness for only performing a quick search for answers.

actually, it'd be useful for all the answers to appear in 1 thread anyhow.

what is the current state of the art for h.264 decoding in HD (1080) using free software? and are there any reasonable sacrifices i can make during encoding to get good speedups when playing back?

i'm currently using mpc-hc and ffdshow on a quadcore 3.2Ghz using (unfortunately for DXVA) a geforce 7200GS.

my source is a 1440x1080 mp4 encoded in x264 (using the x264 encoder for quicktime on a steroidal 8-core mac, then remuxed using mp4box). source for that is HDCAM-SR :)

bitrate is 15.9mbps, everything in x264 is turned on including 8x8 and CABAC. revision is 1100 or so.

a blu-ray rip i have seems to play back faster in spite of it's (much) higher bitrate. i'm pleased to say the x264 looks superior to this blu-ray at a third it's bitrate.

when playing back, i get sub-realtime (just), and the audio (224 AAC) drifts out of sync. seeking to random spots confirms the audio was encoded in sync, but after a few seconds it's out again.

is there something magical i can do for speed that i've missed in the last few months, or do i pretty much have the quickest i can get without buying coreAVC? should i re-encode with CAVLC and just suck it up about the bitrate hit?

thanks all.

Guest
13th February 2009, 03:54
without buying coreAVC It's $15 measly bucks. What is the problem?

Mug Funky
13th February 2009, 04:15
1. didn't know that. i think i got it's price confused with anyDVD...

2. not sure if it'll solve all my problems.

3. general principle...

also my home machine at the moment is a measly dualcore AMD that i can't afford to upgrade at the moment.

poisondeathray
13th February 2009, 04:27
You could try ffdshow-mt , or DivX 7 decoder

Sagekilla
13th February 2009, 04:30
My desktop (An old throwback to the K8 days, 2 GHz dual core) runs 1080p (Blu-rays, too) quite fine with < 60% CPU usage or so under CoreAVC. Shouldn't be an issue for you if you use it.

LoRd_MuldeR
13th February 2009, 04:40
If you are using none-MT ffdshow right now, then switching to ffdshow-MT will give an enormous boost on your Quadcore :cool:

I can't keep up with CoreAVC and DivX 7 yet, but the speed-up is more than remarkable anyway! If that still isn't fast enough, try DivX 7.

http://sourceforge.net/project/showfiles.php?group_id=173941&package_id=214245


E:\HD\freedom EP1 sample.mkv, 1920x1080, High@L4.1

[ffdshow, rev2509, 4 threads]
User: 3s, kernel: 0s, total: 4s, real: 22s, fps: 142.8, dfps: 27.2
User: 3s, kernel: 0s, total: 4s, real: 22s, fps: 142.8, dfps: 27.2 <-- 100%
User: 3s, kernel: 0s, total: 4s, real: 25s, fps: 140.8, dfps: 24.2

[ffdshow, rev2527, Pre-Beta 6, 4 threads]
User: 3s, kernel: 0s, total: 4s, real: 22s, fps: 149.3, dfps: 27.5
User: 3s, kernel: 0s, total: 3s, real: 22s, fps: 155.2, dfps: 27.4 <-- 101%
User: 3s, kernel: 0s, total: 4s, real: 24s, fps: 147.1, dfps: 24.9

[ffdshow-MT, rev2515, 4 threads]
User: 2s, kernel: 0s, total: 2s, real: 8s, fps: 219.0, dfps: 68.7
User: 2s, kernel: 0s, total: 2s, real: 8s, fps: 252.7, dfps: 68.7 <-- 254%
User: 2s, kernel: 0s, total: 2s, real: 9s, fps: 220.2, dfps: 67.2

[CoreAVC, Version 1.8.5]
User: 0s, kernel: 0s, total: 0s, real: 7s, fps: 679.7, dfps: 82.3
User: 0s, kernel: 0s, total: 1s, real: 7s, fps: 616.0, dfps: 82.1 <-- 304%
User: 0s, kernel: 0s, total: 0s, real: 7s, fps: 691.6, dfps: 82.0

[DivX H.264 Decoder, Beta-3]
User: 1s, kernel: 0s, total: 1s, real: 6s, fps: 458.4, dfps: 88.4
User: 1s, kernel: 0s, total: 1s, real: 6s, fps: 512.0, dfps: 88.4 <-- 327%
User: 1s, kernel: 0s, total: 1s, real: 7s, fps: 499.0, dfps: 87.6

Mug Funky
13th February 2009, 05:27
thanks all. ffdshow-mt got me up to realtime on the quadcore. will try it on the dual first chance i get.

i'll follow ffdshow's development a little closer :) i thought i was already using the multithreaded version, but i guess it was an older one (or "decoder threads" didn't mean what i thought it did).

i'd love to see XBMC catch up, speedwise, as it's a very cool way of doing things if your computer happens to be plugged into your TV.

LoRd_MuldeR
13th February 2009, 14:47
i thought i was already using the multithreaded version, but i guess it was an older one (or "decoder threads" didn't mean what i thought it did).

The current "stable" branch of ffdshow uses an old multi-threading patch for the H.264 decoder, which never made it into the official ffmpeg repository.
Unfortunately that patch isn't very efficient. You don't get double throughput for double CPU load. And only two cores can be used!

ffdshow-MT is build with ffmpeg-MT, the multi-threaded branch of ffmpeg. It uses frame-based multi-threading, which is more efficient and scales much better.
But keep in mind that ffmpeg-MT is not "stable" yet. It seems to work pretty stable for me through. I switched to ffdshow-MT a while ago...

nm
13th February 2009, 15:03
a blu-ray rip i have seems to play back faster in spite of it's (much) higher bitrate. i'm pleased to say the x264 looks superior to this blu-ray at a third it's bitrate.
Current mainline FFmpeg H.264 decoder also has slice-based multi-threading, which could explain this observation. Your blu-ray rip is probably sliced while your x264 encode isn't.

me7
13th February 2009, 15:05
This seems like the right thread to ask a slightly off-topic question: How many decoding threads should I set in ffdshow-mt? x264 for example has a sweet spot at number of cores * 1,5. What about decoding with ffdshow?

LoRd_MuldeR
13th February 2009, 15:14
This seems like the right thread to ask a slightly off-topic question: How many decoding threads should I set in ffdshow-mt? x264 for example has a sweet spot at number of cores * 1,5. What about decoding with ffdshow?

It seems "DecodingThreads = NumberOfCores" is a good value ;)

Using more than four decoding threads on my Quadcore didn't increase the throughput any further, but using less then four did decrease the throughput indeed.

Chengbin
13th February 2009, 18:13
This seems like the right thread to ask a slightly off-topic question: How many decoding threads should I set in ffdshow-mt? x264 for example has a sweet spot at number of cores * 1,5. What about decoding with ffdshow?

Where do I change that? I just installed ffdshow mt and I can't find that under video configurations.

LoRd_MuldeR
13th February 2009, 18:41
Where do I change that? I just installed ffdshow mt and I can't find that under video configurations.

http://img161.imageshack.us/img161/1912/decthrdspo7.jpg

TEB
14th February 2009, 16:45
Hei. To continue the newbishness ;) How do u test this, or compare these decoders? Could someone recommend a tool to do this ? And what does dfps mean in comparison to fps ?

br TEB

If you are using none-MT ffdshow right now, then switching to ffdshow-MT will give an enormous boost on your Quadcore :cool:

I can't keep up with CoreAVC and DivX 7 yet, but the speed-up is more than remarkable anyway! If that still isn't fast enough, try DivX 7.

http://sourceforge.net/project/showfiles.php?group_id=173941&package_id=214245


E:\HD\freedom EP1 sample.mkv, 1920x1080, High@L4.1

[ffdshow, rev2509, 4 threads]
User: 3s, kernel: 0s, total: 4s, real: 22s, fps: 142.8, dfps: 27.2
User: 3s, kernel: 0s, total: 4s, real: 22s, fps: 142.8, dfps: 27.2 <-- 100%
User: 3s, kernel: 0s, total: 4s, real: 25s, fps: 140.8, dfps: 24.2

[ffdshow, rev2527, Pre-Beta 6, 4 threads]
User: 3s, kernel: 0s, total: 4s, real: 22s, fps: 149.3, dfps: 27.5
User: 3s, kernel: 0s, total: 3s, real: 22s, fps: 155.2, dfps: 27.4 <-- 101%
User: 3s, kernel: 0s, total: 4s, real: 24s, fps: 147.1, dfps: 24.9

[ffdshow-MT, rev2515, 4 threads]
User: 2s, kernel: 0s, total: 2s, real: 8s, fps: 219.0, dfps: 68.7
User: 2s, kernel: 0s, total: 2s, real: 8s, fps: 252.7, dfps: 68.7 <-- 254%
User: 2s, kernel: 0s, total: 2s, real: 9s, fps: 220.2, dfps: 67.2

[CoreAVC, Version 1.8.5]
User: 0s, kernel: 0s, total: 0s, real: 7s, fps: 679.7, dfps: 82.3
User: 0s, kernel: 0s, total: 1s, real: 7s, fps: 616.0, dfps: 82.1 <-- 304%
User: 0s, kernel: 0s, total: 0s, real: 7s, fps: 691.6, dfps: 82.0

[DivX H.264 Decoder, Beta-3]
User: 1s, kernel: 0s, total: 1s, real: 6s, fps: 458.4, dfps: 88.4
User: 1s, kernel: 0s, total: 1s, real: 6s, fps: 512.0, dfps: 88.4 <-- 327%
User: 1s, kernel: 0s, total: 1s, real: 7s, fps: 499.0, dfps: 87.6

LoRd_MuldeR
14th February 2009, 21:13
TimeCodec:
http://haali.cs.msu.ru/mkv/timeCodec.exe

BTW: I'd recommend to run the tests with "NULL" renderer, as we want to compare decoder performance (and not renderer performance) here.

puffpio
16th February 2009, 10:23
there's no 64 bit build yet of ffdshow-mt, right?

Mr VacBob
17th February 2009, 23:04
If you can find the option that enables CODEC_FLAG2_FAST for ffdshow (it's probably called "fast decoding" or something), turn it on. It shouldn't cause visual artifacts for any x264 files and it's at least 20% faster.

I'm really interested to know how much time ffdshow spends inside ffmpeg itself vs wrapper code and color conversions, as well as how slow pthread_cond_wait is in ffdshow-mt (and whether it's built with yasm) but IIRC Windows doesn't have any good runtime profilers for this kind of thing.

TEB
18th February 2009, 11:34
TimeCodec:
http://haali.cs.msu.ru/mkv/timeCodec.exe

BTW: I'd recommend to run the tests with "NULL" renderer, as we want to compare decoder performance (and not renderer performance) here.

Thx Lord M, would u be so kind as to explain what the difference on fps and dfps is ?

TEB

squid_80
18th February 2009, 11:50
IIRC Windows doesn't have any good runtime profilers for this kind of thing.
AMD's CodeAnalyst is fairly nice, plus it's free.

LoRd_MuldeR
18th February 2009, 14:40
Thx Lord M, would u be so kind as to explain what the difference on fps and dfps is ?

I'm not so sure. But it's definitely "dfps" that matters and it also appears to be anti-proportional to "real" decoding time.

For "fps" I often get quite random values...

ACrowley
20th February 2009, 11:25
I vote for the MPCVideodecoder fom MPC Homecinema.

Very fast even without DXVA.

Divx7 is very fast but offers no DXVA or HW Deinterlacing.

MPCVideocoder use DXVA and also HW Deinterlacing, and is very fast without any DXVA

LoRd_MuldeR
20th February 2009, 22:07
I vote for the MPCVideodecoder fom MPC Homecinema.

Very fast even without DXVA.

Divx7 is very fast but offers no DXVA or HW Deinterlacing.

MPCVideocoder use DXVA and also HW Deinterlacing, and is very fast without any DXVA

MPC's video decoder, when running in "software" mode (DXVA is not used), simply uses libavcodec's H.264 decoder.

That is exactly the same decoder as used by ffdshow, VLC Media Player and MPlayer.

Unless MPC's video decoder uses the "mt" branch of ffmpeg/libavcodec now, ffdshow will be significant faster on any multi-core machine.

(Just for info: The regular ffdshow builds support ffmpeg-MT now. Just select "ffmpeg-mt" as deocder for "H.264/AVC")