Log in

View Full Version : comparable configuration for xvid as used before for divx


dideldum
19th December 2007, 13:19
Hallo,

I've used DivX on Windows for years now, but as converting videos was the last reason to use Windows and everything else I do on Linux, I want to switch to XVid finally.

I used Dr.DivX 2.0.0b2 with DivX encoder 6.4, even if there were newer versions. Dr.DivX broke the Preview window with newer versions (cropping was not made visible) and anyway was not updated to handle encoder versions newer than 6.6.

With this configuration I was quite satisfied regarding speed and quality. I use the highest quality encoder option (insane) with autocropping, lanczos4(fast)-resizing, imagesize usually 704x544 (PAL, 4:3) or sometimes 720x400 (PAL, 16:9) with a bitrate of 1400, converting with 2pass(fast 1st pass). This is my standard, which works with a perfect quality for practically everthing (movies, series, anime).

With Dr.Divx 2.0.0b2, DivX 6.4, Windows XP (32bit) on a Core2Duo E6300, 2GB RAM converting needs more or less the video time, e.g. one episode of "Home Improvement" (~21min) needs 1 minute for the audio conversion to mp3 (only 1cpu used with 100%), 5 minutes for the fast 1st pass (about 100fps at 80% of both cpus) and 15 minutes for the second pass (about 34fps at 80% of both cpus). This is typical for any conversion I do.

Now I tried the same epsiode with XVid on the same machine using gentoo 2007.0 x86_64 with my own 2.6.22-r9 SMP 64bit kernel.

First of all I noticed, that the XVid package is single-threaded. I found on the Internet a multithreaded version, but this is not packaged in Gentoo, so I haven't tried it so far.

I tried a 2 pass encoding with the following commands:

mencoder home_improvement_episode.mpg -nosound -ovc xvid -xvidencopts pass=1:bitrate=1400:turbo -sws 9 -vf crop=696:572:20:2,scale=704:544 -o /dev/null
mencoder home_improvement_episode.mpg -oac mp3lame -ovc xvid -xvidencopts pass=2:bitrate=1400 -sws 9 -vf crop=696:572:20:2,scale=704:544 -o /video/converted/home_improvement_episode.avi

The cropping and resizing values are the same as I used with DivX under Windows. I don't know, which version of Lanczos is the resisizing method (-sws 9), the man-page only says "Lanczos", in Dr.DivX I used "Lanczos4(fast)".

Unfortunately the 1st pass was running only with 17fps (about 6 times slower than the 1st pass in Dr. DivX). As my DivX 1st pass was multithreaded and the Xvid lib is singlethreaded, I could understand half the speed, but 1/6th?

The second pass with XVid was running faster than the 1st (with 21fps). This is surprising for me, because I set "turbo" to the first, but not to the second pass. Comparing to 34fps with multithreaded DivX the second pass of Xvid conversion with singlethreaded 21fps seemed better (though I doubt to reach 42fps with multithreaded Xvid in second pass), but the overall conversion time was still much longer than Dr.DivX on Windows.

I guess, I could improve things with the right switches and here I ask XVid-professionals for their help (thanks for reading patently until here, btw).

How can I tune the XVid conversion with mencoder or another tool (I tried avidemux, but the first pass was even slower: 7fps, in spite of setting turbo in the preferences!) to get the same high quality as I had with my DivX settings with a similar speed as Dr.DivX?

I want to stay with a bitrate of 1400 as this gave me a perfect quality for anything. I really don't want to test always, if 1300 or 1100 or 900 would also do it...

I want to stay with the high PAL resolution as I watch the converted videos later on a normal TV/beamer.

Regarding the resulting size: my converted DivX videos are normally factor 2.2 to 3 smaller than the original mpg (650MB Home Improvement as mpg are ~250MB DivX with my settings). I would like to reach more or less the same compression with XVid, but I really don't care about 30MB more or less, finally the episodes are stored on DVD and it doesn't matter, if there are 16 or 18 episodes on one DVD.

I would really appreciate your help to use XVid encoding under Linux with same quality and similar speed as I know it from DivX under Windows, as this would finally let me get rid of Windows completely!

dideldum

dideldum
12th January 2008, 17:19
Nobody here to help me?

I still stay with DivX on Windows, just because it is so much faster than XVid on Linux.

But I would really like to do my encoding on Linux.

So, please, if there is an XVid expert here around, who can tell me good options for 64bit Xvid conversion under Linux (which provide me with same quality and equal or better speed as I described for my DivX conversion under 32bit Windows XP), don't hesitate to tell me!

dideldum

keeperofdakeys
17th January 2008, 07:35
hello
you can get a Xvid VFW codec for use with a program like VirtualDub (http://www.sourceforge.net/projects/virtualdubmod) on windows
Xvid can surpass DivX in quality in most cases just try using the home profile
keeperofdakeys

dideldum
17th January 2008, 11:57
Xvid VFW codec for use with a program like VirtualDub on windows

Hi,

thanks for your answer (I felt a little bit ignored already).

But I don't want to use Windows anymore. That's the point. I use Windows only for DivX conversion, all the rest I do is on Linux. So VirtualDub is not an option, as this doesn't exist on Linux. (By the way: I tried VirtualDub with DivX and it was slower than Dr.DivX using the same Codec version and options, so VirtualDub anyway was never an option for me.)

As DivX is not really continuously developed on Linux (I think it stopped with DivX 5, while on Windows there is 6.8), I want to use Xvid. But if you have a look at my first post, using the Xvid conversion with mencoder on 64bit Linux was by far slower than Dr.Divx with DivX 6.2 (using the highest quality options!) on 32bit Windows (same machine).

So I would like to know, what I could do better with XVid on Linux. What options do I miss to make it faster? Are some of the options "wrong", which I used in my test? (You can see my conversion commands in my first post).

I believe you, that XVid can provide me with better quality than DivX, but I want to use XVid with the same quality (or better) as I am used with DivX AND it should be at the same speed (or better) as I am used with DivX.

I still would appreciate any help to make my experience with Xvid on Linux better, as I really would like to get rid of MS operating system...

dideldum

communist
17th January 2008, 12:51
As far as I know DivX has much better multi-threading than Xvid. DivX simply is faster in such a scenario.

I dont know the default Xvid settings (in mencoder) but have you tried setting VHQ=0 and disabled "VHQ for B-frames" too?

20-40
17th January 2008, 13:17
I have never achieved same speeds on Linux as on Windows, even if my Xvid and mencoder SVN revisions were the same, as compilers, settings, etc…
I gave up and I use Win for any media editing and creating. On Win XP OS everything is approx. 20% faster (as I can remember, 54 fps to 72 fps) plus Avisynth is available for Windows, and that has made my decision easier…

As far my experience goes, you cannot expect nothing else, because you and me have pretty similar machines, and my OS.es are always in top condition… so I think that nothing new will pop-up in foreseeable future.

communist
17th January 2008, 13:24
The OP is comparing DivX on Windows with Xvid on Linux.

20-40: I'm surprised that the same Xvid rev. with same compiler / settings gives better results on Windows. I'll definately have to time it next time I plan to do an encode.

dideldum
17th January 2008, 13:42
I dont know the default Xvid settings (in mencoder) but have you tried setting VHQ=0 and disabled "VHQ for B-frames" too?

Thanks for your hint!

Unfortunately neither do I know the defaults. The mplayer documentation (which contains mencoder) gives some hints for options with quality and speed. They seem to indicate, that mencoder defaults VHQ=1 and BVHQ=0.

I have to use another input file than in my first post (I already had it converted finally with DivX and deleted the mpg-file). So with another mpg I tried to encode with "-xvidencopts pass=1:bitrate=1400:turbo:vhq=0". This encodes with only ~22fps. I removed the vhq=0 and it encodes with ~21fps. I remove the "turbo" and it encodes with ~20fps. I even removed the cropping and resizing and it didn't make any difference. By the way: I want to use high quality settings. With DivX I use always "insane quality". Using vhq=0 with XVid would reduce the quality quite a lot, wouldn't it?

So the first pass with XVid 1.1.3 on 64bit Linux is encoding only with ~20fps obviously not regarding the options really. The same file on the same machine (but 32bit Windows XP) is processed in the first pass in DivX 6.2 with Dr.DivX 2.0.1b2 with ~130fps (with highest quality settings!). The second pass with DivX is encoding with about 34fps, while I didn't have the patience to wait for XVid terminating the first pass to try the second one (but as you can see in my first post, my experience is with ~20fps, too).

So why is XVid so much slower? Even doubling the numbers (imagining a multithreaded Xvid version would be really twice as fast) would be much worse than DivX (at least the first pass). I think, there MUST be options to optimize XVid. So many people use it, this wouldn't be the case, if all had my experience, would it?

dideldum
17th January 2008, 14:02
The OP is comparing DivX on Windows with Xvid on Linux.

That's true. The reason is, that I was very satisfied with speed and quality of DivX 6.2/Dr.DivX 2.0.1b2 under Windows.

But as my wish is to remove Windows completely from my PC, I have to switch to XVid, as DivX5 on Linux is not comparable with DivX 6.

The comparision is indeed quite strange: 32bit Windows XP, Dr.DivX 2.0.1b2, DivX 6.2 vs. Gentoo x86_64 SMP, XVid 1.1.3, mencoder 4.1.2.

But if I want to use only Linux, this is what I have to use. I cannot do x.264 conversion on Linux, as my DVD player doesn't understand it. It would probably anyway be even slower, wouldn't it? (I haven't tried so far)

I'm happy, that finally there are people taking care about this topic. That still gives me hope, that there is a satisfying solution to use XVid. Though 20-40s comment is a bit disappointing for me (regarding the speed differences between Linux and Windows)...

20-40
17th January 2008, 15:10
Gosh, I've never been good in writings, what I tried to say was my experience and conclusion is from such.
What I honestly think is, as always is, some price to pay - BUT considering only the speed - Linux COULD be faster. It depends what input is, what one needs, etc... As you can see, in following tests Linux was fast as XP; marginaly (~1 fps slower), but was. Sucus is - Linux is for free (mainly) and Win … well, OS itself isn't, but software is.
Nevertheless, I took into account what IS the most important thing: and these are - applications such as Avisynth, VirtualDub & Mod, DGindex… just to name a few. But one must keep in mind that is something I (me) need… or want.
XP:
http://free-kr.t-com.hr/zeman/mencoder_XviD_XP_2nd-pass.jpg
Linux:
http://free-kr.t-com.hr/zeman/mencoder_XviD_Linux_2nd-pass.jpg

dideldum
19th January 2008, 21:20
Thanks, 20-40, for your informative post. As I can see, with high quality settings on your machine you get only ~17fps (1st or 2nd pass?). This is more or less the same as I have on my machine.

Compared to the DivX speed with highest quality this is absolutely not satisfying for me.

I'm now experimenting with libavcodec's mpg4 conversion on Linux using mencoder. This gives me >100fps in 1st pass. In the second pass I'm still not sure about all parameters, but I already got a quite good quality with same resolution and bitrate as in my XVid- and DivX-tests. Conversion speed was (with different parameters like mbd=2 set or not set) between 60 and 90fps. This is so much faster than XVid, that I think, we can close this thread. I will probably not continue investigating more possibilities with XVid, as lavc on Linux seems to be the perfect solution for me.

Nevertheless many thanks to all here, who were providing me with help and information!

dideldum

communist
21st January 2008, 12:56
XviD on WinXP SP2 vs XviD on Debian Etch, machine: X2 4400+ 2GB RAM, same PAL DV source, XviD settings at default except bitrate - changed it to 1400

Result: pretty much same speed, slightly above RT (25fps), though a tad bit faster (~1fps) on Linux (maybe because I'm running Xfce and not full Gnome/KDE).

I wanted to search for that thread concerning XviD & multi-threading but didn have time - luckily someone just posted in it. Reading it now again I see that you'll definately need a 1.2.x build, 1.1.x dont have MT at all.

http://forum.doom9.org/showthread.php?t=107783

I'll post my results once I get around to compiling it etc.