MobileVLCKit and VLCKit, part 2

This is part of an article series covering VLC’s Objective-C framework, which we provide to allow inclusion of all its features in third party applications as well as VLC for iOS and Apple TV.

Currently published:

Today, we will discuss meta data processing.

In VLCKit, every item you play is a VLCMedia object. For typical use cases, it can be created with an NSURL or an NSString containing a path.

We differentiate between two types of meta data: technical information describing the media such as codec, bitrate, video size and user-visible/-provided information such as artist, publisher name, album title.

Let’s start with the technical information, which can be retrieved from any media object with a single API call:

@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *tracksInformation;

This gives you an array containing as many dictionaries as the media contains tracks, be it video, audio or subpictures (subtitles, teletext). The track type is defined by the VLCMediaTracksInformationType key. All tracks will include information about the respective codec, bitrate and encoding details. Depending on track type, keys for video dimensions, audio channel numbers or text encoding will be set as well as an optional key for language.
Retrieving this property can potentially be very expensive, especially if your media is stored remotely as VLCKit will synchronously parse the source to provide this information. Therefore, we recommend you to cache this data, as it will probably not change during the lifetime of the VLCMedia object.
Note: for codec information, you’ll receive an integer which is a raw FOURCC representation of the codec name. Releases following VLCKit 2.2 will include a convenience method to translate it to an end-user readable string.

On mobile devices, you might run into the question if a given device is powerful enough to decode a given video file. For this purpose, VLCMedia includes the isMediaSizeSuitableForDevice property which will provide a reasonable guess. Note that this property will always be true on OS X.

Now, what about non-technical information about the media contents? To retrieve them, VLCKit needs to parse the source. This can be done both synchronous and asynchronous depending on the needs of your application. We generally recommend you to use the asynchronous way so you don’t block the execution of any threads. VLCMedia includes an optional delegate protocol, which allows you to follow meta data processing by receiving notifications every time further information becomes available as well as once parsing finished.
VLCKit can provide up to 17 different meta data keys with more to come in subsequent releases. While it allows to fetch them one by one, we recommend you to fetch the full dictionary using:

@property (nonatomic, readonly, copy) NSDictionary * metaDictionary;

If you have write access to your media source, you can also set values for the respective keys and save them to disk.

Thanks for reading!

If you have questions, don’t hesitate to use the comment section or to shoot a mail. The next part of this series will be about thumbnail creation.

30 thoughts on “MobileVLCKit and VLCKit, part 2”

    1. This is because of the different C++ runtime used by iOS 6 and 7. VLCKit 3.0, later this year, will support (and require) iOS 7.

      1. Hello,
        Is iOS 8 currently supported ? I would like to use MobileVLCKit in a swift coded application.

        Thanks in advance

        1. Yes, absolutely. Right now, the oldest release still supported is 6.1, but we will raise it shortly to 7.0. The current code already supports iOS 9.

  1. Yes, a nice tutorial how to compile VLCKit with the latest OS X and XCode version would be nice.

      1. Could you add a short excerpt here? I’m also interested in licensing terms for a commercial app. Thanks! I got it all up and running with no issues also!

      2. I just reread your first part, the following paragraph explains the licensing terms, from my understanding, I am free to use this in a commercial app, so long as I note (either on the website or the app?, or in the App Store meta data?) that we are using VLC and that the user can also choose to use it and/or access the source code.

        “The LGPLv2.1 allows our software to be included in proprietary apps, as long as you follow the license. As a start, make sure to publish any potential changes you do to our software, make sure that the end-user is aware that VLCKit is embedded within your greater work and that s/he is aware of the gained rights. S/he is granted access to our code as well as to your additions to our work. For further details, please read the license and consult your lawyer with any questions you might have.”

      3. The user also needs to be able to re-compile your app with a modified VLCKit version based upon the sources (of the open-source components) and the binary blocks you provide.
        The offer for the source code must be made inside the app, not only on your website.
        For details, please read the license and typical legal discussion with regard to the iOS App Store, which is widely available on the web and beyond the scope of this blog.

  2. Hello,

    I am new to iOS development and have taken over a project to finish a new mobile app using MobileVLCKit from iOS6 to run on iOS8. I used the nightly build of the library since I have never been able to get the source to build on my Macbook. (Xcode 6.3.2) I can get the application to build and run in the simulator with a target of iPhone 5s, iOS7.1, but when I target the 5s, iOS8.1, I get an error that the simulator fails to start and cannot find the info.plist from the MobileVLCKit framework. ——

    Jun 9 16:50:04 LesApple.local com.apple.dt.Xcode[62046] : Error Domain=LaunchServicesError Code=0 “The operation couldn’t be completed. (LaunchServicesError error 0.)” UserInfo=0x7fa98e649170 {Error=PackageInspectionFailed, ErrorDescription=Failed to load Info.plist from bundle at path /Users/dai_engineering/Library/Developer/CoreSimulator/Devices/9050AA06-5A9E-47F4-9631-CF935C364406/data/Library/Caches/com.apple.mobile.installd.staging/temp.bqFTsr/extracted/DigitalAllyApp.app/Frameworks/MobileVLCKit.framework}
    ——–
    I have tried resetting the contents and settings in the simulator, clean builds, different nightly builds, and given my lack of knowledge with iOS in an embedded firmware career starting with 8 bit processors and assembly language, I would much appreciate a suggestion to help this old dog learn a new trick…

    Thank you,

  3. Hi, this is a really helpful article, thank you!
    I followed your instructions about using tracksInformation to retrieve the technical information, but “frame_rate_den” and “frame_rate_num” are always 0. I also followed your post in this site: http://stackoverflow.com/questions/2989 … -streaming, still can’t get right frame rate. Am I missing something?

    Thank you.

  4. I am using MobileVLCKit. It works perfectly! But, when I try to call
    – (void)saveVideoSnapshotAt: (NSString *)path withWidth:(int)width andHeight:(int)height;
    it tells me

    core video output error: Encoding support not compiled-in!
    core video output error: Failed to convert image for snapshot

    In cocoapods file I have pod ‘MobileVLCKit’, ‘~> 2.2.x’, as I see – it is 2.2.1 vers

  5. Are .TS files supported in the MobileVLCKit for iOS? I seem to be able to play these files with my VLC desktop app, but I can’t seem to get them to play within my sample app. Other media types do play ( mp4 etc ).

  6. I am using MobileVLCKit in my application. I am able to play the Video files. But i am not able to play the audio files. Can you please tell me how to play the audio files using MobileVLCKit.

  7. I used the MobilcVLCKit which I downloaded from the nightly to play .TS file. It is good to support .TS file, but I don’t know how to switch program. I also downloaded the VLC Player on my MacBook, and VLC for iOS on my iPhone. The VLC Player can switch programs, but the VLC for iOS can’t.Is that means VLC kit provides apis to switch programs but MobileVLCKit doesn’t? Please help me…

  8. Hi,
    thanks a lot for your article and the great work regarding MobileVLCKit. I recently picked it up or use in an iOS app. While mediaPlayback works as expected, i’m having trouble to parse meta data. On Detail: I want to retrieve the video Size to adjust the player size.
    While media.tracksInformation returns an empty array, mediaPlayer.videoSize returns 0.0 , 0.0.
    I’m trying to get the meta data of a remote webm or mpg file. Thanks a lot for every help,

    regards,
    Lukas

  9. Hi,

    While integrating MobileVlcKit framework in ios project.

    i got some error
    ts demux error: MPEG-4 descriptor not found
    ERROR: [0x7212000] >aurioc> 806: failed: -10851 (enable 2, outf inf)
    [19104e54] audiounit_ios audio output error: failed to init AudioUnit (-10851)
    [19104e54] audiounit_ios audio output error: opening AudioUnit output failed
    [19104e54] core audio output error: module not functional
    [15c7b674] core decoder error: failed to create audio output

    Error got popup exactly when initialise VlcMediaPlayer. Any idea how to solve this???

Comments are closed.