Question

I am performing encoding of the captured windows screen with x264 using libavcodec. Since, the input is RGB, i am converting it to YUV to make it compatible with x264. I am using the sws_scale function for the same. My question is if there is any alternate for this function since i don't need any scaling to be done in my case. Also, it would be useful if someone could throw light on the workflow of this function.

P.S: I am assuming x264 operates only in YUV color space. If this assumption is incorrect, please inform me on the same.

Thanks in advance.

Was it helpful?

Solution

I could not find an alternative to swscale and it seems except the fast bilinear algorithm (for scaling) all other algorithms used in the library provide a fairly negligible color shift.
Also, it is mathematically impossible to convert from RGB to YUV color space without any color shift (due to the approximations in the equations).
P.S: I could not use the RGB version of libx264 / libavcodec. If you have details on how to implement and how to build a corresponding version on windows, please post links/info for the same.

OTHER TIPS

P.S: I am assuming x264 operates only in YUV color space. If this assumption is incorrect, please inform me on the same.

libx264 supports I420/YV12/NV12/I422/YV16/NV16/I444/YV24/BGR24/BGR32/RGB24 input colorspaces which are encoded as YUV 4:2:0/YUV 4:2:2/YUV 4:4:4/RGB (which should be specified in params). But anything except YUV 4:2:0 will need support from decoder because they are not part of High profile but newer profiles (High 4:2:2 and High 4:4:4 profiles).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top