Log in

View Full Version : Handling variable resolution video


Lam3rD
4th February 2010, 19:51
I have some 4/3 DVDs, which require variable cropping, like one part fits the entire frame and another is as wide as 2.4:1 and I'm looking for an optimal way to fit such videos on my widescreen display without losing image or display space.

http://www.imagebam.com/image/ec082166463233
http://www.imagebam.com/image/1128c566463236

There are many ways to do that, but I remembered one post by DS:
4. Automatic handling of all kinds of weird input (changing resolution, etc), including many inputs that Avisynth wouldn't have worked correctly with.

So my questions are:
1) How does one create and stream VRV (Variable Resolution Video) to x264. AVISynth requires CRV (Constant), so it's out of the question. Probably there is a way to switch between 2 or more avisynth scripts or something else, so let's say it's doable.
2) Are there any restrictions, like no support of --sar and such, when you encode such video?
3) What splitter/decoder does one need to use with VRV? And how is it going to be played - would it touch the screen from left/right, when the image wider than your screen and top/bottom, when it's taller, or will it be windowboxed/overcropped and lose image or screen space.


I hope anyone can shed some light on this area and be able to answer to at lest the first question... the other 2 I can test myself once I have such video :D

ronnylov
5th February 2010, 08:31
You can make a widescreen video with a fixed resolution but add borders when necessary - on the sides when the source is 4:3 and letterbox it when the source is 2.4:1. This way x264 input is fixed and the actual video is miximized within the fixed resolution. Well it is the same method as used in your source video but you apply it for widescreen insted of 4:3.

Lam3rD
5th February 2010, 11:28
Yup I know this method - it's not such a big hassle to make one 16/10 for my PC and another 16/9 for my notebook, however I'm interested in creating a video file with variable resolution, something that I'm not even sure that could exist. I know that there has been some projects in the past in this direction, but I thought that at the moment resolution is among the things, that must remain constant throughout the entire video stream (the others are Coding/Colorspace/Colorimetry, I think), until Dark Shikari recently has mentioned it in his post about x264 LAVF/FFMS input. (the bold part in the quote)

kemuri-_9
5th February 2010, 14:24
x264 does not support variable resolution input.
for the variable resolution inputs (lavf/ffms?) it uses libswscale to resize them to be constant resolution.

this could be implemented eventually but it would be nontrivial.
as for SAR, it's already been reconfigurable, so it can be changed in the middle of the encode (there's a few small catches to this tho).

Lam3rD
5th February 2010, 20:14
Ah, so I got that wrong - I thought that AVC supports Variable Resolution, while he meant, that it rescales veriable to constant. This makes sense, answers my questions and kills my hopes. Obviously re-boxing is the only option.

Thanks a lot, I guess the thread can be closed now.

LoRd_MuldeR
5th February 2010, 23:39
Ah, so I got that wrong - I thought that AVC supports Variable Resolution, while he meant, that it rescales veriable to constant.

H.264/AVC does support variable resolution. But x264 cannot create such streams currently. It accepts variable resolution input, but scales it to fixed resolution output.

Anyway, you can simply encode each segment that has a different resolution separately. Afterwards you can concatenate the individual H.264 streams.

If you take a valid H.264 stream and concatenate it to another valid H.264 stream then you will get a valid H.264 stream again, even if the original streams had different resolutions.

Whether your player/decoder will be able to display H.264 streams with varying resolution is a completely different question...