[Interest] Recording video on mobile, revisited

Jason H jhihn at gmx.com
Mon Dec 7 15:36:35 CET 2015


I'm trying to make an app that records video, but I am having a number of issues.
https://wiki.qt.io/Qt_5.5.0_Multimedia_Backends <- reference doc

iOS:
1. Only default recording params are configured (Yoann mentioned this last week)

Android:
1. Android actually has an X for "Video encoder settings", but these don't actually work in my test case. In fact setting _any_ of the parameters breaks the recording and gives the error: 'QMediaRecorder error: "Unable to start the media recorder."'

Combined:
1. The frames are not oriented correctly. I always get landscape frames even if the device is in portrait orientation. This means that I have to capture a higher quality than I otherwise would, so that I can have an equivalent level of detail. 99% of the video captured will be portrait.


I do not require or even want high-dev video, as I am upload time sensitive because the upload bandwidth is constrained. We have a minimum quality requirement and prefer to not capture above that because it is just work on Android (Nexus 6) so they also don't work. The supported*() functions don't return anything, so it's impossible to know the options to select from.

I'd be interested in approaches that work today (if any) as well as what it would take to get them working properly in the future. 

------ QML CODE ----

		function findAppropriateRate() {
			var rates = supportedViewfinderFrameRateRanges();
			var minRate = 100, maxRate = 0;
			for (var i=0; i< rates.length; i++) {
				var average = (rates[i].minimumFrameRate + rates[i].minimumFrameRate)/2
				if (average < minRate) minRate = average;
				if (average > maxRate) maxRate = average;
				if (average > 10 && average < 30) {
					return average;
				}

			}
			console.log("Warning: did not find appropriate frameRate, returning maxRate:", maxRate)
			return maxRate;

		}

		function findAppropriateResolution() {
			var rates = supportedViewfinderResolutions();
			var minMp = 100, maxMp = 0;
			var resolutions = {}
			for (var i=0; i< rates.length; i++) {
				var mp = rates[i].width * rates[i].height
				resolutions[mp] = rates[i];
				if (mp < minMp) minMp = mp;
				if (mp > maxMp) maxMp = mp;
				//if (mp > 300000 && mp < 1000000) { //somewhere between .3 and 1 megapixel
				if (mp > 200000 && mp < 500000) { //somewhere between .3 and 1 megapixel
					return rates[i].width + "x" + rates[i].height
				}

			}
			console.log("Warning: did not find appropriate resolution, returning maxMp:", maxMp, JSON.stringify(resolutions))
			return resolutions[maxMp].width + "x" + resolutions[maxMp].height;

		}




More information about the Interest mailing list