Get video stream from tcpip port (ArDrone) to Matlab figure - matlab

I am trying to obtain video from an IP webcam in particular that HD camera on ARdrone parrot 2.0, I can get the video stream either with MPEG4.2 soft encoder or with H264-like codec or with MJPEG-like codec and is sent by a tcpip port by the drone.
The point is that, I have already been able to display this video stream on ffplay (external program to Matlab) using win7, but I would like to save video in a variable on Matlab in order to use image proccesing with it and control the drone depending on what "it's seeing".
I have already looked up for this matter and have not found anything illuminating. So I will be very grateful if any of you know how to get this image straight from the tcpip port or even from ffplay program.

Related

How to stream live video in h.264 using a rasberry pi

So I have been trying for (embarassingly) long to efficiently stream video from my pi to my computer over the internet. Video encoding and streaming still looks fuzzy to me, since most examples hide the things that happen behind the scenes.
Things I've tried:
OpenCV capture, encode as jpeg, send through socket and decode - I get a working video feed, but data usage is crazy.
using the Picamera module, capture and send over socket, receive and pipe into VLC - also worked, data usage is low, but latency is even more than the first approach. Also I want to play the video on my own UI on pyQt
using the Picamera module, capture and send over socket, pipe to FFMPEG, and try to use opencv to capture from the stdout - I got "bad argument" errors on the cv2.VideoCapture(stdout) method.
All I want is an efficient way to transmit video with low bandwidth and latency using h264, and no pre-written protocols like rtmp or installing servers, then blast it onto my pyQt UI. Something like:
bytes =
video.capture().encode('h264')
udp_socket.sendto(bytes, (ip, port))
And on the receiving side:
data = udp_socket.recvfrom(65534) frame = data.decode() update_frame()
The closest thing I got to this was with the first approach.
Any help would be greatly appreciated.

Linux server vlc to restream rtsp feed from ip cam

Im new i streaming so sorry for stupid questions, I tried to find info in web but nothing seems to work.
What Im trying to do
I have IP Cam that puts out RTSP stream to internet its IP is: rtsp://89.79.16.127:2550
When Im accessing that stream in windows VLC (win xp) every thing works (you can tryit for yourself)
Now I have dedicated linux debian serwer with ip: 109.95.153.133
I want to setup VLC serwer that will grap rtsp feed from camera IP and restream it via my serwer, so I can show that stream on my website (located on that dedicated serwer)
Can You help mi accomplish that?
Open VLC, select Open location from clipboard
Enter the proper camera url. For example, the axis M7014 streams in H264 so its url will look like rtsp://Camera-IP/axis-media/media.amp?codec=h264
Enter the login at the prompt or encode it to the rtsp link
rtsp://user:pass#Camera-IP/axis-media/media.amp?codec=INFO.)
If the stream is playing on the screen it means you support this codec. If not, then you shouldn't try to transcode it. For example, the axis M7014 uses an H264 variant that only quicktime fully supports.
The previous steps were to determine if you can transcode or if you should just forward the traffic.
Menu-Stream, select your RTSP as a source, then add an RTSP destination and stream. If you cant see the video play you can only forward it to a player that can. beware, some RTSP headers might get tweaked and disable the ability to pause video. I can looking for a fix right now.

how does Webcam stream is usually done?

I am currently doing a small project and one of the components is to capture the webcam stream from one side to the other (Client-->Server). right now i have the stream from the Server as bytes and as far as i know i should transfer these bytes using UDP. My question is how to do that,
is it should be enclosed into a file and then transferred?
should i transfer the raw bytes?
should i create a buffer at the client side and when it gets full show it on the screen?
in short i would like to know how to implement the transfer of the stream from the server to the client (i need just on side).
You can stream a webcam to a client via multiple ways.
use Windows media Server/ Flash media Server. Push your webcam to the server by Windows Media Encoder or flash media encoder, and use the server live link to playback on the client(windows /Web).
Use Windows Media Encoder to stream your webcam to anyone without a server involved. when your encoder starts, you will get a URL to view your stream, which you can use to playback on the client(windows /Web).
use third party streaming services, where they give you a publishing point to publish your webcam stream, and use the link provided by them to playback on the client(windows /Web).. (check with brighcove or Mogulus by LiveStream
Hope this helps.

How to get libVLC to play segmented packets from a stream?

I am curious as to how to use libVLC to play segments of a clip downloaded over the network. We are developing sort of a P2P program where packets can have several paths to get to the destination. Once it gets there I need to know how to play it. My idea is that it will be placed in a buffer and the player will play the packets in a FIFO manner.
The code I have is a modified version of this tutorial. I know that it can directly receive streams and pretty much play whatever file we give it. However, I don't know how to do it so that I can place a segment of a file (obtained from the packets) into the buffer and let it play.
A lot of my search results in seeing libvlc_video_set_callbacks() but I fail to see how that helps. If it matters, we are only considering MP4 files for now and will expand later.

how to stream high quality video and audio from iPhone to remote server through Internet

I am seeking the following three items, which I cannot find on STACKOVERFLOW or anywhere:
sample code for AVFoundation capturing to file chunks (~10seconds) that are ready for compression?
sample code for compressing the video and audio for transmisison across the Internet?
ffmpeg?
sample code for HTTP Live Streaming sending files from iPhone to Internet server?
My goal is to use the iPhone as a high quality AV camcorder that streams to a remote server.
If the intervening data rate bogs down, files should buffer at the iPhone.
thanks.
You can use AVAssetWriter to encode a MP4 file of your desired length. The AV media will be encoded into the container in H264/AAC. You could then simply upload this to a remote server. If you wanted you could segment the video for HLS streaming, but keep in mind that HLS is designed as a server->client streaming protocol. There is no notion of push as far as I know. You would have to create a custom server to accept pushing of segmented video streams (which does not really make a lot of sense given the way HLS is designed. See the RFC Draft. A better approach might be to simply upload the MP4(s) via a TCP socket and have your server segment the video for streaming to client viewers. This could be easily done with FFmpeg either on the command line, or via a custom program.
I also wanted to add that if you try and stream 720p video over a cellular connection your app will more then likely get rejected for excessive data use.
Capture Video and Audio using AVFouncation. You can specify the Audio and Video codecs to kCMVideoCodecType_H264 and kAudioFormatMPEG4AAC, Frame sizes, Frame rates in AVCaptureformatDescription. It will give you Compressed H264 video and AAC aduio.
Encapsulate this and transmit to server using any RTP servers like Live555 Media.