PDA

View Full Version : Stereo-3D : Encoding interlaced, with no deinterlacing on playback


BlackSharkfr
30th September 2008, 13:40
Hi
I'm learning the different ways i can encode stereoscopic-3d video streams.

There are different ways to organize the video streams (i have successfully made side by side, over/under and separate streams)
but the way i'm trying to learn right now is how to make a stereo-3d interlaced stream.

I know how to encode a fully 100% interlaced stream with x264, but what i don't know is : how to prevent any H264 decoder from deinterlacing the stream (bob, interpolate, or whatever fancy deinterlacing filter may be used).
Very few decoders i've tested automatically detect interlaced streams but i assume it should be possible and it will happen someday.
Since Stereo-3D interlaced streams are not like standard interlaced streams, deinterlacers would mix up the 3D views and ruin the video. So i must make sure this never happens.

I assume x264 uses some kind of flag in the stream to tell decoders that the stream is interlaced.

So here is my question :
How can i tell x264 to encode my streams as interlaced but make sure they are decoded as if they were progressive.

Thanks.

dukey
30th September 2008, 16:34
Interlaced stereo images seems a bad idea generally.
If you just build the graph automatically with direct show, you really have no idea if it will get deinterlaced or not. The decoder could automatically deinterlace it, or the renderer, or could just leave it interlaced.

I would opt for either side by side
or storing both video streams separately in the container

The mkv container has native support for stereo, so you can mux in the video streams and mark them as LEFT or RIGHT or centre.

The problem is haalis video splitter doesn't support stereo files. It seems to ignore the stereo flag and will just give you an option of choosing which video stream you want to watch. We could remedy this situation, but the project is closed source. And writing an mkv splitter from scratch looks to be somewhat painful.

Quark.Fusion
2nd October 2008, 04:45
What about encoding as AFR?

BlackSharkfr
2nd October 2008, 12:56
What about encoding as AFR?

You need somthing to sync the images to make players know which image is left and which image is right.
I don't know any way to do this, which is why i was thinking about interlacing to emulate AFR + sync on 1st field

In fact, that's the way i actually record videogame footage : output 60Hz AFR, capture with component capture card (will buy an intensity next year probably) which gives me interlaced 3D footage, which i separate, edit, re-sync in case of frame inversion, and finally encode to final format


I would opt for either side by side
or storing both video streams separately in the container

The mkv container has native support for stereo, so you can mux in the video streams and mark them as LEFT or RIGHT or centre.

The problem is haalis video splitter doesn't support stereo files. It seems to ignore the stereo flag and will just give you an option of choosing which video stream you want to watch. We could remedy this situation, but the project is closed source. And writing an mkv splitter from scratch looks to be somewhat painful.

I already make side by side videos (http://www.mtbs3d.com/phpBB/viewtopic.php?t=2020), and i also tested matroska's dual streams (don't understand what centre is used for, i used left and right)
I'm just trying to learn all the different available solutions.

I don't think the stereo mkv problem is a splitter issue, more about media players :
well, i don't really know the internal workings of haali's splitter but when i open a dual stream stereo matroska file in VLC i get the two streams simultaneously and in perfect sync. Except they're in two separate windows.
It's fine for dual projector rigs but I haven't found any output conversion plugin to produce AFR/interlaced/anaglyph/iZ3D/TDVisor/Planar/whatever output people may be using...

So I can only use what stereo-3d enabled media players provide.
And that is only side by side (or over/under) and interlaced.
(and also SIS but nobody uses it)

Quark.Fusion
2nd October 2008, 14:08
The question is how you decode stream for display, if on PC then you can wrap AFR encode to interlaced in avisynth.

BlackSharkfr
2nd October 2008, 14:51
The question is how you decode stream for display, if on PC then you can wrap AFR encode to interlaced in avisynth.

That's what i had in mind but my question was : if you do encode interlaced, how do you make sure the H264 decoder won't detect the interlacing and automatically apply some treatment which will interpolate between the fields and mixup the images.

Manao
2nd October 2008, 19:23
Technically, the decoder should rely on the picture structure information stored in a picture timing SEI to decide whether a decoded picture is interlaced or progressive. So a decoder should not care whether you encoded the video using mbaff.

However, not all decoder will properly handle that SEI, and not all encoder will actually use it. And, when that SEI isn't present in the bitstream, the decoder is forced to make some assumptions in order to determine whether or not the video is interlaced. And most of those heuristics will rely on the encoding tools used : mbaff or field will most likely be processed as interlaced while frame will be processed as progressive.

Afaik, x264 doesn't output that specific SEI. So you "just" have to make it output it (iirc, there's a patch floating around that might do that : the pulldown patch, but you'll still have to modify it to force progressive).

In any case, I don't think encoding stereoscopic video as interlaced will be efficient. The most efficient way (with x264) should be to encode it as over/under video.