android - 将 LibVLC 嵌入到我的 android 应用程序中不播放视频,只播放音频

标签 android video vlc libvlc vlc-android

经过 3 天的旅程,我终于编译了 libvlc-3.0.0-2.1.0.aar,用于将 VLC 播放器嵌入到我的 Android (tv) 应用程序中。

改编后LibVLC Android Sample在我的项目中,我终于运行了该应用程序。

问题:只播放音频。视频从不出现(表面 View 保持黑色)。我用不同的视频测试过,图像永远不会出现。

知道为什么没有播放视频吗?这是我尝试播放的视频示例 (http://www.sample-videos.com/video/mp4/240/big_buck_bunny_240p_50mb.mp4)

我的设置:
我烧了一个android tv image进入我的 RPI3 并且应用程序在那里运行。

更新:我已经尝试过 VLC 原始应用程序(来自 apk)并且它正在发生同样的事情。

这是我的 Activity 代码:

public class MyVideoPlayerActivity extends Activity implements IVLCVout.Callback{

    public final static String TAG = "VideoActivity";

    // display surface
    private SurfaceView mSurface;
    private SurfaceHolder holder;

    // media player
    private LibVLC libvlc;
    private MediaPlayer mMediaPlayer = null;
    private int mVideoWidth;
    private int mVideoHeight;
    private final static int VideoSizeChanged = -1;

    private String mFilePath;

    @Override
    protected void onCreate(Bundle pSavedInstanceState) {
        super.onCreate(pSavedInstanceState);

        setContentView(R.layout.activity_my_video_player);

        mSurface = (SurfaceView) findViewById(R.id.surface);
        holder = mSurface.getHolder();
        //mFilePath = new String("http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8");
        //http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4
        //http://www.sample-videos.com/video/mp4/240/big_buck_bunny_240p_50mb.mp4
        mFilePath = new String("http://www.sample-videos.com/video/3gp/240/big_buck_bunny_240p_30mb.3gp");

    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        setSize(mVideoWidth, mVideoHeight);
    }

    @Override
    protected void onResume() {
        super.onResume();
        createPlayer(mFilePath);
    }

    @Override
    protected void onPause() {
        super.onPause();
        releasePlayer();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        releasePlayer();
    }

    /*************
     * Surface
     *************/
    private void setSize(int width, int height) {
        mVideoWidth = width;
        mVideoHeight = height;
        if (mVideoWidth * mVideoHeight <= 1)
            return;

        if(holder == null || mSurface == null)
            return;

        // get screen size
        int w = getWindow().getDecorView().getWidth();
        int h = getWindow().getDecorView().getHeight();

        // getWindow().getDecorView() doesn't always take orientation into
        // account, we have to correct the values
        boolean isPortrait = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
        if (w > h && isPortrait || w < h && !isPortrait) {
            int i = w;
            w = h;
            h = i;
        }

        float videoAR = (float) mVideoWidth / (float) mVideoHeight;
        float screenAR = (float) w / (float) h;

        if (screenAR < videoAR)
            h = (int) (w / videoAR);
        else
            w = (int) (h * videoAR);

        // force surface buffer size
        holder.setFixedSize(mVideoWidth, mVideoHeight);

        // set display size
        LayoutParams lp = mSurface.getLayoutParams();
        lp.width = w;
        lp.height = h;
        mSurface.setLayoutParams(lp);
        mSurface.invalidate();
    }

    /*************
     * Player
     *************/

    private void createPlayer(String media) {
        releasePlayer();
        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
            libvlc = new LibVLC(this, options);
            holder.setKeepScreenOn(true);

            // Create media player
            mMediaPlayer = new MediaPlayer(libvlc);
            mMediaPlayer.setEventListener(mPlayerListener);

            // Set up video output
            final IVLCVout vout = mMediaPlayer.getVLCVout();
            vout.setVideoView(mSurface);
            //vout.setSubtitlesView(mSurfaceSubtitles);
            vout.addCallback(this);
            vout.attachViews();

            Media m = new Media(libvlc, (Uri.parse(media)) );
            mMediaPlayer.setMedia(m);
            mMediaPlayer.play();
        } catch (Exception e) {
            Toast.makeText(this, "Error creating player!", Toast.LENGTH_LONG).show();
        }
    }

    // TODO: handle this cleaner
    private void releasePlayer() {
        if (libvlc == null)
            return;

        Log.d(TAG, "Releasing Player");
        mMediaPlayer.stop();
        final IVLCVout vout = mMediaPlayer.getVLCVout();
        vout.removeCallback(this);
        vout.detachViews();
        holder = null;
        libvlc.release();
        libvlc = null;

        mVideoWidth = 0;
        mVideoHeight = 0;
    }

    public void finishActivity() {
        finish();
    }
    /*************
     * Events
     *************/

    private MediaPlayer.EventListener mPlayerListener = new MyPlayerListener(this);

    @Override
    public void onNewLayout(IVLCVout vout, int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen) {
        if (width * height == 0)
            return;

        // store video size
        mVideoWidth = width;
        mVideoHeight = height;
        setSize(mVideoWidth, mVideoHeight);
        Log.d(TAG, "OnNewLayout " + mVideoWidth + "x" + mVideoHeight);
    }

    @Override
    public void onSurfacesCreated(IVLCVout vout) {
        Log.d(TAG, "onSurfacesCreated " + vout);
    }

    @Override
    public void onSurfacesDestroyed(IVLCVout vout) {
        Log.d(TAG, "onSurfacesDestroyed " + vout);
    }


    private static class MyPlayerListener implements MediaPlayer.EventListener {
        private WeakReference<MyVideoPlayerActivity> mOwner;

        public MyPlayerListener(MyVideoPlayerActivity owner) {
            mOwner = new WeakReference<MyVideoPlayerActivity>(owner);
        }

        @Override
        public void onEvent(org.videolan.libvlc.MediaPlayer.Event event) {
            MyVideoPlayerActivity player = mOwner.get();

            switch(event.type) {
                case org.videolan.libvlc.MediaPlayer.Event.EndReached:
                    Log.d(TAG, "MediaPlayerEndReached");
                    player.releasePlayer();
                    break;
                case org.videolan.libvlc.MediaPlayer.Event.Playing:
                    Log.d(TAG, "MediaPlayer Playing");
                case org.videolan.libvlc.MediaPlayer.Event.Paused:
                    Log.d(TAG, "MediaPlayer Paused");
                case org.videolan.libvlc.MediaPlayer.Event.Stopped:
                    Log.d(TAG, "MediaPlayer Stopped");
                    //player.releasePlayer();
                    //player.finishActivity();
                default:
                    break;
            }
        }
    }

这是资源/布局的代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:baselineAligned="false"
    android:orientation="horizontal"
    tools:context=".MyVideoPlayerActivity" >


    <FrameLayout
        android:layout_width="500dp"
        android:layout_height="300dp" >

        <SurfaceView
            android:id="@+id/surface"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="center" />
    </FrameLayout>

</LinearLayout>

这是 adb 日志的副本:
完整登录 link
W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (2556x1438, max=2048x2048)
W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (2556x1438, max=2048x2048)
D/VLC: [a2fb0db8/656c706d] core libvlc: VLC media player - 3.0.0-git Vetinari
D/VLC: [a2fb0db8/79746976] core libvlc: Copyright © 1996-2016 the VideoLAN team
D/VLC: [a2fb0db8/160013] core libvlc: revision 2.2.0-git-8758-gb0f06e8
D/VLC: [a2fb0db8/a0497a18] core libvlc: configured with ../configure  '--host=arm-linux-androideabi' '--build=x86_64-unknown-linux' '--with-contrib=/home/edup/sources/vlc-android/vlc/contrib/arm-linux-androideabi' '--enable-neon' '--disable-nls' '--enable-live555' '--enable-realrtsp' '--enable-avformat' '--enable-swscale' '--enable-avcodec' '--enable-opus' '--enable-opensles' '--enable-mkv' '--enable-taglib' '--enable-dvbpsi' '--disable-vlc' '--disable-shared' '--disable-update-check' '--disable-vlm' '--disable-dbus' '--enable-lua' '--disable-vcd' '--disable-v4l2' '--disable-gnomevfs' '--enable-dvdread' '--enable-dvdnav' '--disable-bluray' '--disable-linsys' '--disable-decklink' '--disable-libva' '--disable-dv1394' '--enable-mod' '--disable-sid' '--disable-gme' '--disable-tremor' '--disable-mad' '--enable-mpg123' '--disable-dca' '--disable-sdl-image' '--enable-zvbi' '--disable-fluidsynth' '--enable-fluidlite' '--disable-jack' '--disable-pulse' '--disable-alsa' '--disable-samplerate' '--disable-sdl' '--disable-xcb' 
D/VLC: [a2fb0db8/a2f78580] core libvlc: plug-ins loaded: 286 modules
D/VLC: [a2f3a2c8/a2f78580] core logger: looking for logger module matching "any": 4 candidates
D/VLC: [a2f3a2c8/120000] core logger: using logger module "android_logger"
D/VLC: [a2fb0db8/af3] core libvlc: translation test: code is "C"
D/VLC: [a2f3a328/af3] core keystore: looking for keystore module matching "memory": 3 candidates
D/VLC: [a2f3a328/af3] core keystore: using keystore module "memory"
D/VLC: [a2fb0db8/af3] core libvlc: CPU has capabilities ARM_NEON FPU 
D/VLC: [a2fb1bb8/af3] core generic: creating audio output
D/VLC: [9e542528/af3] core audio output: looking for audio output module matching "opensles": 4 candidates
W/libOpenSLES: class OutputMix interface 0 requested but unavailable MPH=43
D/VLC: [9e542528/af3] core audio output: using audio output module "opensles_android"
D/VLC: [a2fb1bb8/af3] core generic: keeping audio output
W/EGL-DRI2: Native format mismatch: 0x1 != 0x5
D/VideoActivity: onSurfacesCreated org.videolan.libvlc.AWindow@95d92e7
D/VLC: [a2f9f718/af3] core input: Creating an input for 'big_buck_bunny.mp4'
W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (2556x1438, max=2048x2048)
D/VLC: [a2f9f718/b5f] core input: using timeshift granularity of 50 MiB
D/VLC: [a2f9f718/b5f] core input: using default timeshift path
D/VLC: [a2f9f718/b5f] core input: `http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4' gives access `http' demux `' path `clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
D/VLC: [af3f38e8/b5f] core input source: specified demux: any
D/VLC: [af3f38e8/b5f] core input source: creating demux: access='http' demux='any' location='clips.vorwaerts-gmbh.de/big_buck_bunny.mp4' file='(null)'
D/VLC: [a2f24ea8/b5f] core demux: looking for access_demux module matching "http": 6 candidates
D/VLC: [a2f24ea8/b5f] core demux: no access_demux modules matched
D/VLC: [af3f3a28/b5f] core stream: creating access: http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4

************[I've cut this part for characters restriction reason. Please follow the link above for full log]**************

D/VLC: [a2f24ea8/b5f] mp4 demux: Found video Rtp: m=video
W/VLC: [a2f24ea8/b5f] mp4 demux: elst box found
D/VLC: [a2f24ea8/b5f] mp4 demux:    - [0] duration=60095ms media time=0ms) rate=1.0
D/VLC: [a2f24ea8/b5f] mp4 demux: track[Id 0x3] read 240 chunk
W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (2556x1438, max=2048x2048)
W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (2556x1438, max=2048x2048)
W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (2556x1438, max=2048x2048)
W/VLC: [a2f24ea8/b5f] mp4 demux: STTS table of 2 entries
D/VLC: [a2f24ea8/b5f] mp4 demux: track[Id 0x3] read 1440 samples length:60s
D/VLC: [a2f24ea8/b5f] essetup demux: Unrecognized FourCC rtp 
D/VLC: [a2f24ea8/b5f] mp4 demux: adding track[Id 0x3] video (disable) language eng
D/VLC: [a2f24ea8/b5f] mp4 demux: Found audio Rtp: m=audio
W/VLC: [a2f24ea8/b5f] mp4 demux: elst box found
D/VLC: [a2f24ea8/b5f] mp4 demux:    - [0] duration=60095ms media time=0ms) rate=1.0
D/VLC: [a2f24ea8/b5f] mp4 demux: track[Id 0x4] read 241 chunk
W/VLC: [a2f24ea8/b5f] mp4 demux: STTS table of 3 entries
D/VLC: [a2f24ea8/b5f] mp4 demux: track[Id 0x4] read 648 samples length:60s
D/VLC: [a2f24ea8/b5f] mp4 demux: adding track[Id 0x4] audio (disable) language eng
D/VLC: [a2f24ea8/b5f] fragments demux: fragment offset 24, data 37130<->5510872 @0, durations (null)
D/VLC: [a2f24ea8/b5f] core demux: using demux module "mp4"
D/VLC: [af3f3a28/b62] h1conn stream: outgoing request:
       GET /big_buck_bunny.mp4 HTTP/1.1
       Host: clips.vorwaerts-gmbh.de
       Accept: */*
       Accept-Language: en_US
       User-Agent: VLC/3.0.0-git LibVLC/3.0.0-git
       If-Match: "5416d8-47f21fa7d3300"
       Range: bytes=5510872-
D/VLC: [a2fa42a8/b5f] core decoder: looking for decoder module matching "mediacodec_ndk,iomx,all": 40 candidates
D/VLC: [a2fa42a8/b5f] avcodec decoder: CPU flags: 0x0000003f
D/VLC: [a2fa42a8/b5f] avcodec decoder: codec (aac) started
D/VLC: [a2fa42a8/b5f] core decoder: using decoder module "avcodec"
D/VLC: [a2fa49a8/b5f] core decoder: looking for decoder module matching "mediacodec_ndk,iomx,all": 40 candidates
D/VLC: [a2fa49a8/b5f] avcodec decoder: CPU flags: 0x0000003f
D/VLC: [af3f3a28/b62] h1conn stream: incoming response:
       HTTP/1.1 416 Requested Range Not Satisfiable
       Date: Sat, 03 Sep 2016 20:40:58 GMT
       Content-Type: text/html
       Transfer-Encoding: chunked
       Connection: keep-alive
       Set-Cookie: __cfduid=d491331e46f4fe1fd02450fd87b2704231472935258; expires=Sun, 03-Sep-17 20:40:58 GMT; path=/; domain=.vorwaerts-gmbh.de; HttpOnly
       Cache-Control: public, max-age=31536000
       Expires: Sun, 03 Sep 2017 20:40:58 GMT
       CF-Cache-Status: HIT
       Content-Range: bytes */5510872
       Server: cloudflare-nginx
       CF-RAY: 2dcc0517a62d06d0-LHR
D/VLC: [af3f3b68/b62] prefetch stream: end of stream
D/VLC: [a2fa49a8/b5f] avcodec decoder: allowing 4 thread(s) for decoding
I/Choreographer: Skipped 38 frames!  The application may be doing too much work on its main thread.
D/VLC: [a2fa49a8/b5f] avcodec decoder: codec (h264) started
D/VLC: [a2fa49a8/b5f] avcodec decoder: using frame thread mode with 4 threads
D/VLC: [a2fa49a8/b5f] core decoder: using decoder module "avcodec"
D/VLC: [9cf662f8/b5f] core demux meta: looking for meta reader module matching "any": 2 candidates
D/VLC: [9cf662f8/b5f] lua demux meta: Trying Lua scripts in /data/user/0/com.biti_kids.biti/app_vlc/.share/lua/meta/reader
D/VLC: [9cf662f8/b5f] lua demux meta: Trying Lua scripts in /data/app/com.biti_kids.biti-1/lib/arm/vlc/lua/meta/reader
D/VLC: [9cf662f8/b5f] lua demux meta: Trying Lua scripts in /data/app/com.biti_kids.biti-1/share/vlc/lua/meta/reader
D/VLC: [9cf662f8/b5f] core demux meta: no meta reader modules matched
D/VLC: [a2f9f718/b5f] core input: `http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4' successfully opened
D/VLC: [a2f24ea8/b5f] mp4 demux: elst (0) gives 0ms (movie)-> 0ms (track)
D/VLC: [a2f24ea8/b5f] mp4 demux: elst (0) gives 0ms (movie)-> 0ms (track)
D/VLC: [a2f24ea8/b5f] mp4 demux: track[Id 0x2] using Sync Sample Box (stss)
D/VLC: [a2f24ea8/b5f] mp4 demux: stss gives 0 --> 0 (sample number)
W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (2556x1438, max=2048x2048)
W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (2556x1438, max=2048x2048)
W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (2556x1438, max=2048x2048)
D/VLC: [af3f3a28/b6b] transport stream: connecting to clips.vorwaerts-gmbh.de port 80 ...
D/VLC: [af3f3a28/b62] h1conn stream: outgoing request:
       GET /big_buck_bunny.mp4 HTTP/1.1
       Host: clips.vorwaerts-gmbh.de
       User-Agent: VLC/3.0.0-git LibVLC/3.0.0-git
       Range: bytes=37130-
D/VLC: [af3f3a28/b62] h1conn stream: incoming response:
       HTTP/1.1 206 Partial Content
       Date: Sat, 03 Sep 2016 20:40:59 GMT
       Content-Type: video/mp4
       Content-Length: 5473742
       Connection: keep-alive
       CF-Cache-Status: HIT
       Content-Range: bytes 37130-5510871/5510872
       Server: cloudflare-nginx
       CF-RAY: 2dcc051a2b100cd7-LHR
D/VLC: [af3f3a28/b62] h1conn stream: connection failed
D/VLC: [a2f9f718/b5f] core input: Buffering 0%
D/VLC: [a2fb1bb8/b65] core generic: reusing audio output
E/VLC-std: aout_get_native_sample_rate: 48000
W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 1, track 22050 Hz, output 48000 Hz
D/VLC: [9e542528/b65] core audio output: output 's16l' 22050 Hz Stereo frame=1 samples/4 bytes
D/VLC: [a2fb6ed8/b65] core volume: looking for audio volume module matching "any": 3 candidates
D/VLC: [a2fb6ed8/b65] core volume: using audio volume module "integer_mixer"
D/VLC: [9e542528/b65] core audio output: input 'f32l' 22050 Hz Stereo frame=1 samples/8 bytes
D/VLC: [a2fa5ea8/b65] core audio filter: looking for audio filter module matching "scaletempo": 13 candidates
D/VLC: [a2fa5ea8/b65] scaletempo audio filter: format: 22050 rate, 2 nch, 4 bps, fl32
D/VLC: [a2fa5ea8/b65] scaletempo audio filter: params: 30 stride, 0.200 overlap, 14 search
D/VLC: [a2fa5ea8/b65] scaletempo audio filter: 1.000 scale, 661.000 stride_in, 661 stride_out, 529 standing, 132 overlap, 308 search, 1101 queue, fl32 mode
D/VLC: [a2fa5ea8/b65] core audio filter: using audio filter module "scaletempo"
D/VLC: [9e542528/b65] core audio output: conversion: 'f32l'->'f32l' 22050 Hz->22050 Hz Stereo->Stereo
D/VLC: [9e542528/b65] core audio output: conversion pipeline complete
D/VLC: [9e542528/b65] core audio output: conversion: 'f32l'->'s16l' 22050 Hz->22050 Hz Stereo->Stereo
D/VLC: [a2fa6228/b65] core audio converter: looking for audio converter module matching "any": 7 candidates
D/VLC: [a2fa6228/b65] audio_format audio converter: f32l->s16l, bits per sample: 32->16
D/VLC: [a2fa6228/b65] core audio converter: using audio converter module "audio_format"
D/VLC: [9e542528/b65] core audio output: conversion pipeline complete
D/VLC: [a2fa65a8/b65] core audio resampler: looking for audio resampler module matching "any": 2 candidates
D/VLC: [a2fa65a8/b65] core audio resampler: using audio resampler module "ugly"
D/VLC: [a2fa49a8/b66] avcodec decoder: available software decoder output format 0 (yuv420p)
D/VLC: [a2f9f718/b5f] core input: Buffering 2%
D/VLC: [a2f9f718/b5f] core input: Buffering 5%
D/VLC: [a2f9f718/b5f] core input: Buffering 8%
D/VLC: [a2f9f718/b5f] core input: Buffering 11%
D/VLC: [9d9e0728/b66] core spu text: looking for text renderer module matching "any": 1 candidates
D/VLC: [9e4df248/b66] core stream: creating access: file:///system/etc/system_fonts.xml
D/VLC: [9e4df248/b66] core stream:  (path: /system/etc/system_fonts.xml)
D/VLC: [9e4df248/b66] core stream: looking for access module matching "file": 23 candidates
D/VLC: [9e4df248/b66] core stream: using access module "filesystem"
D/VLC: [9e4df2e8/b66] core stream: looking for stream_filter module matching "prefetch,cache_read": 12 candidates
D/VLC: [9e4df2e8/b66] cache_read stream: Using stream method for AStream*
D/VLC: [a2f9f718/b5f] core input: Buffering 13%
D/VLC: [a2f9f718/b5f] core input: Buffering 16%
D/VLC: [a2f9f718/b5f] core input: Buffering 19%
D/VLC: [a2f9f718/b5f] core input: Buffering 22%
D/VLC: [a2f9f718/b5f] core input: Buffering 25%
D/VLC: [a2f9f718/b5f] core input: Buffering 27%
D/VLC: [a2f9f718/b5f] core input: Buffering 30%
D/VLC: [9e4df2e8/b66] cache_read stream: starting pre-buffering
D/VLC: [9e4df2e8/b66] cache_read stream: received first data after 4 ms
D/VLC: [9e4df2e8/b66] cache_read stream: pre-buffering done 1024 bytes in 0s - 238 KiB/s
D/VLC: [9e4df2e8/b66] core stream: using stream_filter module "cache_read"
D/VLC: [9e4d3528/b66] core xml reader: looking for xml reader module matching "any": 1 candidates
D/VLC: [9e4d3528/b66] core xml reader: using xml reader module "xml"
D/VLC: [a2f9f718/b5f] core input: Buffering 33%
D/VLC: [a2f9f718/b5f] core input: Buffering 36%
D/VLC: [a2f9f718/b5f] core input: Buffering 38%
D/VLC: [9e4df2e8/b66] core stream: removing module "cache_read"
D/VLC: [9e4df248/b66] core stream: removing module "filesystem"
D/VLC: [9e4df1a8/b66] core stream: creating access: file:///system/etc/fallback_fonts.xml
D/VLC: [9e4df1a8/b66] core stream:  (path: /system/etc/fallback_fonts.xml)
D/VLC: [a2f9f718/b5f] core input: Buffering 41%
D/VLC: [a2f9f718/b5f] core input: Buffering 44%
D/VLC: [a2f9f718/b5f] core input: Buffering 47%
D/VLC: [9e4df1a8/b66] core stream: looking for access module matching "file": 23 candidates
D/VLC: [9e4df1a8/b66] core stream: using access module "filesystem"
D/VLC: [9e4df248/b66] core stream: looking for stream_filter module matching "prefetch,cache_read": 12 candidates
D/VLC: [9e4df248/b66] cache_read stream: Using stream method for AStream*
D/VLC: [9e4df248/b66] cache_read stream: starting pre-buffering
D/VLC: [9e4df248/b66] cache_read stream: received first data after 0 ms
D/VLC: [9e4df248/b66] cache_read stream: pre-buffering done 1024 bytes in 0s - 3717 KiB/s
D/VLC: [9e4df248/b66] core stream: using stream_filter module "cache_read"
D/VLC: [9e4d3528/b66] core xml reader: looking for xml reader module matching "any": 1 candidates
D/VLC: [9e4d3528/b66] core xml reader: using xml reader module "xml"
D/VLC: [a2f9f718/b5f] core input: Buffering 50%
D/VLC: [a2f9f718/b5f] core input: Buffering 52%
D/VLC: [a2f9f718/b5f] core input: Buffering 55%
D/VLC: [a2f9f718/b5f] core input: Buffering 58%
D/VLC: [a2f9f718/b5f] core input: Buffering 61%
D/VLC: [a2f9f718/b5f] core input: Buffering 63%
D/VLC: [a2f9f718/b5f] core input: Buffering 66%
D/VLC: [a2f9f718/b5f] core input: Buffering 69%
D/VLC: [a2f9f718/b5f] core input: Buffering 72%
D/VLC: [9e4df248/b66] core stream: removing module "cache_read"
D/VLC: [9e4df1a8/b66] core stream: removing module "filesystem"
D/VLC: [9e4df2e8/b66] core stream: creating access: file:///vendor/etc/fallback_fonts.xml
D/VLC: [9e4df2e8/b66] core stream:  (path: /vendor/etc/fallback_fonts.xml)
D/VLC: [9e4df2e8/b66] core stream: looking for access module matching "file": 23 candidates
E/VLC: [9e4df2e8/b66] filesystem stream: cannot open file /vendor/etc/fallback_fonts.xml (No such file or directory)
E/VLC: [9e4df2e8/b66] core stream: File reading failed
E/VLC: [9e4df2e8/b66] core stream: VLC could not open the file "/vendor/etc/fallback_fonts.xml" (No such file or directory).
D/VLC: [a2f9f718/b5f] core input: Buffering 75%
D/VLC: [9e4df2e8/b66] core stream: no access modules matched
E/VLC: [9d9e0728/b66] core spu text: no suitable access module for `file:///vendor/etc/fallback_fonts.xml'
D/VLC: [9d9e0728/b66] core spu text: using text renderer module "freetype"
D/VLC: [9d9e1fa8/b66] core scale: looking for video filter module matching "any": 39 candidates
D/VLC: [a2f9f718/b5f] core input: Buffering 77%
D/VLC: [a2f9f718/b5f] core input: Buffering 80%
D/VLC: [a2f9f718/b5f] core input: Buffering 83%
D/VLC: [a2f9f718/b5f] core input: Buffering 86%
D/VLC: [a2f9f718/b5f] core input: Buffering 88%
D/VLC: [9d9e1fa8/b66] swscale scale: 32x32 (32x32) chroma: YUVA -> 16x16 (16x16) chroma: RGBA with scaling using Bicubic (good quality)
D/VLC: [9d9e1fa8/b66] core scale: using video filter module "swscale"
D/VLC: [9d9e2328/b66] core scale: looking for video filter module matching "any": 39 candidates
D/VLC: [9d9e2328/b66] yuvp scale: YUVP to YUVA converter
D/VLC: [9d9e2328/b66] core scale: using video filter module "yuvp"
D/VLC: [a0758928/b66] core video output: Deinterlacing available
D/VLC: [a0758928/b66] core video output: deinterlace 0, mode blend, is_needed 0
D/VLC: [a081f2b8/b66] core window: looking for vout window module matching "any": 1 candidates
D/VLC: [a081f2b8/b66] core window: no vout window modules matched
D/VLC: [a2f9f718/b5f] core input: Buffering 91%
D/VLC: [a2f9f718/b5f] core input: Buffering 94%
D/VLC: [a0758928/b6e] core video output: Opening vout display wrapper
D/VLC: [b4ce7268/b6e] core vout display: looking for vout display module matching "any": 4 candidates
D/VLC: [a2f9f718/b5f] core input: Buffering 97%
D/VLC: [a2f9f718/b5f] core input: Buffering 100%
W/VLC: [b4ce7268/b6e] android_window vout display: Could not initialize NativeWindow Priv API.
D/VLC: [b4ce7268/b6e] android_window vout display: using ANW
E/VLC: [b4ce7268/b6e] android_window vout display: can't get Subtitles Surface
D/VLC: [b4ce7268/b6e] core vout display: VoutDisplayEvent 'fullscreen' 1
D/VLC: [b4ce7268/b6e] core vout display: using vout display module "android_window"
D/VLC: [b4ce7268/b6e] core vout display: A filter to adapt decoder I420 to display RV32 is needed
D/VLC: [9d015728/b6e] core filter: looking for video filter module matching "any": 39 candidates
D/VLC: [9d015728/b6e] yuv_rgb_neon filter: I420(640x360) to RV32(640x360)
D/VLC: [9d015728/b6e] core filter: using video filter module "yuv_rgb_neon"
D/VLC: [b4ce7268/b6e] core vout display: Filter 'yuv_rgb_neon' (0x9d015728) appended to chain
D/VLC: [b4ce7268/b6e] android_window vout display: PoolAlloc: request 3 frames
D/VLC: [b4ce7268/b6e] android_window vout display: PoolAlloc: got 1 frames
W/VLC: [a0758928/b6e] core video output: Not enough display buffers in the pool, requested 3 got 1
D/VLC: [a0758928/b6e] core video output: original format sz 640x386, of (0,0), vsz 640x360, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0
D/VLC: [9d9e0728/b66] core spu text: removing module "freetype"
D/VLC: [9d9e0728/b66] core spu text: looking for text renderer module matching "any": 1 candidates
D/VLC: [9e4df2e8/b66] core stream: creating access: file:///system/etc/system_fonts.xml
D/VLC: [9e4df2e8/b66] core stream:  (path: /system/etc/system_fonts.xml)
D/VLC: [9e4df2e8/b66] core stream: looking for access module matching "file": 23 candidates
D/VLC: [9e4df2e8/b66] core stream: using access module "filesystem"
D/VLC: [a2f9f718/b5f] core input: Stream buffering done (1540 ms in 305 ms)
D/VLC: [9d9e0728/b66] core spu text: using text renderer module "freetype"
D/VLC: [a2fa49a8/b6a] core decoder: Received first picture
D/VLC: [a2f9f718/b5f] core input: Decoder wait done in 582 ms
W/VLC: [9e542528/b65] core audio output: playback too early (-72928): down-sampling

谢谢你的帮助!

最佳答案

可悲的事实是libvlc sample已经过时了。
正如海报所评论的那样,也许避免 VLC 是一种选择。

不管好坏,libvlc 在我的旧 Android Tab(nexus 7)上工作。

至于网上的示例,用旧版本的 NDK 编译的 libvlc 似乎包含 TEXTREL,并且 github 上的很多示例都受此影响。

我使用了自编译的 libvlc-3.0.0-2.1.1.aar 并进行了以下调整。

删除接口(interface):

LibVLC.HardwareAccelerationError //is now gone(idk what replaces this!).

更改的实现:
IVLCVout.callback.onNewLayout 


IVLCVout.OnNewVideoLayoutListener.onNewVideoLayout

实例化 LibVLC
mLibVLC = new LibVLC();
mLibVLC = new LibVLC(options);


mLibVLC = new LibVLC(getApplicationContext());
mLibVLC = new LibVLC(getApplicationContext(),options);

MainActivity 可能已损坏

它应该向我们显示可以播放的视频列表,但我只能看到一个只播放音频的按钮,所以如果你想测试 VLC 视频功能,也许你需要添加一些代码来启动 VideoActivity 并调用它。
    public void startVideoIntent(String path){
        Intent intent = new Intent(MainActivity.this, VideoActivity.class);
        intent.putExtra(VideoActivity.LOCATION, (String) path);
        mPlayingVideo = true;
        startActivity(intent);

    }

关于android - 将 LibVLC 嵌入到我的 android 应用程序中不播放视频,只播放音频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39311753/

相关文章:

ios - 如何在 VLC 播放器上播放原始 YUV NV12 文件

android - anko DSL 中的 <fragment> 标签等价物

video - 如何在jwplayer中播放Google Drive视频?

arrays - 如何将数字转换为特定的字节数组?

android - MediaStore.Video.Media.DURATION 中的 DURATION 错误

javascript - 奇怪的 IE,Javascript 只能在开发模式下工作(F12)

matlab - 为什么 VLC 不能进入全屏模式?

Android、javamail 和 proguard

Android - 创建自定义目录来存储文件

android - 使用 AlarmManager 取消特定的 PendingIntents