16

I want to play a .H264 video file in iOS 8 with use of VideoToolbox.framework and not with ffmpeg library.

I have found few Tutorials + Reference links to understand VideoToolbox.framework, but still couldn't find, "how to play .H264 in iOS?".

Few Examples :

Reference Links :

You can download a test (.H264) video for Testing from here.

Community
  • 1
  • 1
Vishal Khatri
  • 954
  • 2
  • 12
  • 32
  • 2
    "Play H264 Video in iPhone" is still not a question. Its not even a complete sentence. – szatmary Jul 20 '15 at 22:46
  • 1
    How to play .H264 video file in IOS ? here is sample video. Please check https://www.dropbox.com/s/n68v5mty4h0sqog/test2.h264?dl=0 I need to play this video in iPhone. – Vishal Khatri Jul 21 '15 at 05:28
  • 2
    This question has detailed answer about decoding H.264 with VideoToolbox framework: http://stackoverflow.com/questions/29525000/how-to-use-videotoolbox-to-decompress-h-264-video-stream. – John Tracid Jul 26 '15 at 09:29

2 Answers2

1

VideoToolbox.framework is not used to display video files on screen but rather for decoding and conversion of video data. Use AVKit.framework or AVFoundation.framework to play a H264 video instead.

See Apples documentation of the Media Layer:

The Video Toolbox framework comprises the 64-bit replacement for the QuickTime Image Compression Manager. Video Toolbox provide services for video compression and decompression, and for conversion between raster image formats stored in Core Video pixel buffers.

der_michael
  • 3,151
  • 1
  • 24
  • 43
1

It depends on what your trying to decode. If you have a File or valid end point. AVFoundation is what your looking for.

The VideoToolBox is for decoding video manually. Which is used in real-time streaming. For this case you will be required to parse the NAL units from each payload and follow this tutorial:

https://stackoverflow.com/a/29525001/2878935

Community
  • 1
  • 1
redbrain
  • 162
  • 2
  • 11
  • Wo thats a pretty intense response. Well unlike you i have actually wrote an ios application which can concurrently stream 9 RTSP streams and i use videotoolbox to do video decoding and implement my own frame dropping. So yeah i dont know what i am talking about... – redbrain Sep 20 '16 at 11:17
  • I am under an NDA for that app. And i am fairly sure i posted a some of the android/ios hacks for h.264 in other posts. Just for you my precious snow flake i will upload my own ios decoder tomorrow to github... You have to be the angriest Christian i have ever talked to btw. – redbrain Sep 21 '16 at 14:08
  • Maybe, but I never let the sun set on it [Eph 4:26]. To that end, I'm very much looking forward to seeing what you have. It's not that I don't understand how to use Video Toolbox as presented in the various sample code snippets provided online. It is the lack of an end-to-end presentation of a solution using it that leads me to believe that no one but a few knows how to read a video file using a bare-bones file reader like dispatch I/O, decode and otherwise process it into a series of Core Media sample buffers, and display them on-screen using, for example, AVSampleBufferDisplayLayer. – James Bush Sep 21 '16 at 14:30
  • did you upload anything yet? – James Bush Sep 24 '16 at 21:19