Can not play local rtsp URL using FFmpeg in iOS - ffmpeg

I am using FFmpeg for stream rtsp URL in iOS.
I am trying to stream a local url but my app is failed to open url
avformat_open_input method always return -5
I have played the same url rtsp://172.16.1.226:5544/1 on VLC media player on my iPhone and macbook it works on both.
After few research i have found there is some problem with rtsp_transport
I was using av_dict_set(&serverOpt, "rtsp_transport", "tcp", 0); for the server configuration while opening url and the result is can not open feed.
When I changed it to av_dict_set(&serverOpt, "rtsp_transport", "udp", 1);
I am able to open url successfully but I continuously getting error rtsp 1 missing packet and so on.
Can anybody help what should be the right configuration while opening a local rtsp url using ffmpeg.
Should i need to update av_dict_set(&serverOpt, "rtsp_transport", "udp", 1)
Thanks in advance

Yes you can use UDP means av_dict_set(&serverOpt, "rtsp_transport", "udp", 0) in your code it will work.
You can also skip this step. I am playing local and remote both RTSP URL and setting nothing.
Direct open the URL using avformat_open_input without specify the rtsp_transport.

Related

How do I extract and record audio in webRTC on Firefox?

I implemented one to one webRTC video chat (Both audio and video)
navigator.getUserMedia({
audio: true,
video:true
}, function (stream) {
}, function(err){
})
But i want to record only audio of the chat session. In chrome i am able to record by using RecordRTC, But in Firefox i am getting video+audio file (webM).
How do I extract audio in Firefox from audio+video stream?
you have one of two ways to do it, when you make new recording, you do new RecordRTC(stream, config):
currently the stream you are passing must be videostream, you can change it to audiostream as stream.getAudioTracks()[0], I have not tried this, but guessing that it should work.
or as part of config, add an attribute recorderType: window.StereoRecorder, now it would use StereoRecorder and not firefox's own MediaStreamRecorder.
p.s: have you tried recording remote stream in chrome, because chrome supports recording only stereo mode and webrtc provides audio in mono mode.

Resolving rtmp stream url from Adobe Flash container

How can a rtmp stream url be retrieved completely with its playpath and be played with ffplay/avconv from a flash plugin. In embedded flash code below rtmp address exits (rtmp://live.atv.com.tr/atv) , however it does not work with avplay since it needs playpath.
<param value="config={"key":"##c67bf4e753034f78950","play":{"display":"none"},"clip":{"eventCategory":"Canli Yayin","url":"atv3","live":true,"provider":"influxis"},"plugins":{"controls":{"url":"http://i.tmgrup.com.tr/p/flowplayer.controls.swf"},"influxis":{"url":"http://i.tmgrup.com.tr/p/flowplayer.rtmp.swf","netConnectionUrl":"rtmp://live.atv.com.tr/atv"},"ova":{"url":"http://i.tmgrup.com.tr/p/ova.swf","autoPlay":true,"overlays":{"regions":[{"id":"Reklam","verticalAlign":"bottom","horizontalAlign":"right","backgroundC...0,"style":".smalltext { font-style: italic; font-size:10; }"}]},"ads":{"notice":{"show":true,"region":"my-ad-notice","message":"<p class=\"smalltext\" align=\"right\"> Kalan süre : _countdown_ saniye.</p>"},"schedule":[{"zone":"5","position":"pre-roll","server":{"type":"direct","apiAddress":"http%3a%2f%2fad.reklamport.com%2frpgetad.ashx%3ftt%3dt_atv_canli_yayin_preroll_800x700%26vast%3d2"}}]}}},"playerId":"live","playlist":[{"eventCategory":"Canli Yayin","url":"atv3","live":true,"provider":"influxis"}]}" name="flashvars">
Problem Solved: Using wireshark (network analyzer) is much more effective to retrieve paramaters like rtmp url, playpath...
Edit2: Some urls are also embedded in scripts files rather than directly in flash object, this variables are used in flash object above, later.

MediaPlayerLauncher with HTTPS

I would like to open an audio file from an HTTPS resource.
First, I tried using MediaPlayerLauncher like so:
MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher {
Media = filename,
Controls = MediaPlaybackControls.Pause,
Orientation = MediaPlayerOrientation.Portrait,
Location = MediaLocationType.None
};
mediaPlayerLauncher.Show();
filename in this case is a URL beginning with https://.
Using Fiddler to monitor traffic, I have noticed that https:// in filename is getting changed to http://.
Next I tried opening the same URL using WebBrowserTask:
WebBrowserTask webBrowser = new WebBrowserTask {
Uri = filename
};
webBrowser.Show();
Checking Fiddler out again, I noticed that two requests are being sent. First is a request to filename by the browser. This results in the "Tap to open file" message to appear in the browser. Tapping it opens the phone's media player (MediaPlayerLauncher?), which sends another request -- in this case, the https:// changed to http:// again (which is similar result to first attempt).
The server I am getting the file from only supports HTTPS, hence the problems arising when the media player requests the file as HTTP.
Is there anyway to stream a file from an HTTPS resource? Does Windows Phone's media player even support it?
Pointing location on the internet for the MediaLuncher is a bad idea. It will freez UI thread and your app won't be responsive. Try first download the audio as a stream and then play it. Use WebClient to open a stream. HTTPS can be open in WP7, so that shouldn't be a problem.

VLC Live Video Streaming on Windows Phone 7

I'm using VLC to stream video live from my webcam
i do as follows:
File > Stream > Capture Device > Display locally > http > Activate Transcoding > WMV+WMA(ASF) > Add HTTP, Port 8080, Destination /go.wmv
So the link to my streaming is like this: http://localhost:8080/go.wmv
I tested it and it works in another instance of VLC.
Now in Windows Phone 7, I simply drag and drop media element, create 3 buttons
first button:
mediaElement1.Source=new URI(http://localhost:8080/go.wmv);
second button:
mediaElement1.Play();
third button:
mediaElement1.Stop();
mediaElement is supposed to support this.
Why is it not working?
localhost from your phone is, well, your phone. You'd need to specify the name of the PC hosting the webcam to connect. If they are not on the same network, you would need to specify the fully qualified domain name of the host.

FFMPEG API: How to connect to RTSP stream using av_open_input_file?

I'm trying to connect to some RTSP stream using av_open_input_file() like this:
AVFormatContext* ic;
avcodec_register_all();
av_register_all();
av_open_input_file(&ic, "rtsp://login:password#xxx.xxx.xxx.xxx/videoinput_1/mjpeg/media.stm", NULL, 4096, NULL);
It always returns 'file not found'. The same url, though, I can see in, say, VLC player. Do I do something wrong in my code?
I'm using FFMPEG 0.6, shall I use the latest instead?
Turned out I did not enable network support when building FFMPEG.
The following options worked for me:
--enable-network --enable-protocol=tcp --enable-demuxer=rtsp --enable-decoder=h264

Resources