Log in

View Full Version : Mpeg2 encoders + colourspace


45tripp
20th March 2007, 22:06
hi,

I remember from old that TMPG would encode in rgb24 and CCE in yuy2.
I have no reason to think anything has changed.
All mpeg2 encoders are restricted to doing their processing in a single colourspace?

So it's HC in YV12, TMPG in RGB24, CCE in YUY2, Procoder in YUY2 (I assume from recent discovery).
What about Mainconcept. YUY2?

I tried looking for solid info. But really found nothing.

From what I've read and understand so far:
Taking TMPG as an example:

If you feed DVD footage to re-encode to a lower bitrate:
mpeg2 yv12 input -> internal conversion to rgb24 by tmpg -> encoding processes ->
internal conversion back to yv12 by tmpg -> mpeg2 yv12 output

My questions are:
a. does the above as I describe it actually happen?
b. does each encoder have a single prefered colourspace in which encoding occurs?
c. do some encoders not do internal colourspace conversions at all if not required? Are they
capable of encoding in different colourspaces?
d. is it always better to externally do the colourspace conversion required with a frameserver
before you feed material to the encoder, rather than let the encoder deal with it internally?

Something like that anyway.
Perhaps you could point out something to read that might help me better understand.

ty

45tripp
26th March 2007, 20:16
Anybody care to help?
correct me?
insult me maybe?

I'm open
ty

GrofLuigi
27th March 2007, 05:53
Hi Immersion, and welcome to the forum.

I think your questions are too general to be answered at once, and that's why were no answers yet. Although I'm not expert in this issues, I'll try to give you short answer as of how I understand this. I'm sure you know most, if not all, of this, and I don't claim to be totally acurate. :)

Mpeg2 is a defined standard (plenty of docs on the web) and is always YV12.

What colorspace each encoder expects as input is defined by its programmers and not always publicly disclosed or easily discovered. But yes, general notion is like you described (I don't know about MainConcept).

If you feed an encoder with data in colorspace it doesn't expect, usually, it queries Windows (DirectShow?) to do colorspace conversion, and that depend on the codecs installed in the system that are registered for that colorspace. In many cases, this is a problem because they (the codecs) make inappropriate assumptions about the nature of the material (interlaced vs progressive, chroma subsampling etc.). So that's another yes, it's always better to do the colorspace conversion by yourself via the frameserver (I hope you mean avisynth here :) ). I THINK that encoders rarely do the conversion themselves and I have not found AT LEAST ONE example where the codec made better colorspace conversion than AviSynth.

I'm sorry I don't have anything for you to read. :)

GL

45tripp
27th March 2007, 23:38
Hi Immersion, and welcome to the forum.
thank you.


I think your questions are too general to be answered at once,

I didn't think so. Pointers towards related specific info are welcome. Help in posing more specific queries is welcome.

I'm sure you know most, if not all, of this,
I know nothing :)


What colorspace each encoder expects as input is defined by its programmers and not always publicly disclosed or easily discovered. But yes, general notion is like you described (I don't know about MainConcept).
If you feed an encoder with data in colorspace it doesn't expect, usually, it queries Windows (DirectShow?) to do colorspace conversion,


It expects a certain colourspace input because it only processes in that specific colourspace?
What about output? If tmpg is encoding in RGB then surely it converts to yv12 internally with dvd output and is not dependent on external codecs for final colourspace conversion?

I don't understand the mechanics of it.
I don't understand programming.
Assume I know nothing.
I ask here because people here seem to know the nitty-gritty.


I THINK that encoders rarely do the conversion themselves and I have not found AT LEAST ONE example where the codec made better colorspace conversion than AviSynth.

I once read somewhere that someone had tested feeding CCE with avisynth converttoyuy2() and without.
With avisynth it was faster but with CCE only it was better. It was mentioned CCE does the conversion internally.

ty for your reply

GrofLuigi
28th March 2007, 04:33
Here's something to read:

thread (http://forum.doom9.org/showthread.php?t=37276) and the link (http://avisynth.org/mediawiki/YV12_FAQ)

Hope this helps. :)

GL

Boulder
28th March 2007, 06:21
I once read somewhere that someone had tested feeding CCE with avisynth converttoyuy2() and without.
With avisynth it was faster but with CCE only it was better. It was mentioned CCE does the conversion internally.CCE doesn't do the conversion internally. It requests a system codec (for example XviD, DivX, ffdshow or Helix) to do it. The problem is that if you have interlaced material, the conversion is done incorrectly because the codecs assume progressive input. I don't know if ffdshow could do the conversion properly by using an appropriate setting.

45tripp
28th March 2007, 17:27
thread (http://forum.doom9.org/showthread.php?t=37276) and the link (http://avisynth.org/mediawiki/YV12_FAQ)
Hope this helps. :)

perfect

CCE doesn't do the conversion internally. It requests a system codec (for example XviD, DivX, ffdshow or Helix) to do it.
ok.
What about output?
If you go from yv12 to yv12 for example with CCE, (yv12 -> yuy2 -> yv12) what is responsible for the final conversion of yuy2 -> yv12?

assuming not using avisynth:
if the program relies on vfw filters then the yv12 decompressor is defined in the registry under the VIDC.YV12 driver?
if it relies on directshow filters then how is priority for yv12 decoding defined?

ty for your help

p.s
I guess there is a way to find out what colourspace is expected as input for programs that don't disclose such info. is anybody aware of what testing would be needed? or if someone knows what input is expected from the mainconcept standalone encoder, that interests me more.

Boulder
28th March 2007, 18:59
The conversion in CCE is internal.

Try renaming the vidc.yv12 key in registry to something else and then feed YV12 data in MainConcept. You'll see if it accepts that (which I doubt).

You could try installing ffdshow and setting ff_vfw.dll as the YUY2 decompressor in registry and setting ffdshow to only output YUY2, then try opening a script with ConverttoYUY2 as the last item in MainConcept. If it works, YUY2 is what MC likes. (I'm not 100% sure if this method works though, also make sure you backup the registry or write the correct entries down before trying anything)

45tripp
29th March 2007, 18:15
I already have the cccp codec pack

Mainconcept has it's own import modules.

directshow
avi
dv
mpeg
and Quicktime


I disabled directshow input module and removed vidc.yv12 driver
but yv12 avis still load with the avi input module.
I set ff vfw to output only yv12 with the above and it'll still take it.
Plus dvd loads with the mpeg module, so it has the modules to take various colourspace inputs.

As it relies on various decoders to cover all inputs, i don't really see how one could determine what colourspace format is being finally served to the program by said decoders with looking only at the input level.
My guess is you'd have to probably go to an output test.

I don't know...