3

I have found many suggestion in stack overflow regarding usage of FFmpeg and link of github for DFURTSPPlayer but it is not compiling. But after integrating FFmpeg what I have to write? suppose i am having HTTP urls then I write:

code

moviePath = "http:/path.mp4" movieURL = NSURL.URLWithString(moviePath!) moviePlayer = MPMoviePlayerController(contentURL: movieURL) moviePlayer!.play()

So for using RTSP urls what kind of code should i write?

Zalak Patel
  • 1,937
  • 3
  • 26
  • 44

1 Answers1

1

Here is another post that has an example FFmpeg code that receives an RTSP stream (this one also decodes the stream to YUV420, stores it in pic, then converts the frame to RGB24, stores in picrgb and writes it to a file). So to achieve something similar to what you have for HTTP you should:

1) Write a wrapper Objective-C class for the FFmpeg C code, or just wrap the code in functions/functions that you will call directly from Objective-C code. You should have a way to pass the RTSP url to the class or function and provide a callback for a new frame. In the class/function start a new thread that will actually execute something similar to the code in the example and call a callback for each new decoded frame. NOTE: FFmpeg has a way to perform asynchronous I/O by using your own custom IO context and that would actually allow you to avoid creating the thread, but if you are new to FFmpeg maybe start with the basics and then you can improve your code later on.

2) In the callback update the view or whatever you are using for display with the decoded frame data.

Community
  • 1
  • 1
Rudolfs Bundulis
  • 11,636
  • 6
  • 33
  • 71
  • I am new to FFmpeg so where can i get code and what to do? https://github.com/chelyaev/ffmpeg-tutorial will this help me? – Zalak Patel Oct 15 '14 at 08:49
  • 1
    Well, you need FFmpeg binaries for iOS or a wrapper with the binaries - take a look at https://github.com/kolyvan/kxmovie. If that does not suit you you should build the binaries yourself (here is an iOS build script - https://github.com/kewlbear/FFmpeg-iOS-build-script) and then write code similar to the one in the link in the answer in your Xcode project. – Rudolfs Bundulis Oct 15 '14 at 11:09