video stream from vlc to android, video missing
I'm trying to stream a video from VLC to an HTC G1. After several "this should work" I found a sout-chain that allowed me to watch the stream via VLC. I am also able to hear the audio on the android.
The sout-chain I'm currently using:
vlc some_file.mp4 -I http --sout "#transcode{soverlay,ab=128,samplerate=44100,channels=2,acodec=mp4a,vcodec=h264,width=480,height=270,vfilter="canvas{width=480,height=270,aspect=16:9}",fps=25,vb=800,venc=x264{level=12,no-cabac,subme=20,threads=4,bframes=0,min-keyint=1,keyint=50}}:gather:rtp{mp4a-latm,sdp=rtsp://0.0.0.0:5554/stream.sdp}"
That's what I'm doing on the droid:
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
vv = (VideoView) findViewById(R.id.video_view);
vv.setVideoURI(Uri.parse("rtsp://<local_ip>:5554/stream.sdp"));
vv.start();
}
I tried to keep it as minimal as possible (this is actually an example I found in another thread here). I also tried using MediaPlayer:
MediaPlayer mp = MediaPlayer.create(this, Uri.parse("rtsp://<local_ip>:5554/stream.sdp"));
mp.setDisplay(vv.getHolder());
mp.start();
I use setDisplay(SurfaceHolder) cause someone mentioned MediaPlayer otherwise wont know what display to use.
Any idea what I'm missin开发者_开发技巧g or doing wrong?
Edit: I hinted the the file with MP4Box
First, I think there's problem with your audio encoder, it shows "MPEG-1/2 Video" is not an audio encoder, would you please try "mpga"?
and another problem is you are trying to fit the frames into a specified size, width=480,height=270, could you delete this part?
my command works:
vlc /Users/chenyu/Sites/BBC.mp4 -I http --sout "#transcode{soverlay,ab=128,samplerate=44100,channels=2,acodec=mpga,vcodec=h264,fps=25,vb=800,venc=x264{level=1,no-cabac,subme=20,threads=4,bframes=0,min-keyint=1,keyint=50}}:gather:rtp{mp4a-latm,sdp=rtsp://10.0.1.2:5554/stream.sdp}"
also could you try the following code on android side?
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final VideoView vidView = (VideoView)findViewById(R.id.myVideo);
MediaController vidControl = new MediaController(this);
vidControl.setAnchorView(vidView);
vidView.setMediaController(vidControl);
vidView.setVideoPath("rtsp://10.0.1.2:5554/stream.sdp");
vidView.start();
}
精彩评论