Question

I've searched quite a lot and it seems that couldn't find a definite answer to what is the maximum render size of a video on iOS using AVFoundation.

I need to stitch two or more videos side by side or above each and render them in one new video with a final size larger than 1920 x 1080. So for example if I have two full hd videos (1920 x 1080) side by side the final composition would be 3840 x 1080.

I've tried with AVAssetExportSession and it always shrinks the final video proportionally to max 1920 in width or 1080 in height. It's quite understandable because of all possible AVAssetExportSession settings like preset, file type etc.

I tried also using AVAssetReader and AVAssetWriter but the results are the same. I only have more control over the quality, bitrate etc.

So.. is there a way this can be achieved on iOS or we have to stick to max Full HD?

Thanks

Was it helpful?

Solution

Well... Actually the answer should be YES and also NO. At least of what I've found until now.

H.264 allows higher resolutions only using a higher level profile which is fine. However on iOS the max profile that can be used is AVVideoProfileLevelH264High41 which according the specs, permits a max resolution of 1,920×1,080@30.1 fps or 2,048×1,024@30.0 fps. So encoding with H.264 won't do the job and the answer should be NO.

The other option is to use other compression/codec. I've tried AVVideoCodecJPEG and was able to render such a video. So the answer should be YES. But.. the problem is that this video is not playable on iOS which again changes the answer to NO.

To summarise I'd say: it is possible if that video is meant to be used out of the device otherwise the video will simply not be useable.

Hope it will help other people as well and if someone else gives a better, even different answer I'll be glad.

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