Question

I am using the Android 4.4 screenrecord command to record the screen of some different devices, but if I use the --size parameter then the capture video is corrupted.

How can I get the list of valid screenrecord sizes for a given device's encoder?

Was it helpful?

Solution

There is no such list. At least, not one that includes all valid resolutions.

Any size that is listed in the AVC profile list will work if the encoder supports that profile level, and you can get that by querying MediaCodec. From code written in the Java programming language, you just need to get a MediaCodecInfo for AVC, then use getCapabilitiesForType() to get a CodecCapabilities object, from which you can get an array of CodecProfileLevel. The CodecProfileLevel class includes the AVC profile level constants. (I'm not sure offhand what the private native equivalents of this is.)

Many resolutions that are not explicitly supported will happen to work. The probability of an arbitrary MxN resolution working is much higher if both M and N are multiples of 16 (with an additional allowance for 1080). However, some devices are more limited (see e.g. this post).

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