在Android中播放RTSP流
我正在尝试在 Android 设备上播放视频流。不幸的是,我在 MediaPlayer/VideoView 上仍然遇到同样的问题。我已经搜索了几天,但仍然没有找到任何可行的解决方案。 出于测试目的,我使用 API 演示(API 演示/媒体/MediaPlayer/播放流视频)中的 MediaPlayer 应用程序。 这是播放流的代码片段
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setDataSource(path);
mMediaPlayer.setDisplay(holder);
mMediaPlayer.prepare();
mMediaPlayer.setOnBufferingUpdateListener(this);
mMediaPlayer.setOnCompletionListener(this);
mMediaPlayer.setOnPreparedListener(this);
mMediaPlayer.setOnVideoSizeChangedListener(this);
当我尝试播放流时,我从 logcat 获取此信息 http://pastebin.com/5Uib5CH5
这是 ffserver 流式传输视频的配置
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>
如果有人可以建议我如何修复,或者至少指出一个错误,我将不胜感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了如何运行适合 Android 设备的流媒体的解决方案。这是我为任何其他有类似问题的人提供的 ffserver 配置。
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.