Search code examples
iosiphoneobjective-cipadflv

Playing flv files with iPhone and iPad application


I am creating an application for iPhone and iPad that plays videos that has been hosted in the server. Some thing like youtube.

The problem is that most of the files are with flv extension and I have problem with playing the in the iDevices.

I had seen post like this that said iOS can not play flv files. but I had seen many flv players on the iTunes and also many apps that plays flv videos.

Actually it is much thousands videos and we can not convert them. I am wondering how can I play this files in my app with a good player.


Solution

  • You need a video decoder program to play a video file. Apple provides built-in, low-power, hardware-accelerated decoders for some formats (AAC, H.264, etc.), but not for any other formats.

    If you have video files in Apple supported built-in format, it will be played by an API call. But if your video file is in unsupported format, you have to implement video decode yourself for the format. This is very hard and painful work. Even there's a library (FFMPEG) which does this, it's not easy to embed it into an app, and even the result is not very pleasant. Because it is not well documented, and also it requires specific license model which doesn't fit well with closed-source programs. Also it consumes more battery, and seems to be far slower than Apple's optimized decoders.

    Instead you can try command-line FFMPEG tool. That's far easier to use, and scriptable using shell script. You told thousand of video files. That sounds small. You can convert it. Try scripting it.

    Update

    There's a framework called VLCKit which may provide simpler media playback feature of extra formats if you don't mind GPLv2 license.