- This is an introduction about build VLC on Android natively, not cross build VLC for Android
- It's pretty useless, just for fun.
- Install termux from F-Droid or Google play on Android device
Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically - additional packages are available using the APT package manager.
-
Setup remote login
https://wiki.termux.com/wiki/Remote_Access
This is not necessary if you can connect a monitor and keyboard to your Android device.
-
Install the required package and tools to download and build VLC. The following is an incomplete list of package what I installed:
cmake clang lldb vim tmux bash-completion make man ninja htop tree ctags mediainfo ffmpeg libx264 libx265 pkg-config flex bison libtool gettext autoconf automake m4 ndk-sysroot ndk-multilib
-
Get the source code from https://code.videolan.org/ or https://github.com/videolan/vlc.git
git clone https://github.com/videolan/vlc.git
-
Since there is no JVM environment, some code doesn't work as expected. Patch the source code
diff --git a/src/android/specific.c b/src/android/specific.c index 1b74f522a3..d83b193b02 100644 --- a/src/android/specific.c +++ b/src/android/specific.c @@ -172,7 +172,7 @@ void system_Configure(libvlc_int_t *p_libvlc, int i_argc, const char *const pp_argv[]) { (void)i_argc; (void)pp_argv; - assert(s_jvm != NULL); + //assert(s_jvm != NULL); var_Create(p_libvlc, "android-jvm", VLC_VAR_ADDRESS); var_SetAddress(p_libvlc, "android-jvm", s_jvm); }
-
Run bootstrap and configure
This is the configure options what I used
CC=clang \ CXX=clang++ \ BUILDCC=clang \ EGL_LIBS="-L/system/lib64 -lEGL" \ GLES2_LIBS="-L/system/lib64 -lGLESv2" \ ac_cv_header_sys_shm_h=no \ ../configure --enable-debug \ --disable-lua \ --disable-a52 \ --disable-alsa \ --disable-qt \ --disable-v4l2 \ --prefix=$HOME/local \ --disable-xcb # --enable-xcb if you want x11 output
-
Then run make. That's all! After build success, you can run VLC on command line to playback.
AudioTrack doesn't work. OpenSLES works out of box. So there is no problem to get audio output.
The standard Android video output doesn't work since there is no SurfaceView. You can get X11 output, but don't expect good performance.
-
Install X11 libs in termux. I can't figure out a minimum package list, so just install openbox and all of the dependencies.
apt-get install libx11-static xorgproto libxrandr openbox
-
Install the XServer XSDL app via Google play
-
--enable-xcb and rebuild VLC
-
open XServer XSDL
-
export DISPLAY=:0 in termux and run VLC