Tweaking FFMPEG for performance

Need help? Post your questions here.

Moderator: moderators

Tweaking FFMPEG for performance

Postby brink » Mon Jul 04, 2011 8:11 pm

Hi all,

I was wondering if anyone was knowledgeable in getting more performance out of FFMPEG. I have a machine with an ATOM D525/2GB running subsonic, during transcodes of 720p material I'll get bursty play. Logically it makes no sense to me because I have PS3 Media Player (which also uses FFMPEG) running on a separate Atom 270 which is a significantly slower processor, with no bursty play, it can even handle many 1080p media.

When I launch taskmgr I can see that at most FFMPEG seems to be using around 25% CPU. This seems low. One factor is that my PS3MS PC is running WHS (a stripped down w2k3 server) and the pc running subsonic is running Win7.

Before I was running ORB on this PC and while the video quality was awful, it was doing 720P encodes fine as well.

What I've tried so far with minimal success:
- downloaded the latest version of FFMPEG
- set ffmpeg to high priority in taskmgr (major PITA to do regularly)
- checked for other tasks tying up resources, but for the most part the PC is doing nothing else (it runs a VNC server, that's about it besides subsonic right now)

- added the "-threads 1" parameter into all my video encodes, it's pure assumption because the man page for FFMPEG isn't clear at all, but I believe this will multithread and hopefully use both cores on the cpu. Web research would indicate that this is a specified number of threads you want the process to use, but anything besides 1 seems to break the web player.

update, found this in the logs, seems to indicate to me that FLV is multithreading incompatible.

[7/4/11 1:57:09 PM PDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) [flv @ 02875CC0] multi threaded encoding not supported by codec
brink
 
Posts: 8
Joined: Wed Jun 15, 2011 4:01 pm

Postby GJ51 » Mon Jul 04, 2011 10:19 pm

To update JW Player to the newest version, go to http://forum.subsonic.org/forum/viewtopic.php?t=5977

and read the instructions. Read the whole thread as you'll see there is the long way and the short way. I use the method I suggested as it seemed to be less time consuming. IF I want to know what version of the player I'm running, I'll just fo a right click on the installed player and it will tell me what version it is.

I just downloaded JW 5.67, extract player.swf, rename it to the current name in the subsonic/jetty/xxxx/webapp/flash folder and replace the original file. Rename JW Player 5.4 to Old JW Player 5.4. then drop player.swf into the directory and rename it to JW Player 5.4 when you're done it'll be named 5.4 but if you right click on it in SS you'll se that it's really 5.7

ffmpeg - go to http://ffmpeg.zeranoe.com/builds/ and download the latest static build for your system. This site is for Windows builds. Check http://www.ffmpeg.org/download.html for other OS's. I just extracted the ffmpeg.exe and replaced the file in C:\Subsonic\transcode

You can see the results on my site listed at the bottom.

Lower power CPU's may still struggle a bit wth transcoding. If you preformat your video to mp4 or flv, you can uncheck the mp4 transcoding abnd send the video directly to JW Player as mp4 is a native format for JW.

HTH YMMV

My system is an Xeon quad core 2.83 Ghz w 8GB ram
Gary J

http://bios-mods.com
http://www.maplegrovepartners.com
http://theaverageguy.tv/category/tagpodcasts/cyberfrontiers/
User avatar
GJ51
 
Posts: 3492
Joined: Wed Oct 20, 2010 11:58 pm
Location: Western New York

Postby rickeo » Mon Jul 04, 2011 11:45 pm

I responded in the other thread, but I still cannot get ffmpeg to use more then one core of my 4 core system.

Most of my films are 1080p and you can see the poor performance here:

http://chronophage.dyndns.org:8081

user/pass: guest/guest
rickeo
 
Posts: 30
Joined: Wed Jun 17, 2009 6:40 pm

Postby brink » Tue Jul 05, 2011 2:33 am

rickeo wrote:I responded in the other thread, but I still cannot get ffmpeg to use more then one core of my 4 core system.

Most of my films are 1080p and you can see the poor performance here:

http://chronophage.dyndns.org:8081

user/pass: guest/guest


That's pretty much what I'm describing, that the web player (plays transcoded FLV) can't be multithread encoded hence you will only use 1 core. I was able to disable hyperthreading in my system bios and this seems to have bought me a marginal increase in performance (because it's not essentially dividing 2 cores in half, delivering 1/4th of the potential performance, FFMPEG seems to take about 40% almost constantly now, going up to 45% here and there. Seems to bring buffering down to once every minute or so rather than once every 20 seconds...

I'm using the latest ffmpeg static build. I havent updated the jwplayer yet, but I'll consider doing that.

Far and away tho, disabling hyperthreading has helped me the most yet, I'd suggest that first.
brink
 
Posts: 8
Joined: Wed Jun 15, 2011 4:01 pm

Re: Tweaking FFMPEG for performance

Postby GJ51 » Tue Jul 05, 2011 5:02 am

brink wrote:Hi all,

I was wondering if anyone was knowledgeable in getting more performance out of FFMPEG. I have a machine with an ATOM D525/2GB running subsonic, during transcodes of 720p material I'll get bursty play. Logically it makes no sense to me because I have PS3 Media Player (which also uses FFMPEG) running on a separate Atom 270 which is a significantly slower processor, with no bursty play, it can even handle many 1080p media.

When I launch taskmgr I can see that at most FFMPEG seems to be using around 25% CPU. This seems low. One factor is that my PS3MS PC is running WHS (a stripped down w2k3 server) and the pc running subsonic is running Win7.

Before I was running ORB on this PC and while the video quality was awful, it was doing 720P encodes fine as well.

What I've tried so far with minimal success:
- downloaded the latest version of FFMPEG
- set ffmpeg to high priority in taskmgr (major PITA to do regularly)
- checked for other tasks tying up resources, but for the most part the PC is doing nothing else (it runs a VNC server, that's about it besides subsonic right now)

- added the "-threads 1" parameter into all my video encodes, it's pure assumption because the man page for FFMPEG isn't clear at all, but I believe this will multithread and hopefully use both cores on the cpu. Web research would indicate that this is a specified number of threads you want the process to use, but anything besides 1 seems to break the web player.

update, found this in the logs, seems to indicate to me that FLV is multithreading incompatible.

[7/4/11 1:57:09 PM PDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) [flv @ 02875CC0] multi threaded encoding not supported by codec




I seem to remember reading that the ffmpeg default was -threads 0 which enabled all available cores. I am NOT using any -threads paramaters in my transcoding strings.

I just transcoded a few more mkv files and put them in the video folder. I can play 3-4 at the same time with no significant degradation in performance.

I'm also not sure why you'd use mkv over mp4 as using mkv will transcode and only output a max of 2000kbps which would decrease the quality of the video a bit. By transcoding to mp4 and turning the transcoding off the video plays at full resolution quality. I have both an mkv in the video folder and an mp4 in the movie folder of Casino Royal. Comparing the two is revealing, especially in regard to dropped frames and the crispness of the graphics after the opening scenes.
Gary J

http://bios-mods.com
http://www.maplegrovepartners.com
http://theaverageguy.tv/category/tagpodcasts/cyberfrontiers/
User avatar
GJ51
 
Posts: 3492
Joined: Wed Oct 20, 2010 11:58 pm
Location: Western New York


Return to Help

Who is online

Users browsing this forum: No registered users and 33 guests