AVFoundation (AVPlayer) supported formats? No .vob or .mpg containers?

后端 未结 1 1001
攒了一身酷
攒了一身酷 2020-12-03 11:00

Using AVPlayer in a Mac app here to play random videos in fullscreen from a folder, but when I try to play .vob files or .mpg files I just get a black screen that lasts as l

相关标签:
1条回答
  • 2020-12-03 11:56

    The AVURLAsset class has a static methods that you can query for supported video UTIs:

    + (NSArray *)audiovisualTypes
    

    On 10.9.1 it returns these system defined UTIs:

    • public.mpeg
    • public.mpeg-2-video
    • public.avi
    • public.aifc-audio
    • public.aac-audio
    • public.mpeg-4
    • public.au-audio
    • public.aiff-audio
    • public.mp2
    • public.3gpp2
    • public.ac3-audio
    • public.mp3
    • public.mpeg-2-transport-stream
    • public.3gpp
    • public.mpeg-4-audio

    Here is an explanation of system UTIs. So it seems that at least the .mpg container should be supported.

    According to wiki, .mpg files can contain MPEG-1 or MPEG-2 video, but only MPEG-2 video is supported. So maybe that's why the file loads but nothing is displayed.

    QuickTime internally uses QTMovieModernizer in order to play videos in legacy formats (as mentioned in this WWDC session), so maybe you can look into that. It even has a method for determining if a file needs to be modernized:

    + requiresModernization:error:
    
    0 讨论(0)
提交回复
热议问题