Android流媒体MSMPEG4V3视频

时间:2013-03-25 11:09:20

标签: java android video stream

我有一个摄像头,可以传输application / x-mplayer2类型的视频,格式为:MSMPEG-4 V3 Video。当我尝试用android打开流时,它会出现错误:"抱歉,此视频无法播放。"。我尝试用这个流:

private void playVideo() {
            try {
                final String path = "http://82.140.132.217:8001";
                System.out.println("path --> "+path);
                Log.v(TAG, "path: " + path);
                if (path == null || path.length() == 0) {
                    Toast.makeText(MainActivity.this, "File URL/path is empty",
                            Toast.LENGTH_LONG).show();

                } else {
                    // If the path has not changed, just start the media player
                    if (path.equals(current) && mVideoView != null) {
                        mVideoView.start();
                        mVideoView.requestFocus();
                        return;
                    }
                    current = path;
                    System.out.println("Current path --> "+path);
                    mVideoView.setVideoPath(getDataSource(path));
                    mVideoView.start();
                    mVideoView.requestFocus();

                    System.out.println("end try in play");

                } 
            } catch (Exception e) {
                Log.e(TAG, "error: " + e.getMessage(), e);
                if (mVideoView != null) {
                    mVideoView.stopPlayback();
                }
            }
        }

如何传输此类视频?或者有没有办法将视频流转换为另一种类型? 谢谢!

1 个答案:

答案 0 :(得分:1)

application/x-mplayer2不是视频格式,此处是Android支持的视频格式和流的 http://developer.android.com/guide/appendix/media-formats.html 列表。 一旦您知道相机的实际格式和流类型,如果它不是兼容格式,您可以使用FFMPEG转换该流。