Video Formats, AVFoundation, and UTI

I am creating an iPhone application that can manage video files. I am using AVFoundation classes (e.g. AVAsset). I just registered my application as a handler for all files matching public.movie (via CFBundleDocumentTypes). However, now my application is displayed in the "Open with" menu for .avi , although I do not think that iOS can play AVI movies (Quick Look preview will try, but it will fail).

Is there a better way to register for movie opening? I will also need to maintain file sharing, so I need to distinguish which files in the Documents folder are also valid movies, although I did not understand how to check the UTI of the file. An overview of iOS technology reads:

Video technologies in iOS support the playback of movie files with the extensions .mov, .mp4, .m4v and .3gp and using the following compression standards:

  • H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, low-complexity version of the H.264 base profile with AAC-LC audio up to 160 Kbps, 48 ​​kHz, stereo audio in .m4v, .mp4 and .mov file formats
  • H.264 video, up to 768 kbps, 320 by 240 pixels, 30 frames per second, basic profile up to level 1.3 with AAC-LC audio up to 160 kbps, 48 ​​kHz, stereo audio in .m4v, .mp4 format, and .mov.
  • MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple profile with AAC-LC audio up to 160 Kbps, 48 ​​kHz, stereo audio in .m4v, .mp4 and .mov file formats
  • Numerous audio formats, including those listed in the Sound Technology section

Thanks in advance for any advice you may have.

+4
source share
2 answers

I decided that the best way to handle this is to define the UTI of the file using the UT * functions to get the UTI from the file extension. Unfortunately, this means that AVI files are still imported, because the OS knows that they are movies, even if they cannot be played, but it does not seem to cause too many problems.

+3
source

For video only, which should indicate the following UTIs in Info.plist:

  • com.apple.m4v-video (.m4v)
  • com.apple.quicktime-movie (.qt, .mov)
  • public.mpeg-4 (.mp4)

You can find the UTIs supported by AVFoundation in AVMediaFormat.h: https://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVFoundation_Constants/Reference/reference.html%23//apple_ref/doc/uid/ TP40009539-CH4g-DontLinkElementID_48

+2
source

Source: https://habr.com/ru/post/1333729/


All Articles