RTSP Streaming on iOS 6 with Xcode 4.6.1

I need to develop an application capable of receiving RTSP Stream. I tried to find solutions / study guides on the Internet all day, but without any success. I read a lot about using FFMPEG or Live555 (more FFMPEG, I also read that Live555 is not required when using the latest version of FFMPEG), but I didn’t look anywhere that it was described in a form that I could understand when I found the questions The answers about stackoverflow were very short, and I could not understand what they were trying to explain. So now I need to ask myself. I used "Homebrew" to download and install FFMPEG, now when I look at my / usr / local / directory I see this, the installed files are contained in the subfolders of "Cellar" Cellar dir

I also tried to take a look at these projects: RTSPPlay by Mooncatventures and kxmovie by kolyvan .

I really did not understand how to work with these projects, the documentation is vague and "muddy". Well, when I tried to compile these projects, kxmovie fails with errors that are similar to "missing avformat.h", error missing avformat.h I added dylib from usr / local / cellar / ffmpeg / 1.2.1 / lib to the project, but it seems like this is the wrong method. Almost the same problem with RTSPPlay xcodeprj, it returns an error that does not have "Entitlements.plist" after completely deleting links to this file. I get 99+ Apple Mach-O Linker errors, to be honest, I couldn't figure out why.

I wanted to try Live555 , but I can’t see all these obscure and confusing files, again I could not observe the documentation and how to create libraries for iphoneos (I read that this is the easiest way to get RTSP Stream, but it was the same stack of confusing files, like other projects)

Maybe if someone tried with these projects or developed the application himself, he could help me with his / her SourceCode, or if someone sees all the FFMPEG / Homebrew content made by him, he can explain to me how to use it This will probably help me and all the other desperate developers who are looking for a solution.

Just a little editing: I'm trying to get a decoded RTSP H.264 video stream.

Thanks in advance, Maurice Aricoglu. (If you need any SourceCode, links, screenshots, etc., please let me know)

+6
source share
2 answers

For those who are looking for a working RTSP player library, see Durfu Mooncat Fork I found online, it works great fine on iOS 8. An example code is introduced, if you are struggling with the implementation, I can help you.

+2
source

I reviewed many of the projects you mentioned and tested them well.

You can use ffmpeg libraries to create the rtsp streaming client, since ffmpeg supports the rtsp protocol ... But there is an important problem that I saw in my tests that the ffmpeg rtsp protocol has some important problems when using the UDP transport layer for streaming ... Even with the latest version (2.01), many RTP packets are discarded during streaming, so images sometimes become buggy ... If you use the TCP or http transport layer, then it works well ...

For the live555 project, this library works well with both UDP and TCP transport when streaming rtsp streams. But ffmpeg is so powerful / has many features than live555.

If you decide to use ffmpeg, then basically you should follow the steps below,

  • create connection - avformat_open_input
  • to find audio / video codecs - avcodec_find_decoder
  • to open audio / video codecs - avcodec_open2
  • read encoded packets from a file / network stream in a loop - av_read_frame A. a. decode audio packets - avcodec_decode_audio4 b. fill audio buffers using audiounit / audioqueue B. a. decode video packets - avcodec_decode_video2 b. convert yuv images to rgb images - sws_scale or opengles shaders

good luck ...

+1
source

Source: https://habr.com/ru/post/948254/


All Articles