开发者

Playing RTSP stream in Android

I'm trying to play video stream on Android device. Unfortunatelly I still get the same problem with MediaPlayer/VideoView. I'm searching for a few days, but still haven't found any working solution. For test purposes I'm using MediaPlayer app from API Demos (API Demos/Media/MediaPlayer/Play Streaming Video). Here is code snippet for playing stream

mMediaPlayer = new MediaPlayer();
mMediaPlayer.setDataSource(path);
mMediaPlayer.setDisplay(holder);
mMediaPlayer.prepare();
mMediaPlayer.setOnBufferingUpdateListener(this);
mMediaPlayer.setOnCompletionListener(this);
mMediaPlayer.setOnPreparedListener(this);
mMediaPlayer.setOnVideoSizeChangedListener(this);

When I try to play stream I get this info from logcat http://pastebin.com/5Uib5CH5

This is configuration of ffserver streaming the video

开发者_运维百科
Port 8090
BindAddress 0.0.0.0

RTSPPort 7654
RTSPBindAddress 0.0.0.0

MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 10000

CustomLog -
NoDaemon
<Feed feed1.ffm>

File /tmp/feed1.ffm
FileMaxSize 5M

Launch ffmpeg -i mmsh://tempserv.cam/vid1

ACL allow 127.0.0.1

</Feed>

<Stream rat1.mpg>
Feed feed1.ffm
Format rtp
NoAudio
VideoBitRate 56k
VideoBufferSize 40
VideoFrameRate 12
VideoSize 176x144
VideoGopSize 12
VideoCodec libx264
AVPresetVideo baseline
</Stream>

If anyone can advise me how to fix it, or at least indicate an mistake, I will be grateful.


I've found solution how to run streaming suitable for Android device. This is my ffserver configuration for any other person with the similar problem.

Port 8090
BindAddress 0.0.0.0
RTSPPort 7654
RTSPBindAddress 0.0.0.0

MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 10000

CustomLog -
NoDaemon

<Feed feed1.ffm>

File /tmp/feed1.ffm
FileMaxSize 5M

Launch ffmpeg -i mmsh://tempserv.cam/vid1

ACL allow 127.0.0.1
</Feed>

<Stream rat1.mpg>

Feed feed1.ffm
Format rtp
NoAudio

VideoBitRate 56k
VideoBufferSize 40
VideoFrameRate 12
VideoSize 176x144
VideoGopSize 12
VideoCodec h263

AVOptionVideo flags +global_header

</Stream>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜