Mobile Safari (iOS): <input type="file"> does no longer convert + downscale video

Viewed 712

With one of the recent iOS releases, Apple seems to have changed the behavior of <input type="file"> when it comes to picking videos from the camera roll. It used to be that before the video file was handed over to the website, iOS would downscale the video to 720p and also convert it to H.264 (AVC).

Alas, this is no longer the case. Safari now forwards the video files "as is" and does not transcode them. In particular, it does not convert HEVC-encoded videos to H.264.

Is there a way to make <input type="file"> still transcode/downscale user-selected videos, ie., revert to the old behavior? I tried adding accept="video/*", but to no avail...

2 Answers

Answer to myself: turns out iOS does convert HEVC-encoded recordings to H.264 (and downscales them to 720p), but only if the multiple attribute is not set on the <input type="file"> element.

Once the multiple attribute is set, the HTML input element will receive the original HEVC-encoded videos and no compression/downscaling happens before they are handed to the website.

(Since I can't make a comment on your answer, I am writing my response here.) In August of 2022 my testing on iPhone 8 plus running Safari on iOS 15.4.1 shows that the "multiple" attribute does NOT control whether the video compression before uploading happens. It happens happens each time when selecting a single file or multiple files.

Related