termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
12.98k stars 2.98k forks source link

Qt/qml video, How to solve? #20444

Closed tiagolima123 closed 3 months ago

tiagolima123 commented 3 months ago

Video in qml on device armv8 is not working

VideoOutput {
      id: video
      width: parent.width
      height: parent.height
      source: mediaPlayer
}

MediaPlayer {
       id: mediaPlayer
       source: "file:///sdcard/video.mp4"
       autoLoad: true
      autoPlay: true
}

logcat output ... F DEBUG : #00 pc 0000000000003e94 /data/data/com.termux/files/usr/lib/libQt5MultimediaQuick.so.5.15.10 (offset 0xa000)

crash_dump64: dlopen libaed.so fail: dlopen failed: library "libaed.so" not found

Biswa96 commented 3 months ago

Please provide all the steps to reproduce the issue.

tiagolima123 commented 3 months ago

source code

qml/main.qml

import QtQuick 2.0
import QtMultimedia 5.11
import QtQuick.Window 2.0

Rectangle {
    id: root
    width: 740
    height: 420
    color: "black"

    VideoOutput {
        id: video
        width: 740
        height: 420
        source: mediaPlayer
    }

    MediaPlayer {
        id: mediaPlayer
        source: "file:///sdcard/video.mp4"
        autoLoad: true
        autoPlay: true
    }
}

main.qrc

<RCC>
    <qresource>
        <file alias="main.qml">qml/main.qml</file>
    </qresource>
</RCC>

src/main.cpp

#include <QApplication>
#include <QQuickWidget>

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

    QQuickWidget widget;
    widget.setSource(QUrl("qrc:/main.qml"));
    widget.show();

        app.exec();
    return EXIT_SUCCESS;
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.14)

project(main LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt5 REQUIRED COMPONENTS 
    Core
        Gui 
    Widgets 
    Quick
    QuickWidgets
    Multimedia
    )

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

include_directories(${PROJECT_NAME}
    PRIVATE
    include
    )

set(SOURCES src/main.cpp)
qt_add_resources(SOURCES main.qrc)

add_executable(${PROJECT_NAME} ${SOURCES})

#link libraries to the project
target_link_libraries(${PROJECT_NAME}   
    PRIVATE 
    Qt5::Core
        Qt5::Gui
    Qt5::Widgets
        Qt5::Multimedia
    Qt5::Quick
    Qt5::QuickWidgets
    )


qt packages installed

qt5-qtbase/x11,now
qt5-qtdeclarative/x11,now
qt5-qtmultimedia/x11,now
qt5-qtx11extras/x11,now


then I had build with

mkdir build
cd build
cmake .. 
make -j


when I run ./main , it chashes with Segmentation fault

export DISPLAY=:1
./main


logcat

logcat *:W

logcat output

...
backtrace:
06-07 11:43:28.490 14927 14927 F DEBUG   :     #00 pc 0000000000003e94  /data/data/com.termux/files/usr/lib/libQt5MultimediaQuick.so.5.15.10 (offset 0xa000)
06-07 11:43:28.609 14927 14927 W crash_dump64: dlopen libaed.so fail: dlopen failed: library "libaed.so" not found
Biswa96 commented 3 months ago

I got segfault in libQt5MultimediaQuick.so.5.15.10 in my phone. The libaed.so file could be specific to your device vendor.

Biswa96 commented 3 months ago

I have rebuilt qt5-qtmultimedia and got the following output from the test program.

qrc:/main.qml:2:1: module "QtMultimedia" is not installed
     import QtMultimedia 5.11
     ^

qt5-qtmultimedia does not have some components. Could that be the reason for this issue?

https://github.com/termux/termux-packages/blob/d2cb5482fa8c74b2f4ff27286470991d2289c9b5/x11-packages/qt5-qtmultimedia/build.sh#L8

Did you try porting the program to qt6?

tiagolima123 commented 3 months ago

Qt6 worked, thank you!