使用qt 編寫視頻播放程序,想到兩種方案分別是:qt+ffmpeg和 qt+vlc。
qt+vlc又有兩種,一種是qt+libvlc,一種是qt+ vlc-qt 庫。
vlc-qt 是在libvlc 的基礎上進行了再次封裝。
本文是介紹如何編譯及使用vlc-qt庫和vlc-qt-examples。
安裝編譯依賴包
apt install -y qtcreator
apt install -y qt5-qmake qtbase5-dev
apt install -y qtdeclarative5-dev
cd /usr/lib/mips64el-linux-gunabi64/qtchooser
cp qt5.conf default.conf
apt install libvlccore-dev
apt install libvlc-dev
下載vlc-qt
git clone --depth 1 https://github.com/vlc-qt/vlc-qt.git
git submodule init
git submodule update
編譯
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/opt/vlc-qt-1.2.0
make install
vlc-qt-examples
git clone --depth 1 https://github.com/vlc-qt/examples.git
cd examples/simple-player
mkdir build
export VLCQt_DIR=/opt/vlc-qt-1.2.0
export VLCQtCore_DIR=/opt/vlc-qt-1.2.0
cmake ..
make
simple-player
的運行效果如下圖:
參考:
https://vlc-qt.tano.si/
https://wiki.videolan.org/LibVLC_Tutorial/
https://blog.csdn.net/leixiaohua1020/article/details/42363079