我使用ffmpeg在本地创建了.sdp文件,尝试在Android上通过vlc播放。我试图通过vlc播放,但视频不出来。下面是我的 sdp 文件
v = 0
o = - 0 0 在 IP4 127.0.0.1
s = H.264 视频,由 LIVE555 媒体服务器流式传输
c = IN IP4 127.0.0.1
t = 0 0
a = 工具:libavformat 57.71.100
视频 10000 RTP / AVP 96
b = 作为:900
a = rtpmap:96 H264 / 90000
a = fmtp: 96 打包模式 = 1;
sprop 参数集 = Z00AH42kBQF / ywBA,
aO48gA ==; 配置文件级别 ID = 4D001F
vel-id = 4D001F
通过vlc播放的代码如下所示。
try {
if (media.length() > 0) {
Toast toast = Toast.makeText(this, media,Toast.LENGTH_LONG);
toast.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0,
0);
toast.show();
}
// Create LibVLC
// TODO: make this more robust, and sync with audio demo
ArrayList<String> options = new ArrayList<String>();
//options.add("--subsdec-encoding <encoding>");
options.add("--aout=opensles");
options.add("--audio-time-stretch"); // time stretching
options.add("-vvv"); // verbosity
//options.add("vlc -vvv @ : 5004");
libvlc = new LibVLC(this, options);
holder.setKeepScreenOn(true);
// Creating media player
mMediaPlayer = new MediaPlayer(libvlc);
mMediaPlayer.setEventListener(mPlayerListener);
// Seting up video output
final IVLCVout vout = mMediaPlayer.getVLCVout();
vout.setVideoView(mSurface);
//vout.setSubtitlesView(mSurfaceSubtitles);
vout.addCallback(this);
vout.attachViews();
Log.e(TAG, "URI :: "+Uri.parse(media));
Media m = new Media(libvlc, Uri.parse(media));
mMediaPlayer.setMedia(m);
mMediaPlayer.play();
} catch (Exception e) {
Toast.makeText(this, "Error in creating player!", Toast
.LENGTH_LONG).show();
}
问题是什么?