1

我有一个摄像头,可以流式传输 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();
                }
            }
        }

如何流式传输此类视频?或者有什么方法可以将视频流转换为另一种类型?谢谢!

4

1 回答 1

1

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

于 2013-03-25T11:53:48.890 回答