Our SPA uploads cell phone videos. Newer iPhones upload videos in .Mov
container with H.265
under some circumstances which chrome doesn't play natively.
We are using Azure Media Services to perform the transcoding. Potential solutions are:
FetchAttributesAsync
doesn't contain codec information.. Hanven't found any other applicable mehod.if == H.264 || if != H.265
. Use knowledge of the .Mov
Container and download using CloudBlockBlob.DownloadRangeToStream()
or intercept the iFormFile
Stream on upload and read the specific bytes(FOURCCs?) to make determination.Holding the entire video in server memory is not an option.
Any direction is appreciated.
If the goal is to decide whether or not to encode the source MOV, based on video codec, then you could implement the following:
User uploads the MOV file
Upon upload complete, Event Grid topic on Azure Storage fires an event
An Azure Function is the event handler/subscriber receiving the event
That Function then (a) Determines that this is a new video upload, (b) Creates a SAS URL for the video, (c) Runs ffprobe to determine the video codec, (d) If H.265 then submits an encoding Task
Note: if you don't want to use ffprobe, then you can submit a Thumbnail task on the source video. This will be a low cost job, and the output Asset will contain the input metadata XML file which can be parsed to determine the codec. In my comment above, I've provided a link to the schema for this XML file.
Hope this helps!