Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Hardware & Software > Software players

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th September 2009, 01:56   #1  |  Link
Chengbin
Registered User
 
Join Date: Oct 2007
Posts: 1,060
How to use ffmpeg-mt in MPC?

Under output, I use Haali Renderer. Under internal filter, and H.264, it says I'm using ffmpeg-mt, with 4 threads.

ffdshow is set up correctly.

I have to force ffdshow video decoder under external filters to get it to work. I don't want to do that because I can't load an external subtitle under this mode.

I'm using the Crowdrun footage to do some test on my Q6600.

With single core (I don't know which decoder, probably libavcodec), I can get around 3fps. With ffmpeg-mt, I'm getting 100% CPU usage, but I'm only getting 1.5fps??? In ffdshow, under decoder options, I unchecked drop frame and skip H264 deblocking cause I thought that might drop fps. But nothing changed. Even with them unchecked, it still drop frames, unlike with the single core decoder.

Anybody have a clue?
Chengbin is offline   Reply With Quote
Old 20th September 2009, 13:26   #2  |  Link
shiloto
Registered User
 
Join Date: Sep 2009
Posts: 19
whats your windows?
What kind of files are you playing
Try using other renderer
shiloto is offline   Reply With Quote
Old 20th September 2009, 13:33   #3  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
If MPC's "internal" H.264 decoder was compiled with libavcodec taken from "normal" FFmpeg repository instead of the "FFmpeg-MT" repository, then there is no way

Of course you could always compile MPC yourself from the sources and make sure that the "FFmpeg-MT" libraries are used...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 20th September 2009, 14:04   #4  |  Link
Chengbin
Registered User
 
Join Date: Oct 2007
Posts: 1,060
I use Windows Vista.

@LoRd_MuldeR

What MPC HC should I get? The latest MPC HC?
Chengbin is offline   Reply With Quote
Old 20th September 2009, 14:09   #5  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by Chengbin View Post
What MPC HC should I get? The latest MPC HC?
I don't know if there are any pre-compiled MPC-HC builds publicly available that use multi-threaded libavcodec (FFmpeg-MT) for the "internal" decoders

Keep in mind that MPC-HC also has a DXVA decoder. So AFAIK if your GPU does support it, MPC-HC won't use the software decoder (libavcodec) for decoding H.264 at all.

At least not by default. You can disable the internal DXVA decoder of course and make it fall back to software decoding...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 20th September 2009 at 14:34.
LoRd_MuldeR is offline   Reply With Quote
Old 20th September 2009, 15:16   #6  |  Link
Chengbin
Registered User
 
Join Date: Oct 2007
Posts: 1,060
How do I get it to use ffmpeg-mt AND be able to load external subtitles?

Do you know why the MT decoder is 2x slower than the ST decoder?
Chengbin is offline   Reply With Quote
Old 20th September 2009, 15:52   #7  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Again: Unless MPC-HC was compiled with multi-threaded libavcodec/ffmpeg (aka "FFmpeg-MT"), then there is no way to make it use FFmpeg-MT!

At least not for the built-in "internal" decoders. You can still use ffdshow with FFmpeg-MT as an "external" filter, of course...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 20th September 2009, 16:20   #8  |  Link
clsid
*****
 
Join Date: Feb 2005
Posts: 5,647
The video decoder and the loading of subtitles are two unrelated things.

As LM has already said, disable the internal decoder and use ffdshow. Then you can use ffmpeg-mt instead of libavcodec.
__________________
MPC-HC 2.2.1
clsid is offline   Reply With Quote
Old 20th September 2009, 16:27   #9  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by clsid View Post
Then you can use ffmpeg-mt instead of libavcodec.
I think this statement can be confusing

Just to make it clear: We don't use ffmpeg-mt instead of libavcodec. We always use the decoders provided by the "libavcodec" library, which is one part of the FFmpeg project.

However there now is the multi-threaded FFmpeg repository (aka "FFmpeg-MT") in addition to the normal/stable FFmpeg repository. They'll (hopefully) be merge at some point in the future.

Currently you must decided which flavor of the "libavcodec" library you link against your application, at compile-time. Well, ffdshow contains both of them, but most apps don't...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 20th September 2009 at 16:38.
LoRd_MuldeR is offline   Reply With Quote
Old 20th September 2009, 19:43   #10  |  Link
roozhou
Registered User
 
Join Date: Apr 2008
Posts: 1,181
Quote:
Originally Posted by LoRd_MuldeR View Post
Currently you must decided which flavor of the "libavcodec" library you link against your application, at compile-time. Well, ffdshow contains both of them, but most apps don't...
The only reason to use ffmpeg-mt is frame-level h264 decoding. You will have to replace a few files in libavcodec to make a ffmpeg-mt build.
roozhou is offline   Reply With Quote
Old 20th September 2009, 19:44   #11  |  Link
clsid
*****
 
Join Date: Feb 2005
Posts: 5,647
The library names used in ffdshow are "libavcodec" and "ffmpeg-mt". I tried not to confuse him with details.
__________________
MPC-HC 2.2.1
clsid is offline   Reply With Quote
Old 21st September 2009, 01:24   #12  |  Link
Chengbin
Registered User
 
Join Date: Oct 2007
Posts: 1,060
Quote:
Originally Posted by clsid View Post
The video decoder and the loading of subtitles are two unrelated things.

As LM has already said, disable the internal decoder and use ffdshow. Then you can use ffmpeg-mt instead of libavcodec.
I can't load subtitles because I'm using a different renderer when I force ffdshow video decoder in external filters.
Chengbin is offline   Reply With Quote
Old 21st September 2009, 01:31   #13  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Why is that? MPC-HC should always use the renderer you have selected under "Output" options, no matter what decoders (or more precisely: "transform" filters) are used.

So what renderer did you select? And which one is used instead if you force ffdshow?
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 21st September 2009, 02:36   #14  |  Link
Chengbin
Registered User
 
Join Date: Oct 2007
Posts: 1,060
Never mind, I take that back.

I don't know why I can't load subtitle before. It popped up a message to change renderer when I try to load an external subtitle.

The whole point of this thread was trying to play the Crowdrun footage on my PC. Apparently ffmpeg-mt is just really slow at decoding this particular video. I'm getting 0.3fps with ffmpeg-mt with 1 thread, but 3.5fps with libavcodec. Maybe it is not optimized for 50fps + UHD? With 1080p video the CPU usage is around the same.

Last edited by Chengbin; 21st September 2009 at 02:46.
Chengbin is offline   Reply With Quote
Old 21st September 2009, 05:33   #15  |  Link
Astrophizz
Registered User
 
Join Date: Jul 2008
Posts: 184
Why would ffmpeg-mt be any better than libavcodec with just one thread? Don't know why it's worse but the benefit of multithreading only comes when you allow it to use more than one thread, on multiple cores.
Astrophizz is offline   Reply With Quote
Old 21st September 2009, 12:02   #16  |  Link
Chengbin
Registered User
 
Join Date: Oct 2007
Posts: 1,060
Quote:
Originally Posted by Astrophizz View Post
Why would ffmpeg-mt be any better than libavcodec with just one thread? Don't know why it's worse but the benefit of multithreading only comes when you allow it to use more than one thread, on multiple cores.
As I said before, ffmpeg-mt with 4 threads is less than half the speed of libavcodec with a single core
Chengbin is offline   Reply With Quote
Old 21st September 2009, 12:06   #17  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
How did you measure this? Please use TimeCodec to compare decoder performance!

The last time I did a comprision, the result was like this:

Code:
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
That means FFmpeg-MT actually is ~2.5x faster than the "normal" FFmpeg branch on my Quadcore machine

(Note that "ffdshow-MT" was tested with FFmpeg-MT decoders, the "normal" ffdshow builds were using the Non-multithreded FFmpeg decoders)
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 21st September 2009 at 12:11.
LoRd_MuldeR is offline   Reply With Quote
Old 21st September 2009, 21:06   #18  |  Link
Chengbin
Registered User
 
Join Date: Oct 2007
Posts: 1,060
ffmpeg-mt is roughly 4 times faster under threads 4 compared to thread 1.

My hypothesis was, maybe ffmpeg-mt was not optimized for UHD + 50fps video. ffmpeg-mt @ 4 threads = less than half of libavcodec.

1080p video and under, ffmpeg-mt @ 1 thread = libavcodec.
Chengbin is offline   Reply With Quote
Old 22nd September 2009, 12:40   #19  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by Chengbin View Post
My hypothesis was, maybe ffmpeg-mt was not optimized for UHD + 50fps video. ffmpeg-mt @ 4 threads = less than half of libavcodec.
Again: How did you measure this? Did you use TimeCodec.exe and did you set the renderer to Null? If not, please re-do the test!

I just did a quick test with the "Crowdrun" video (3840x2160 @ 50fps) and ffdshow r3078:

Code:
[ffdshow, using "normal" libavcodec]
User: 5s, kernel: 3s, total: 8s, real: 74s, fps: 55.6, dfps: 6.7   <-- 100%

[ffdshow, using "FFmpeg-MT" libavcodec, 4 threads]
User: 5s, kernel: 0s, total: 5s, real: 34s, fps: 86.6, dfps: 14.5  <-- 216%

[DivX H.264 decoder]
User: 3s, kernel: 0s, total: 4s, real: 28s, fps: 124.2, dfps: 17.7 <-- 264%
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 22nd September 2009 at 12:54.
LoRd_MuldeR is offline   Reply With Quote
Old 22nd September 2009, 21:19   #20  |  Link
Chengbin
Registered User
 
Join Date: Oct 2007
Posts: 1,060
Where can I get TimeCodec.exe?
Chengbin is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:05.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.