Log in

View Full Version : transcode and xvid target size at 2 pass


GolovachLena
26th December 2003, 15:42
Sorry for this newbie question...
I'm trying to make my testing Linux box useful via encoding some DVD in transcode :) I prefer Xvid codec, 2 pass mode. With the first pass all is ok, but i can't understand how do i specify a target file size at the second pass? Please help.

mikeX
29th December 2003, 14:50
yeah i have the same question, and a lot more!
i just started out with transcode from the commandline yesterday, it's not as hard as i thought, but i haven't found a way to properly configure xvid 1 beta3 yet, xvid4conf is still outdated, any other suggestion (or maybe how to put the options on the xvid4.cfg file)

btw eduard gomez (http://ed.gomez.free.fr/) doesn't appear to have a transcode module for the beta 3, any ideas where i can find one (or is that the only place?)

@GolovachLena:

you can try using an average bitrate figure (-w 'bitrate' i think), provided that u have a bitrate calculator
i used the figure i got from Gordian Knot (windows) and it hit the jackpot with transcode, even better than setting the desired size (with beta2 on windows-slightly undersized)

evade
29th December 2003, 19:33
@GolovachLena:

In mencoder using a negative number for bitrate on the second pass of xvid will serve as a target size, I imagine this is true for transcode as well try a -w '-716800' for a 700mb rib


@mikeX

The transcode module for xvid4 is maintained by Ed Gomez of the xvid team and is almost always up to date (in cvs), It includes a default config file (with comments). Just modify this file with the values you want to use and save it in your working directory or at ~/.transcode/xvid4.cfg.

If you've installed transcode from source you can find the file at
/usr/local/lib/transcode/xvid4.cfg

mikeX
30th December 2003, 04:46
which cvs repository do you mean?
i checked both the xvid and transcode repositories with no luck :(

i found no export modules on the xvid cvs
& the xvid.h i got from transcode's cvs is dated 2003/12/05
(no dates on the export modules)

according to the changelog found on Ed's site:

***
2003-12-05 16:01:02 GMT patch-22

Summary:
Synced with xvid 1.0.0-beta2
Revision:
transcode-xvidmodule--devapi4--1.0--patch-22

Synced with xvid 1.0.0-beta2


modified files:
ChangeLog export_xvid4.c xvid4.cfg xvid4.h
***

so transcode's cvs still has the (not that much really) outdated beta 2 modules for xvid

what i did was recompile transcode using the 'xvid.h' header from the beta3 (taken from my 'include' dir) and the export modules from beta2

what i don't know though is how to make use of the extra settings the beta3 has in the cfg file (namely turbo), though i doubt the export_xvid4 module can handle them anyway

did i miss something about the cvs???

btw what's the deal with the 'High Quality AC Coefficient Prediction'?
it's not there on the configuration gui for window$

thanks anyway

evade
30th December 2003, 05:22
You're right. Sorry for not checking before I posted.

Both the transcode and mencoder modules are still at beta2. there won't be any turbo for us until those modules are updated.

However I have noticed a big increase in my first pass speed due to the new fast1stpass code.

GolovachLena
30th December 2003, 11:53
I imagine this is true for transcode as well try a -w '-716800' for a 700mb rib


Thanx, but it's not working :( transode just simple prints its command line reference and exits.

mikeX
30th December 2003, 12:07
@evade

yes i noticed the same:

1st pass 22 fps
2nd pass 10 fps
using 2 max b-frames
but no q-pel or gmc

i got 18-20 fps for the 1st pass & 9-12 (if i remember correctly) for
the 2nd pass using the beta3 on the same movie (same resolution) in windows (virtualdubmod)

apart from the different filters q-pel, adaptive quant (and probably gmc too) were enabled during the encode in windows but the second pass crashed at some point :(

i had turbo enabled and i believe it made quite a difference being that
transcode runs the 2nd pass at about the same speed but without q-pel and gmc
btw: where is adaptive quantization in the configuration file???
is it disquised into 'High Quality AC Coefficient Prediction'???

evade
30th December 2003, 20:59
Originally posted by mikeX
@evade
btw: where is adaptive quantization in the configuration file???
is it disquised into 'High Quality AC Coefficient Prediction'???

Not sure about that. mencoder has two option I haven't noticed or used before: hq_ac 'High Quality AC Coefficient Prediction' and mod_quant, which chooses mpeg or h263 on a frame by frame basis, I am not entirely sure what adaptive quantization does or which if either of those options it equates to with mencoder or transcode.

mikeX
30th December 2003, 22:25
i suppose mod_quant stands for 'Modulated HQ' in the windows configuration gui:
this has been abandoned since dev API 4 (the first betas) (http://forum.doom9.org/showthread.php?s=&threadid=67758)
'Adaptive Quantization' ('Lumi(/a) Masking' in dev API 3) aplies less bitrate on really dark or really bright scenes based on the fact that the human eye can't spot too much detail on such scenes (by dynamically modulating the quantization matrix??)
since dev API 4 i've read mostly good comments about it

what i can't find either is an option that specifies the maximum interval between I-frames as well as the zone sellection thing

well i guess i should start a new thread concentrating on this matter in the 'XviD' forum,
what do you think evade?

@GolovachLena
i suggest going through transcode's documentation, allthough i think the transcode web site has undergone some changes and the documentation is'n there anymore (at least i couldn't find it)

in any case i stick with my first suggestion, a bitrate calculator:
there has to be an xvid bitrate calc for GNU/Linux, and even if there isn't one you could try using one for windows under wine emulation

another suggestion is to try using a transcode frontend like 'dvd::rip' (http://www.exit1.org) where you can easily specify your desired size, preview your video clipped and resized and a lot more.
one drawback though is that you have to rip a dvd or have a dvd image on your hard disk in order to use it
it also gives out the transcode command line generated by your sellections, so you can check that out and see how it figures out the 2nd pass size, what i think though is that it internally calculates the bitrate for that size and uses that figure. i can't check it out at this moment though 'cause i don't have space for a dvd rip

evade
31st December 2003, 00:01
well i guess i should start a new thread concentrating on this matter in the 'XviD' forum,
what do you think evade?


Sure, you'll probably get your answer from a dev who knows the api.

jggimi
31st December 2003, 00:47
I'd move this to the XviD forum, but I thnk it's a little to linux encoding specific.

doug_s
1st January 2004, 19:36
Passing the requested file size to xvid as a negative number is supported by the xvid4 module but doesn't work because the transcode main program rejects a negative bitrate as an error. I checked the cvs version and it does the same thing.

I was able to get around this with a quick and dirty hack. Just delete line 1338 from transcode-0.6.11/src/transcode.c and recompile.

I tested this with both xvid beta2 and beta3 and it appears to work well and give the requested video file size just like when using mencoder. Transcode will report the bits per pixel rate as a negative number if you do this but you can just ignore that.

evade
3rd January 2004, 23:33
@mikex

We've got turbo and other beta3 stuff in the transcode and the mencoder modules now:

http://ed.gomez.free.fr/projects/transcode/ChangeLog-devapi4.txt

mikeX
4th January 2004, 04:16
quite right, thanks evade :)

you might find interest in this thread:
http://forum.doom9.org/showthread.php?s=&threadid=67976

GolovachLena
5th January 2004, 10:57
Originally posted by doug_s
I was able to get around this with a quick and dirty hack. Just delete line 1338 from transcode-0.6.11/src/transcode.c and recompile.

Thanks for the clue, i'll give it a try because i'm just curious. Generally, i still find overall productivity of transcode+xvid considerably lower than avisynth+vdub+xvid under Windows :( It's a pity 'cos i like linux. Probably it is transcode's fault, i think its filters and resize function much slower than avisynth's. Or may be i compiled it bad?

mikeX
5th January 2004, 18:30
yeah i agree with your last point Golovachlena
are you using the -Z option for resizing?
have you tried ",fast"?
it helped a lot with speed issues but the result seemed kinda weird
but i also used antialiasing with it(without really knowing what it does) so maybe that's to blame for the bad results)
u can also try out different resize filters (the default is Lanczos3)
i can't boot linux right now to try anything myself though :(

GolovachLena
6th January 2004, 09:48
Yes, i'm using -Z, not fast, no antialiasing. I get fps two times lower than that under Windows, but, strange, the first and the second passes go with approximately equal fps. Under Windows with Beta 3 of Xvid the first pass would always be 30-50% faster than the second one. Under Linux they're equal as i said. So, i think it's exactly transcode's fault to that! Seems like codec can't go beyond some relatively low threshold because it's already understated by transcode.

mikeX
6th January 2004, 12:27
hmmm, my tests with the old export modules for transcode were like this:

no fast resize:
1st pass: 13 fps
2nd pass: 8 fps

fast resize:
1st pass: 25 fps
2nd pass: 12 fps

so the difference between 1st & 2nd pass was still there for me, just like windows (and the speed with fast resize is similar to the speeds i get in windows)

which export modules are you using for transcode? have you tried the latest transcode's cvs? it has the new modules evade mentioned some time before

you should also give fats resize a try. if the loss in quality isn't noticeable i suppose it's quite useful :)

GolovachLena
6th January 2004, 14:03
transcode version 1.6.11, hope not much old.
import module vob, export - xvid4 (from ed.gomez.free.fr)

mikeX
8th January 2004, 09:01
finally booting linux again :D

some more feedback:

the results i previously posted where with version 0.6.11 as well.
my latest cvs update got me version 0.6.12 along with the latest modules by ed gomez

this is some of the speeds i get now:

************************************************************
1st pass::

xvid4.cfg:
quant_type h263
motion = 6
turbo = 1
chromame = 1
vhq = 1
max_bframes = 1
bquant_ratio = 150
bquant_offset = 75
bframe_threshold = 0
quarterpel = 1
gmc = 0
trellis = 0
packed = 0
closed_gop = 1
interlaced = 0
cartoon = 0
hqacpred = 1
frame_drop_ratio = 0
greyscale = 0
stats = 0


transcode command:
transcode -i vobdir/ -y xvid,null -Z 448x320,fast --export_par 71,56 -R 1 -w 650 -V -o /dev/null

speed: 25.04 fps

2nd pass::

xvid4.cfg:
[vbr]
defaults

transcode command:
transcode -i vobdir/ -y xvid,null -Z 448x320,fast --export_par 71,56 -R 2 -w 650 -V -o /output.avi

speed: 21.53 fps

**************************************************************
source is 720x576 @ 16:9 dvd

note the -V option, without it transcode is slower (offcource if you are not encoding yv12 content it's no use)

encoding the same clip in windows but @ 480x352 via avisynth & Lanczos i got better speeds, ~27-30 fps for the 1st pass & ~23-25 fps for the second, the difference is marginal as you can see

i'm also planning to encode with mencoder, as soon as i compile it properly and get a grip of it, in order to compare speeds (the speed decrease could be transcode's problem)

would you mind posting your specs as well as the command line options you use with transcode?

i'll be back soon with more tests ;)

camorra
5th March 2009, 19:11
Hi,
how do i specify a target file size with transcode 1.1.1 ? :helpful: