When using libVLC to play mp4 in my android app, no video output ,just gray color shown.
Posted: 23 Jul 2019 18:15
Hi there,
I would like to get the video frame texture,then draw it with opengles.But when run on device,only get pure color.
My code fragment:
@Override
//Activity method, init and play.
protected void onStart(){
super.onStart();
............
// Create LibVLC
ArrayList<String> options = new ArrayList<String>();
options.add("--aout=opensles");
options.add("--audio-time-stretch"); // time stretching
options.add("-vvv"); // verbosity
libvlc = new LibVLC(context,options);
// Create media player
mPlayer = new MediaPlayer(libvlc);
mPlayer.setEventListener(mPlayerListener);
Media m = new Media(libvlc, Uri.parse("file:///mnt/sdcard/crf18.mp4"));
mPlayer.setMedia(m);
mPlayer.play();
}
// following code called in onDrawFrame once. set the videoSurface.
..........
mSurfaceTexture = new SurfaceTexture(glSurfaceTextureId);
surface = new Surface(mSurfaceTexture);
final IVLCVout vout = getPlayer().getVLCVout();
vout.setVideoSurface(surface,null);
vout.addCallback(this);
vout.attachViews();
// layout uses GLSurfaceView
This is the error log:
...............
2019-07-24 00:10:15.661 8022-8044/com.example.demoplayer D/VLC: [d11fa1b0/1f6c] libvlc window: using vout window module "android_window"
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [d6640330/1f7a] libvlc video output: Opening vout display wrapper
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [dade7a30/1f7a] libvlc vout display: looking for vout display module matching "any": 5 candidates
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer E/VLC: [d11fa1b0/1f7a] libvlc window: request 1 not implemented
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [dade7a30/1f7a] libvlc vout display: VoutDisplayEvent 'resize' 3072x2048
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer E/VLC: [d11fa1b0/1f7a] libvlc window: request 1 not implemented
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [dade7a30/1f7a] libvlc vout display: VoutDisplayEvent 'resize' 3072x2048
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [d11fa4b0/1f7a] libvlc gl: looking for opengl es2 module matching "any": 1 candidates
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [d11fa4b0/1f7a] libvlc gl: no opengl es2 modules matched
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [dade7a30/1f7a] libvlc vout display: no vout display modules matched
2019-07-24 00:10:15.662 8022-8044/com.example.demoplayer E/VLC: [d6640330/1f6c] libvlc video output: video output creation failed
2019-07-24 00:10:15.664 8022-8044/com.example.demoplayer D/VLC: [daddd1b0/1f6c] libvlc spu text: removing module "freetype"
2019-07-24 00:10:15.664 8022-8044/com.example.demoplayer D/VLC: [dadde0b0/1f6c] libvlc scale: removing module "yuvp"
2019-07-24 00:10:15.664 8022-8044/com.example.demoplayer D/VLC: [daddd430/1f6c] libvlc scale: removing module "swscale"
2019-07-24 00:10:15.665 8022-8044/com.example.demoplayer E/VLC: [daddcf30/1f6c] libvlc decoder: failed to create video output
2019-07-24 00:10:15.665 8022-8044/com.example.demoplayer E/VLC: [daddcf30/1f6c] libvlc decoder: Opaque Vout request failed
Any help I appreciate!
I would like to get the video frame texture,then draw it with opengles.But when run on device,only get pure color.
My code fragment:
@Override
//Activity method, init and play.
protected void onStart(){
super.onStart();
............
// Create LibVLC
ArrayList<String> options = new ArrayList<String>();
options.add("--aout=opensles");
options.add("--audio-time-stretch"); // time stretching
options.add("-vvv"); // verbosity
libvlc = new LibVLC(context,options);
// Create media player
mPlayer = new MediaPlayer(libvlc);
mPlayer.setEventListener(mPlayerListener);
Media m = new Media(libvlc, Uri.parse("file:///mnt/sdcard/crf18.mp4"));
mPlayer.setMedia(m);
mPlayer.play();
}
// following code called in onDrawFrame once. set the videoSurface.
..........
mSurfaceTexture = new SurfaceTexture(glSurfaceTextureId);
surface = new Surface(mSurfaceTexture);
final IVLCVout vout = getPlayer().getVLCVout();
vout.setVideoSurface(surface,null);
vout.addCallback(this);
vout.attachViews();
// layout uses GLSurfaceView
This is the error log:
...............
2019-07-24 00:10:15.661 8022-8044/com.example.demoplayer D/VLC: [d11fa1b0/1f6c] libvlc window: using vout window module "android_window"
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [d6640330/1f7a] libvlc video output: Opening vout display wrapper
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [dade7a30/1f7a] libvlc vout display: looking for vout display module matching "any": 5 candidates
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer E/VLC: [d11fa1b0/1f7a] libvlc window: request 1 not implemented
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [dade7a30/1f7a] libvlc vout display: VoutDisplayEvent 'resize' 3072x2048
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer E/VLC: [d11fa1b0/1f7a] libvlc window: request 1 not implemented
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [dade7a30/1f7a] libvlc vout display: VoutDisplayEvent 'resize' 3072x2048
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [d11fa4b0/1f7a] libvlc gl: looking for opengl es2 module matching "any": 1 candidates
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [d11fa4b0/1f7a] libvlc gl: no opengl es2 modules matched
2019-07-24 00:10:15.662 8022-8058/com.example.demoplayer D/VLC: [dade7a30/1f7a] libvlc vout display: no vout display modules matched
2019-07-24 00:10:15.662 8022-8044/com.example.demoplayer E/VLC: [d6640330/1f6c] libvlc video output: video output creation failed
2019-07-24 00:10:15.664 8022-8044/com.example.demoplayer D/VLC: [daddd1b0/1f6c] libvlc spu text: removing module "freetype"
2019-07-24 00:10:15.664 8022-8044/com.example.demoplayer D/VLC: [dadde0b0/1f6c] libvlc scale: removing module "yuvp"
2019-07-24 00:10:15.664 8022-8044/com.example.demoplayer D/VLC: [daddd430/1f6c] libvlc scale: removing module "swscale"
2019-07-24 00:10:15.665 8022-8044/com.example.demoplayer E/VLC: [daddcf30/1f6c] libvlc decoder: failed to create video output
2019-07-24 00:10:15.665 8022-8044/com.example.demoplayer E/VLC: [daddcf30/1f6c] libvlc decoder: Opaque Vout request failed
Any help I appreciate!