Log in

View Full Version : Looking to use Xvid dev-api-4 with mencoder...


evade
1st December 2003, 16:28
But I can't find any documentation on doing this.

How should I set it up?

Does the current cvs version of mplayer check for xvid4 support?

Do I need to include the mencoder module @ http://ed.gomez.free.fr ?

What about the options? Will mplayer read them from an xvid4.cfg file in the working directory (like transcode) or do they have to be feed in on the command line?

Anyone have any examples?

evade
1st December 2003, 17:54
Originally posted by evade
What about the options? Will mplayer read them from an xvid4.cfg file in the working directory (like transcode) or do they have to be feed in on the command line?[/B]

Found my answer to this in the mplayer man page.

duh.

I think the latest gomez Mencoder module is built into the mplayer cvs source, does this mean It autodetects and uses this module?

doug_s
1st December 2003, 23:47
After I saw your last thread I started playing around with xvid-dev-api-4 under mencoder and I'm happy to report it's working extremely well.

I'll try to answer your questions, just keep in mind I'm merely a home user and not any kind of expert.

does this mean It autodetects and uses this module?

The compile proc does but I had to remove all other versions of xvid to get it to compile. It looks like you can only use one version at a time with mencoder.

But I can't find any documentation on doing this.

The man pages I have only have settings for dev-api-3, the cvs head branch. If you want to see the new parameters for dev-api-4 you have to read the source code. Look in main/libmpcodecs/ve_xvid4.c if you grabbed the source using cvs.

Anyone have any examples?

The following is pass one and pass two of a two step encode:

mencoder dvd://1 -chapter 3-3 -ovc xvid -xvidencopts pass=1:cartoon:quant_type=mpeg:vhq=4:max_bframes=2:bquant_ratio=150:bquant_offset=75:bf_threshold=0 -vf detc=1,scale=640:480,hqdn3d -sws 9 -oac mp3lame -lameopts br=96:abr -ofps 23.976 -o xvid2.avi

mencoder dvd://1 -chapter 3-3 -ovc xvid -xvidencopts pass=2:bitrate=-68812: cartoon:quant_type=mpeg:vhq=4:max_bframes=2:bquant_ratio=150:bquant_offset=75:bf_threshold=0 -vf detc=1,scale=640:480,hqdn3d -sws 9 -oac mp3lame -lameopts br=96:abr -ofps 23.976 -o xvid2.avi

Sorry for the cut and paste mess. I got those out of .bash_history, they were my last test, they were entered as one line each and they produced good results.

Some explanation:

This was an anime dvd so I used the new cartoon setting.

I only did one 10 minute chapter cause I'm still just playing with it.

This was a region 1 (North America) dvd that required inverse telecine. It worked well, the results had smoother motion than direct dvd playback under xine. If you backup PAL dvds you don't need to do this.

No cropping was required for this dvd. Normally you should crop.

The dvd was extremely noisy so I used the mencoder high quality denoiser. It made the pass 1 size less than half of what it was without noise filtering and looked better too.

These settings basically just mimic the snowbeach and gordian knot settings I use in windows. If the developers in the mailing list say to do something different listen to them.

Note that bitrate=-68812 in the second pass very carefully. This is actually sixty percent of the pass 1 file size in k-bytes. If you put a negative sign in front of the number it tells xvid-dev-api-4 that you are passing the expected file size and not a bit rate. This isn't documented, it's in the source code in the file I mentioned above.

I also did a comparison test using lavc (ffmpeg) as the codec. Xvid did a much better job on this particular dvd. That was a first, normally I use lavc.

Hope this helps.

evade
2nd December 2003, 01:48
Thank you Very Much. This helps alot.

I've gotten xvid4 working with mencoder and I have done a few quick samples to play with the settings.

It looks like I have some reading to do on the mplayer mailing lists.

cweb
5th December 2003, 13:51
I'm trying to do the same (xvid4) but when I try it tells me that XviD is not an available codec (yet it was detected correctly by mplayer).

unixfs
5th December 2003, 14:48
Hi,
when I use xvid3 and xvid4 the first pass always corrupts divx2pass.log
at the end of the encoding, so the second pass is always made at q=2.

I used these xvidencopts for both passes:

quant_type=mpeg:chroma_me:bitrate=1200:mq_quality=6

Did anyone of you ever experience (and solve) such problem?

Thanks.

evade
6th December 2003, 05:41
Originally posted by cweb
I'm trying to do the same (xvid4) but when I try it tells me that XviD is not an available codec (yet it was detected correctly by mplayer).

Mplayer tends to use ffmpeg to decode Xvid, which is fine.

Was Xvid installed at mplayer compile time?

is /usr/local/lib in your ld.so.conf, if not put it in and run ldconfig.

If you have both Xvid3 and Xvid4 installed then /usr/local/lib/libxvidcore.so must be a symlink to libxvidcore.so.4

after you've verified and recompiled 'mencoder -ovc help` will list the available video codecs.

Razorblade2000
7th December 2003, 15:04
Could anyone give me a short guide what I have to do to get mencoder running with the new XviD 1b2 codec???
Then I finally could batch-transcode some avi files I have on my harddisk.

The last time I tried I did this:
1. download the current xvid source + configure + make + make install (worked fine)
2. download the current mplayer CVS snapshot
--> when I did ./configure he detected xvid
--> when I did a "make" he quitted with an error (I don't recall which one)

... did they change anything in CVS so it does work now?

doug_s
7th December 2003, 15:22
They changed a field in an api header. The details are at www.xvid.org. Once the mplayer cvs is back in sync with xvid the problem will go away.

If you want to fix it ahead of time get the new modules from here (http://ed.gomez.free.fr/#mencoder_modules) and use them to overwrite the ones in mplayer. The files you want to replace are vd_xvid4.c and ve_xvid4.c in the libmpcodecs directory.

Razorblade2000
7th December 2003, 17:03
:confused: :( :confused:

Didn't work for me:

cc -c -O4 -march=athlon-xp -mcpu=athlon-xp -pipe -ffast-math -fomit-frame-pointe r -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I. -Inative -I.. -I. ./libmpdemux -I../loader -D_GNU_SOURCE -I../libmpflac -o vd_xanim.o vd_xanim.c
cc -c -O4 -march=athlon-xp -mcpu=athlon-xp -pipe -ffast-math -fomit-frame-pointe r -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I. -Inative -I.. -I. ./libmpdemux -I../loader -D_GNU_SOURCE -I../libmpflac -o vd_xvid.o vd_xvid.c
vd_xvid.c: In function `init':
vd_xvid.c:72: error: `XVID_INIT_PARAM' undeclared (first use in this function)
vd_xvid.c:72: error: (Each undeclared identifier is reported only once
vd_xvid.c:72: error: for each function it appears in.)
vd_xvid.c:72: error: syntax error before "ini"
vd_xvid.c:73: error: `XVID_DEC_PARAM' undeclared (first use in this function)
vd_xvid.c:93: error: `ini' undeclared (first use in this function)
vd_xvid.c:94: error: `dec_p' undeclared (first use in this function)
vd_xvid.c:124: error: `XVID_CSP_RGB24' undeclared (first use in this function)
vd_xvid.c:127: error: `XVID_CSP_RGB32' undeclared (first use in this function)
vd_xvid.c:140: error: `API_VERSION' undeclared (first use in this function)
vd_xvid.c: In function `decode':
vd_xvid.c:190: error: `XVID_DEC_FRAME' undeclared (first use in this function)
vd_xvid.c:190: error: syntax error before "dec"
vd_xvid.c:204: error: `dec' undeclared (first use in this function)
make[1]: *** [vd_xvid.o] Error 1
make[1]: Leaving directory `/home/marc/Desktop/MPlayer-20031207/libmpcodecs'
make: *** [libmpcodecs/libmpcodecs.a] Fehler 2

doug_s
7th December 2003, 17:19
It's having trouble because it's trying to compile the old xvid modules and not the new ones for dev-api-4. This happened to me the first time I did a dev-api-4 compile and I had to remove all traces of the old xvid stuff before it worked. Try cleaning out all traces of xvid from your system and starting over. Other than that I don't know what to suggest.

Razorblade2000
7th December 2003, 17:53
uuhhhhmmm... any doc how to do that?!

Razorblade2000
8th December 2003, 16:26
ok.. using the newest XviD CVS Version + the current mplayer cvs version I am able to compile and install both of em...

but:

mencoder fg.avi -ovc xvid -xvidencopts cartoon:quant_type=mpeg:vhq=4:max_bframes=2:bquant_ratio=150:bquant_offset=75:bf_threshold=0 -vf detc=1,scale=640:480,hqdn3d -sws 9 -oac mp3lame -lameopts br=64:abr -o xvid2.avi

gives me

Option xvidencopts: Unknown suboption cartoon


:confused: :confused: :confused: :confused:

Any idea?

doug_s
9th December 2003, 03:05
It might be because the cvs head branch is still dev-api-3. The last time I used cvs I had to specify dev-api-4 as follows:

cvs -d:pserver:anonymous@cvs.xvid.org:/xvid co -r dev-api-4 xvidcore

Try running that command again with pass=1 in front of cartoon. If you get an error message saying that b-frames don't work in two pass mode you are definitely using the old version and not the new one (the beta is dev-api-4). The cartoon switch only works with dev-api-4.

Razorblade2000
9th December 2003, 13:44
worked with you CVS Command! :D