Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HD playback performance
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Devnn
n00b
n00b


Joined: 03 Oct 2006
Posts: 25

PostPosted: Tue Aug 07, 2007 12:55 am    Post subject: HD playback performance Reply with quote

I'm preparing my box for the growing HD video content available.
I've, however, just come across two samples, same resolution, one playing fine with ~50% CPU utilisation and the other is choppy with 100% usage.
My CPU is a pentium 4 3GHz. I'm considering an upgrade because of this.

I have no CPU flags enabled really, but isn't their effect on performance minimal? With choppy video, an improvement of 10% or even 20% would not be enough to be safe on this system. That's why I'm considering a dual core instead of the plain P4.

Does anyone have any tips to improve the playback by software? Is it possible to re-encode samples to the 50% CPU utilisation type losslessly?

Code:

MPlayer dev-SVN-rUNKNOWN-4.1.2 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Pentium(R) 4 CPU 3.00GHz (Family: 15, Model: 6, Stepping: 5)
MMX supported but disabled
MMX2 supported but disabled
SSE supported but disabled
SSE2 supported but disabled
CPUflags:  MMX: 0 MMX2: 0 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions:


The sample playing fine outputs this in mplayer:
Code:

...
[mkv] Track ID 1: video (V_MPEG4/ISO/AVC) "movie", -vid 0
[mkv] Track ID 2: audio (A_AC3), -aid 0, -alang und
[mkv] Will play video track 1.
Matroska file format detected.
VIDEO:  [avc1]  1280x720  24bpp  25.000 fps    0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================


and here is the output from mplayer with the choppy sample:
Code:

...
[mkv] Track ID 1: video (V_MS/VFW/FOURCC), -vid 0
[mkv] Track ID 2: audio (A_AC3), -aid 0, -alang eng
[mkv] Will play video track 1.
Matroska file format detected.
VIDEO:  [XVID]  1280x720  12bpp  23.976 fps    0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================


Sadly none of that nvidia purevideo stuff works in linux. Else I would have bought a GF8600 within a heatbeat of time.

EDIT: I mixed up the samples. The ffodivx is the one playing smotthly and the ffh264 is not.


Last edited by Devnn on Tue Aug 07, 2007 9:29 am; edited 1 time in total
Back to top
View user's profile Send private message
col
l33t
l33t


Joined: 08 May 2002
Posts: 820
Location: Melbourne - Australia

PostPosted: Tue Aug 07, 2007 8:21 am    Post subject: Reply with quote

you should have :

-msse3


make a big diff with video....although a P4-3.0G should have silky smooth HD playback consider I do with a slower CPU.
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Tue Aug 07, 2007 9:17 am    Post subject: Re: HD playback performance Reply with quote

Devnn wrote:
I have no CPU flags enabled really, but isn't their effect on performance minimal?
On the contrary, these flags make a huge difference in multimedia, that's what they were created for. So the first thing you should do is to activate them.

Your situation is weird, because you're saying that the more complex video (h264/AVC) plays fine, while the less complex one (MPEG4 ASP) does not. This is the total opposite of what it should be. Are you sure you didn't mix something up when writing this post?


Anyway, your cpu should be fast enough even for the AVC video, so enable all the flags (mmx, mmxext, sse, sse2) and try again.
Back to top
View user's profile Send private message
Devnn
n00b
n00b


Joined: 03 Oct 2006
Posts: 25

PostPosted: Tue Aug 07, 2007 9:28 am    Post subject: Reply with quote

Doh. You're right, I mixed up the outputs. The ffodivx is playing smoothly and the ffh264 is not.
I'll recompile mplayer and ffmpeg with
Code:

CFLAGS="-O2 -march=pentium4 -pipe -mmx -mmxext -sse -sse2"

to see if it helps.
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Tue Aug 07, 2007 10:38 am    Post subject: Reply with quote

Devnn wrote:
Doh. You're right, I mixed up the outputs. The ffodivx is playing smoothly and the ffh264 is not.
I'll recompile mplayer and ffmpeg with
Code:

CFLAGS="-O2 -march=pentium4 -pipe -mmx -mmxext -sse -sse2"

to see if it helps.
No, the gcc flags do not help. See this post of mine for an explanation. What you need to do is turn on the USE flags for mplayer. I suggest you put them in /etc/make.conf, so that all apps that have support for them will benefit.
Back to top
View user's profile Send private message
Devnn
n00b
n00b


Joined: 03 Oct 2006
Posts: 25

PostPosted: Tue Aug 07, 2007 10:39 am    Post subject: Reply with quote

I recompiled mplayer with mmx, mmxext, sse, sse2 as use flags. And the 50% load video is now 10-20% and the 100% is now 50% and not choppy anymore. YAY! Just got to figure out how to give the same performace to xine now as it doesn't has CFLAGS options as use flags. Hopefully the CFLAGS in make.conf have an effect.

Thanks to everyone.

Btw. ssse3 is only for core2 CPU's. Is that what you meant, col?
Back to top
View user's profile Send private message
col
l33t
l33t


Joined: 08 May 2002
Posts: 820
Location: Melbourne - Australia

PostPosted: Tue Aug 07, 2007 11:50 pm    Post subject: Reply with quote

Devnn wrote:

Btw. ssse3 is only for core2 CPU's. Is that what you meant, col?


If you have a P4 prescott or newer you should enable SSE3......CPUs with SSE3 :

* AMD:
o Athlon 64 (since Venice Stepping E3 and San Diego Stepping E4)
o Athlon 64 X2
o Athlon 64 FX (since San Diego Stepping E4)
o Opteron (since Stepping E4)
o Sempron (since Palermo Stepping E3)
o Turion 64
o Turion 64 X2
* Intel:
o Celeron D
o Pentium 4 (since Prescott)
o Pentium D
o Intel Core Duo
o Intel Core 2 Duo
o Intel Core 2 Extreme
o Xeon (since Nocona)
* VIA/Centaur:
o C7
* Transmeta
o Efficeon TM88xx (NOT Model Numbers TM86xx)


Note: You can verify the chip is a Prescott by looking for pni in the flags section of /proc/cpuinfo. This indicates support for SSE3
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Wed Aug 08, 2007 7:40 am    Post subject: Reply with quote

sse3 (streaming SIMD extension 3) and ssse3 (supplemental streaming SIMD extension 3) are two different things. There is no sse3 support in mplayer, but there is ssse3. Only Xeon 5100 Series and Core 2 processors have ssse3.
Back to top
View user's profile Send private message
Devnn
n00b
n00b


Joined: 03 Oct 2006
Posts: 25

PostPosted: Wed Aug 08, 2007 10:08 am    Post subject: Reply with quote

Binaries optimizations and dedicated support in the player seem to be two different worlds.

I recompiled ffmpeg, xine-ui and xine-lib with march=precott. This doesn't make any significant difference. Mplayer, however, just flies with the extended CPU instructions enabled in the USE flags. When running xine, it doesn't output anything about mmx support etc. like mplayer does.

I know mplayer has a ebuild that overwrites CFLAGS options and seem to take them from use flags instead, but xine doesn't show anything about CPU features anywhere.

Does anyone know how to make xine take avantage of mmx etc the way mplayer does?

Furthermode I don't see how mplayer can improve video playback so much by itself when it is using ffmpeg for decoding the videos. Doesn't mplayer and xine both use ffmpeg for video decoding and thus should have the same performance? Both programs had exactly the same performance before I enabled mmx etc. support in mplayer.
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Wed Aug 08, 2007 1:31 pm    Post subject: Reply with quote

Devnn wrote:
Does anyone know how to make xine take avantage of mmx etc the way mplayer does?
The difference shouldn't be that big between mplayer and xine (I don't really notice it). I suspect there's something wrong with your xine configuration. Either that, or your ffmpeg is not installed with the mmx use flag.

There's also another thing you could try, but I'm not sure if it'll help. Install ffmpeg with
Code:
EXTRA_ECONF="--cpu=pentium4" emerge ffmpeg


In any case, make sure that the mmx use flag is on for ffmpeg!
Back to top
View user's profile Send private message
Devnn
n00b
n00b


Joined: 03 Oct 2006
Posts: 25

PostPosted: Wed Aug 08, 2007 7:33 pm    Post subject: Reply with quote

Both the mmx flag and the EXTRA_ECONF variable helped on the performance in xine. The sample now play decently. Mplayer however still has better performance and wasn't affected by the ffmpeg recompilations. It's like mplayer uses another en embebbed ffmpeg, which would explain how useflags on mplayer could maybe improve performance of decoding. Either way, I just use mplayer, and xine is obviously affected by how ffmpeg is build.

Xine has a lot of settings, some of them could be impacting performance. Mplayer just seems the way to go if you want guaranteed video playback performance.
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Wed Aug 08, 2007 11:55 pm    Post subject: Reply with quote

Devnn wrote:
It's like mplayer uses another en embebbed ffmpeg
Correct, mplayer has an internal version of ffmpeg's libraries, which are configured differently (mplayer's configure script does hardware detecting and sets things up automatically, ffmpeg's does not).

The difference between xine and mplayer you're seeing is because the ffmpeg ebuild creates a very unoptimized build, for example it doesn't set --cpu and has --disable-opts in it. The EXTRA_ECONF is a little help, but to get the full performance you would need to compile ffmpeg manually or modify the ebuild.

I've no idea why the ffmpeg ebuild uses --disable-opts or why it doesn't set --cpu. Especially --cpu is important because it selects optimizations, among them a very important one for h264 decoding. I've found a bug on the issue, but there aren't any comments on it.
Back to top
View user's profile Send private message
Devnn
n00b
n00b


Joined: 03 Oct 2006
Posts: 25

PostPosted: Thu Aug 09, 2007 8:41 am    Post subject: Reply with quote

This clarifies it all. Weird how nobody worries about an inefficient ffmpeg in these times with HD video emerging. Maybe people just buy new hardware, like I almost did.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum