Log in

View Full Version : QuEnc 0.55 [Alpha]


Pages : [1] 2

Nic
26th October 2004, 19:36
Hi,

http://nic.dnsalias.com/QuEnc.zip
(Sourcecode: http://nic.dnsalias.com/QuEnc_src.zip )

So busy, so thought i'd release a quick update. This version is pretty much a test version as I haven't had time for any testing. When finalized and a few more things added it will become v0.60.

Changes:

Now can select TFF or BFF
Now can select a custom matrix (using XviD style matrix files)
Added alternate scan to interlace encoding option
AviSynth Exception handling (if there was a problem in the AVS File, a MessageBox will popup with the error)
Better stability (with luck ;) Should never crash on exit or with AviSource, etc etc)
No longer uses DLLs, links directly, as DLLs are rarely compatible between versions and only cause problems (IMHO)
Updated to latest CVS
Minor speed up code


Let me know how you get on,
-Nic

ps
I plan to add a few more bits and pieces before 0.60 (some of the things straight from NuEnc :) ). But want to check stability with you guys first.

Paced
27th October 2004, 08:42
Thanks for the update Nic, I'll try it out as soon as I get the chance.

Peter Cheat
27th October 2004, 10:00
Custom matrix was definately a necessary feature. Field ordering selection was also a common request. Good job.

btw,
How did you fix the crash on exit? I just couldn't figure it out.

Nic
27th October 2004, 10:17
Hi Peter,

Thanks. :) To fix the crash (and have AVS Exceptions), just use AVSReader.h and AVSReader.cpp from the latest QuEnc source. Was to do with closing down the AVI stuff properly. (Strangely)

@Peter & everyone:
What other features are needed/asked for/wanted?

-Nic

Peter Cheat
27th October 2004, 10:50
Some requests that have come up are:

-audio encoding (mp2 would be easy to implement)
-encoding preview (why? I don't know)
-muxing
-shutdown when done option (not necessary, can use external app)


There were probably others, I can't remember them now.

Nic
27th October 2004, 11:00
Audio encoding -
Well libavcodec's is probably the poorest quality MP2 Encoding because there's no psychoacoustic model. Perhaps we can add another library for doing that.

Encoding Preview -
Yup that is a waste of time ;) lol, but maybe it could be useful. We'd have to encode the frame then decode it then output it to a window. Might be fun....Hmmm might add that, what do others reckon (generally it would just slow down the encode)

Muxing-
We could add another dialog in there that just uses the mplex code. Could be useful I suppose

Shutdown-
I think my version has already got that.

One thing that would be good I suppose is to write a proper Program Stream with Audio and Video taken from the AVS and encoding as MP2 and MPEG-2. Another thing to look at I suppose.

What would you guys all vote for?

Cheers,
-Nic

Peter Cheat
27th October 2004, 11:21
I vote for mp2 encoding via toolame and mp3 encoding via lame :D
Throw in AC3 while were at it. I could implement it if I knew where I can find information on AviSynth and how to take the audio data out.

Muxing would also be useful (using latest version of mplex). Commandline is too hard for some people.

BTW, I tested QuEnc 0.55 Alpha. It seems to be slower than previous versions, but results was still very good as expected (tested on Bourne Supremacy trailer).

Teegedeck
27th October 2004, 11:21
Originally posted by Nic
One thing that would be good I suppose is to write a proper Program Stream with Audio and Video taken from the AVS and encoding as MP2 and MPEG-2. Another thing to look at I suppose.
That would be fantastic and just what I'd need to easily reencode some stuff and leave it at my parents' home in order to watch it on a DVD player during some of the longer and more boring visits...

Thanks for the new version, Nic!

dragongodz
27th October 2004, 12:36
select a custom matrix (using XviD style matrix files) - works

Shutdown-
I think my version has already got that.
it has and it works (windows xp SP1).

where do you come up with these great ideas ? :cool:

mp2 encoding via toolame
already mentioned to Nic a loooong time ago. he does need reminding some times now he's getting older though. :D

mp3 encoding via lame
completely undesirable and dangerous. newbies are meant to be able to safly use this too.

also -
AviSource - 2 pass works
2 pass - 1 or 2 frames works.

now a bug -
VBR time length wrong, even effected by bitrate.
example - 40 second clip. encode VBR(mpeg 1 or 2) at 3000 on playback said 15seconds but did keep playing past that. at 2000 playback length reported as 9 seconds. tested with MediaPlayerClassic internal mpeg decoding and windvd.
CBR however did not suffer the same problem.

freelock7
27th October 2004, 22:02
Thanks Nic to add the matrix option. It's very useful when working at low bitrate.
Works fine.

Peter Cheat
28th October 2004, 08:49
The time is reported correctly with the tests I've done.

Tested using Windows Media Player 6.4 and Windows Media Player 9.0 using Elecard MPEG2 decoder (also reported correctly by FFDShow, but the decoding in that is fubar atm).

Maybe it is a decoder fault dragongodz?

Why is MP3 encoding undersirable? It's available in TMPEnc, and TMPEnc can't even mux it properly! You could easily create a message saying that "using MP3 audio is a bad idea so don't do it unless you know what you are doing". A lot of new DVD players can play it, so why not throw it in?

lithoc
28th October 2004, 09:10
@Peter
I've tried your mplex2, my DVD player can't playback. It only output garbage audio signal but the video is fine.
I think mp3 is optional, it is not a DVD-Video standard.

But if you must, I think noob user need to be warn.

Cheers,

Mug Funky
28th October 2004, 09:35
woo-hoo! thanks for the alternate scan, and field order, nic.

i'm off to see how this performs on PAL fieldblends :devil: i'm thinking it'll be a CCE killer by now.

Peter Cheat
28th October 2004, 09:42
Not all new players can play it. But the chances are pretty good if your DVD player plays MP3 CDs. It is out-of-standard after all. Brand-name DVD players may not support it because they like to disallow cool undocumented features (friends Sony DVD player spits my discs out). In Australia, If you've got a newish cheapo ATD or Audiosonic DVD player, the ones I've tested work :D

You sometimes get garbage audio if you are trying to play 48kHz mp3 audio when a player only supports 44.1kHz. I've noticed this on one particular player (cheap import, brand was GP or something).

Back on topic. I think that it is a good idea. AC3 encoding would also be good. I've sort of tried to do it, but I suck when it comes to VFW. I can't find the documentation I need.

RobertR
28th October 2004, 11:08
First of all thanks for your efforts Nic (even if i'm screwed and can't use QuEnc under Linux :)))

What i would like to see in QuEnc is ability of creating GOPs on given frame. I know that Peter has it on ToDo list but i'd rather have him working on ratecontrol ;)

lithoc
28th October 2004, 11:12
Originally posted by Peter Cheat
You sometimes get garbage audio if you are trying to play 48kHz mp3 audio when a player only supports 44.1kHz. I've noticed this on one particular player (cheap import, brand was GP or something).



HHmmm... may b i should give a second try on 44.1khz cos last time when I try it, was 48khz sampling.

Now that what I called non-standard :) cos according to mp3 standard, 48khz is always there.
May be is because it is (s)vcd that doesn't support 48khz.
but i try svcd (mpeg2 + 48khz mp2) is ok.
I never play a normal 48khz mp3 only disc in my dvd player tho.

Anyway thanks for your oppinion.

dragongodz
28th October 2004, 11:28
Maybe it is a decoder fault dragongodz?
maybe but its strange that both MPC's internal decoder and windvd both suffer from it. i will have to try some others when i get time.

Why is MP3 encoding undersirable? It's available in TMPEnc, and TMPEnc can't even mux it properly! You could easily create a message saying that "using MP3 audio is a bad idea so don't do it unless you know what you are doing". A lot of new DVD players can play it, so why not throw it in?
yes Tmpgenc can do it, by use of an external encoder. are there any other encoders that you know of that can ?
as for why not throw it in -
.its not any sort of standard(or remotly close).
.some players may play it but is that even close to a majority ? i doubt it.
.its just a really bad idea. :D

damian_dimitri
28th October 2004, 12:16
hello,

thank you for all the time you put in this great tool.
I was looking at the new option; Xvid style matrix files. So i ran to the Xvid thread. I found these ones;
http://forum.doom9.org/showthread.php?s=&threadid=83125
Can i use these?
It does have an other extension then *.txt.

thank you in advance.

Damian

Paced
28th October 2004, 12:21
Originally posted by damian_dimitri
hello,

thank you for all the time you put in this great tool.
I was looking at the new option; Xvid style matrix files. So i ran to the Xvid thread. I found these ones;
http://forum.doom9.org/showthread.php?s=&threadid=83125
Can i use these?
It does have an other extension then *.txt.

thank you in advance.

Damian

Yes you can (as long as it was created, and saved, within XviD's configuration screen), just make the 'Files of Type' = 'All Files' when selecting a matrix. Or, you could always just rename the extension to .txt.

Nic
28th October 2004, 13:14
is .xcm a common extension for that style of Matrix file? If so i'll add it.

If anybody want's another type to be supported post links to examples and i'll add them.

(Also I've never checked that the matrices are being used properly, they should be, but they might not be, so if someone can confirm it then please let me know :) )

Cheers,
-Nic

damian_dimitri
28th October 2004, 13:20
Hello,

ty both for the fast reply.
I am new to all this matrix stuff, but i want it to give a go with dvd-rebuilder. So i honestly can't answer if *.xcm is the normal extension.

btw.. trying Quenc at the moment with dvd2svcd..not sure if it accept the matrix, but it does encode :)

till soon

Damian

Teegedeck
28th October 2004, 13:24
Well, I guess the best proof we can hope for is different filesizes and different quality when using the same constant... which reminds me: Why isn't there a constant quantizer mode? :)

Nic
28th October 2004, 13:27
@Tee: Good question, I'm still not sure if it will behave when restricted to one quant. I'll try it....should be just a case of setting min quant and max quant to the same value.

-Nic

damian_dimitri
28th October 2004, 13:35
hi

i tried to rename the *xcm file to *.txt. But when i opened it, as *.txt, i don't see anything readable. So i am not sure if it just can be renamed.


Damian

Nic
28th October 2004, 13:45
It can be renamed, the examples I had were in *.txt format. (available here: http://nic.dnsalias.com/XviD_Quant_Matrices.zip )
Renaming them will only make it easier for you to find them by browsing in QuEnc, that's the only difference.

You won't find anything readable. it's a 128 byte file with each byte representing one of the numbers of the two matrices.

-Nic

dragongodz
28th October 2004, 13:48
Also I've never checked that the matrices are being used properly, they should be, but they might not be, so if someone can confirm it then please let me know
i already did. bitrate distribution changes with different matrices so yes i would say it is working.

is .xcm a common extension for that style of Matrix file?
the ones that come with Koepis build/installer(in zip) are all .txt. however the .xcm probably came from using this matrix ed by Ligh since thats the extention it uses.
http://forum.doom9.org/showthread.php?s=&threadid=73666

Why isn't there a constant quantizer mode?
Good question
Mug Funky already asked about this before. you do still have the list dont you Nic ? :)

update on the playback time problem.
moonlight mpeg splitter with MPC decoder played by MPC(of course)= bad
moonlight mpeg splitter with intervideo decoder played by MPC = bad
windvd 6 = bad

mainconcept mpeg splitter with MPC decoder played by MPC(of course)= good
mainconcept mpeg splitter with intervideo decoder played by MPC= good

also windvd 6 had the same problem playing back a MainConcept elementry stream so i will have to get the latest version and see if thats been fixed.

Nic
28th October 2004, 14:02
@dgz: Yup, you give me all the good ideas, I pretty much instantly forget them. My memory is cr*p, but least we're working as a team ;) Testing constant quant now (at least for first pass (Q=2), seeing if it helps)). Getting my faster computer soon....spent a little too much money, I should start taking donations lol! ;)

I think the problem is in mpeg.c, there have been a number of wacky little changes. Look at emails by Chris and Paul Curtis on the ffmpeg mailing list...I think they've mentioned something similar.

Cheers,
-Nic

Peter Cheat
28th October 2004, 14:09
I can confirm that the matrices are exactly as they should be (checked with ReStream). Values correspond to the values I put in so its all ok there. Is the time problem really an issue. It will go away when you mux the file, presumably it will be muxed at some stage (you need audio :D).

Nic
28th October 2004, 14:16
The problem won't necessarily go away. GOP Timings could be completely wrong or something else that could make very picky players fail. I admit it shouldn't be too much of an issue, but it's one i'd like to correct (or to be corrected ;) )

-Nic

ps
Thanks for the confirmations :)

dragongodz
28th October 2004, 14:28
Is the time problem really an issue. It will go away when you mux the file, presumably it will be muxed at some stage (you need audio
well i already said under what conditions it happens. so seems to be a software(splitter) problem not limited to QuEnc. i havent tested it on hardware.
uhh actually you dont HAVE to have audio at all. its just that in 99.99% of cases you will. :D

Getting my faster computer soon.
so what are you getting exactly ?

Yup, you give me all the good ideas, I pretty much instantly forget them. My memory is cr*p, but least we're working as a team
yes i can forget them aswell which is why i made that list. :)

Nic
28th October 2004, 14:41
so what are you getting exactly ?
Yeah, that didn't make sense did it? ;) I meant i'm doing testing now and it's taking forever...grr. Testing on my new rig will be more of a joy...

-Nic

Peter Cheat
28th October 2004, 14:54
dragongodz - try to mux the file and see if the time is ok.

dragongodz
28th October 2004, 15:32
downloaded latest windvd 6. uninstalled old and installed new. problem still there.

muxxed with audio to vob with Rejig, playback in windvd fixed
muxxed with audio to mpg program stream with bbmpeg, playback in windvd fixed
Tmpgenc crashed when attempting to run. guess its not happy i havent rebooted after installing windvd.

muxxed with audio to vob with Rejig, playback in MPC with moonlight splitter/demuxer set to FPS = bad
muxxed with audio to vob with Rejig, playback in MPC with moonlight splitter/demuxer set to PTS = ok (actually it said it was 1 second short but hey thats a huge improvement)
same results for bbmpeg muxxed files.

Nic
28th October 2004, 22:56
Minor Update (for next release):
1) Tried using Overlapped writing for a performance improvement, it wasn't noticeable so I won't bother adding it.
2) Const Quant has been added and will be in the next version. At present if the bitrate is set to 31 or less then it becomes Const Quant mode. (you'll see what I mean)
3) First pass of a 2 pass encode will be done in constant Quant (Q=2)
4) Added .xcm to the matrix browse dialog

5) I'm completely rewriting the way I output files so it outputs them using libavformat (even if it's just a raw M2V stream). This will allow reading video and audio from an AVS file and then outputting them directly to a DVD style Program Stream. Cool huh? (pretty much already working) (to begin with, will use libavcodec for mp2 encoding, will use tooLame later)

Will be out next week,

-Nic

damian_dimitri
29th October 2004, 03:27
wow,

hardly can wait.....

damian

Peter Cheat
29th October 2004, 08:53
The first pass in Quant 2 is a very good idea. Definately produces better results.

Muxing solves the time problem by the look of things. Can you make it mux to a System Stream too? Actually, that'll probably be a bit much.

guada
29th October 2004, 11:15
Thank you Nic, it's some beautiful work.
It's for when, the next optimization,
no it was just a joke :p ;)

Bye ;) ;)

Teegedeck
29th October 2004, 11:32
I am looking so forward to the next version! :) :)

guada
29th October 2004, 11:47
I can make you Teegedeck confidence.
I remember again of my first post in the Xvid category :)

Bye ;)

Koepi
30th October 2004, 08:51
I like the new version, I think the output looks better. And it hits target size more accurately.

Unfortunately it made my computer lock 2 times on the same file, dunno if it was in the same position both times (20% 2nd pass).

So I look forward to the next version with Q2-1st pass, audio encoding and muxing ;-)

Btw., xvid's 2pass2/2pass1 are so modular, maybe you can use some of that code to improve ffmpeg's 2pass code?

Regards
Koepi

Peter Cheat
30th October 2004, 09:31
I already tried using XviDs 2-pass code with ffmpeg. Couldn't get the damn thing to work. Its a waste of time trying, believe me.

Koepi
30th October 2004, 09:49
Nah, don't forget what kind of genius Nic is. He's probably already added that while we are typing :cool:

I think Nic was involved at least reading-wise) when we were designing the 2pass stuff, so there's a good chance he understands the admittedly not-so-simple code well enough to properly interface it with libavcodec. Just a guess though.

Regards
Koepi

Peter Cheat
30th October 2004, 10:47
I know Nic is a genius :D

But it isn't a simple exchange. Masking is also handled by rate control in ffmpeg, as well as a few extra things. XviD source is much easier to understand than ffmpeg source, let me tell you. Not much is explained so you have to work it out line by line. The rate control in ffmpeg is not too bad, the way bitrate overflow and underflow could do with improvement along with fixing some mpeg 1&2 specific issues, but apart from that its not too bad.

dragongodz
30th October 2004, 12:08
xvid's 2pass2/2pass1 are so modular, maybe you can use some of that code to improve ffmpeg's 2pass code?
yes i mentioned looking at that a long time ago. especially the work done with the 1.1 branch for rate control.
actually 1 program that does try and use xvid rate control with avcodec is avidemux, http://fixounet.free.fr/avidemux/ . when you select video "dvd(lavcodec)" and go to its settings it has a checkbox for using xvid.

Peter Cheat
30th October 2004, 12:25
Have you tried it? :)

The results are, well, a little disappointing. Its output seems worse than when using ffmpeg's rate control.

fabrice
30th October 2004, 16:37
Hi,

I'm trying to use an external matrix in quenc, and every encode I do uses the standard matrix (that's at least what Restream says me). Only if I check QLB matrix, Restream indicate me a non-standard matrix.
What am I doing wrong?
My settings are:
- MPEG2
- bitrate 2078
- Use VBR
- High Quality
- Gop size 12
- 16:9 aspect ratio
- 8 DC precision
- 5000 max bitrate
- custom matrix: bach1.txt (a xcm renamed file).

What is wrong?

Thanks,
Fabrice

mean
30th October 2004, 19:56
A quick note about using the use of xvid ratecontrol in avidemux.

It uses the old xvid ratecontrol code, because it is a separated libary
and hence can be used for xvid 0.9, mpeg2enc and lavcodec.

Since it is the old 0.9 xvid ratecontrol, the engine does not handle B frames and sees them as p frame.

So B frames are encoded with lower quantizer. The size/quality is worsened by that.

The result with mpeg2enc and "average" bitrate is rather good.
(a bit slow thought), but mpeg2enc takes care of enforcing the max bitrate/vbv buffer model issue.

The idea for lavcodec was to be ready to use any ratecontrol easily.
And i intend to switch to newer xvid rate control and mix it with
peter vbv buffer model, but using the same framework
e.g. outside of lavcodec.

Following lavcodec changes and having to merge stuff is not really my idea of fun, so i tend to try to limit deep change in lavcodec.

Except some tiny stuff like the 3:2 pulldown patch.

mean
30th October 2004, 20:00
And vanilla lavcodec ratecontrol for mpeg1/2 is simply unusable on picky
standalone that enforce every line of the iso spec
Such as non-MT based pioneer and some philips.

dragongodz
30th October 2004, 23:10
And i intend to switch to newer xvid rate control and mix it with
peter vbv buffer model
the reason i explicitly mentioned the 1.1 branch of Xvid is worth looking at is because it has a VBV compliancy option. not to mention VHQ for B frames and stricter scaling options. :)

mean
31st October 2004, 09:54
thanks for the tip