Skip to content
  • 0 Votes
    1 Posts
    136 Views
    No one has replied
  • 0 Votes
    3 Posts
    116 Views
    K

    @Cleiton-Bueno

    Command output:

    PACKAGECONFIG="gstreamer alsa gstreamer" PACKAGECONFIG_CONFARGS=" -alsa -gstreamer 1.0 -no-feature-openal -no-pulseaudio" PACKAGECONFIG_OPENSSL="openssl"

    @edit

    I also discovered that there is no "qmlgl" (qmlgloverlay, qmlglsink, qmlglsrc) in the system which should be provided by gstreamer1.0-plugins-good. I forced to build packet configurated for qt5 by add line in my local.conf:

    PACKAGECONFIG:append:pn-gstreamer1.0-plugins-good = " qt5"

    After that I have available qmlglsink and other. I still can't play video directly from file because effect is the same no image. I tried to build pipeline:

    source: "gst-pipeline: filesrc location=/home/root/dillama_1080p.mp4 ! decodebin name=dec ! videoconvert ! qmlglsink widget"

    I can't set required pointer to qml widget for qmlglsink. How do it?

  • 0 Votes
    4 Posts
    147 Views
    C

    @Saviz The example does not come copy-n-paste from the docs, it comes from reading the docs.

    This will list all the combinations that are possible on the running platform concerned:

    #include <QCoreApplication> #include <QDebug> #include <QMediaFormat> int main(int argc, char **argv) { QCoreApplication app(argc, argv); const QList<QMediaFormat::FileFormat> containers = { QMediaFormat::WMA, QMediaFormat::AAC, QMediaFormat::Matroska, QMediaFormat::WMV, QMediaFormat::MP3, QMediaFormat::Wave, QMediaFormat::Ogg, QMediaFormat::MPEG4, QMediaFormat::AVI, QMediaFormat::QuickTime, QMediaFormat::WebM, QMediaFormat::Mpeg4Audio, QMediaFormat::FLAC }; const QList<QMediaFormat::AudioCodec> audioCodecs = { QMediaFormat::AudioCodec::WMA, QMediaFormat::AudioCodec::AC3, QMediaFormat::AudioCodec::AAC, QMediaFormat::AudioCodec::ALAC, QMediaFormat::AudioCodec::DolbyTrueHD, QMediaFormat::AudioCodec::EAC3, QMediaFormat::AudioCodec::MP3, QMediaFormat::AudioCodec::Wave, QMediaFormat::AudioCodec::Vorbis, QMediaFormat::AudioCodec::FLAC, QMediaFormat::AudioCodec::Opus, QMediaFormat::AudioCodec::Unspecified }; const QList<QMediaFormat::VideoCodec> videoCodecs = { QMediaFormat::VideoCodec::VP8, QMediaFormat::VideoCodec::MPEG2, QMediaFormat::VideoCodec::MPEG1, QMediaFormat::VideoCodec::WMV, QMediaFormat::VideoCodec::H265, QMediaFormat::VideoCodec::H264, QMediaFormat::VideoCodec::MPEG4, QMediaFormat::VideoCodec::AV1, QMediaFormat::VideoCodec::MotionJPEG, QMediaFormat::VideoCodec::VP9, QMediaFormat::VideoCodec::Theora, QMediaFormat::VideoCodec::Unspecified }; for (const auto &c : containers) { QMediaFormat format(c); for (const auto &v : videoCodecs) { format.setVideoCodec(v); for (const auto &a : audioCodecs) { format.setAudioCodec(a); if (format.isSupported(QMediaFormat::Encode)) { qDebug() << QMediaFormat::fileFormatName(c) << "(" << QMediaFormat::videoCodecName(v) << ", " << QMediaFormat::audioCodecName(a) << ")"; } } } } return 0; }

    If you only want to support "closely aligned" combinations then only check those.

    There's no direct connection between the container format and the name of the file it is contained in. This is done purely by convention. If you want to put an MPEG4 container with audio-only in a file called blah.acc then go right ahead. Most players, I assume, only use this as a hint as to the file content and actually read the content to determine what is sane to do.

  • 0 Votes
    11 Posts
    401 Views
    S

    @SGaist That is correct. The same application tested on different Windows machines presents exactly the same behavior.

  • 0 Votes
    3 Posts
    203 Views
    J

    @Bonnie Thank you for the reply.

    Since my last post, I made some significant progress by debugging the Windows Qt multimedia source. I swapped QBuffer for a QRingBuffer. As it turns out, the performance issues were not related to the QBuffer in my previous implementation, however I prefer to use a lighter weight object as the Single Producer Single Consumer (SPSC) buffer between the microphone (the default input device) and the speaker (the default output device).

    The remaing problem that I need help with is how to schedule a restart after I encounter a buffer underrun or Eof condition (where there are no bytes available in the SPSC buffer).

    I swapped QBuffer for Qt's private QRingBuffer class which is used in other multimedia QIODevice derived objects. This class is not really well documented but it is relatively straight forward to understand - this link shows the impmentation). The ring buffer is basically made up from a list of RingChunks - each of which is effectively a wrapper around a QByteArray (with supporting head and tail offsets).

    The problem now is that I once the pull mode AudioSink encounters an error in its timer callback method - in this case the pullSource method (see below for Qt's windows AudioSink implementation) (QWindowsAudioSink::pullSource), the audio output changes its state to QAudio::IdleState with QAudio::IOError or QAudio::UnderrunError, and stops the pull timer. The pull timer callback is resposible for requesting the next raw chunk of audio from the QRingBuffer via the m_pullSource->read(readLen)) and writing it to the speaker ourput device. Meanwhile the capture slot in my worker thread keeps appending microphone data to this shared mpSinkDevice - so the buffer keeps growing (which would prevent the buffer underrun/eof condition) but I have no idea how to restart the audio output.

    void RtpWorker::handleAudioAvailable(const QAudioBuffer& rAudioBuffer) const { // append captured audio to mpSinkDevice's QRingBuffer mpSinkDevice->write(rAudioBuffer.constData< const char>(), rAudioBuffer.byteCount()); }

    The m_pullSource field in the code below is a pointer to the QIODevice containing the QRingBuffer which was opened for Read/Write (write is required by the audio capture slot to copy the raw audio from the microphone to the QRingBuffer).

    void QWindowsAudioSink::pullSource() { qCDebug(qLcAudioOutput) << "Pull source"; if (!m_pullSource) return; auto bytesAvailable = m_pullSource->isOpen() ? qsizetype(m_pullSource->bytesAvailable()) : 0; auto readLen = qMin(bytesFree(), bytesAvailable); if (readLen > 0) { QByteArray samples = m_pullSource->read(readLen); if (samples.size() == 0) { deviceStateChange(QAudio::IdleState, QAudio::IOError); return; } else { write(samples.data(), samples.size()); } } auto playTimeUs = remainingPlayTimeUs(); if (playTimeUs == 0) { deviceStateChange(QAudio::IdleState, m_pullSource->atEnd() ? QAudio::NoError : QAudio::UnderrunError); } else { deviceStateChange(QAudio::ActiveState, QAudio::NoError); m_timer->start(playTimeUs / 2000); } }

    Here is my SinkDevice

    //! Modeled after the Generator class example from QT 6.x audio output example. class SinkDevice : public QIODevice { Q_OBJECT public: /** * Explicit constructor * * @param parent [in] parent. */ explicit SinkDevice(QObject* parent = nullptr) : QIODevice(parent) , mBuffer{} {} /** * Explicit constructor * * @param rByteArray [in] array of multi-channel audio * samples. * @param parent [in] parent. */ explicit SinkDevice(const QByteArray& rByteArray, QObject* parent = nullptr) : QIODevice(parent) , mBuffer{} { mBuffer.append(rByteArray); } ~SinkDevice() override = default; /** * Start the IO device - open in read/write mode * so it can act like a ring buffer. */ void start(); /** * Close IO device. */ void stop(); //! Audio device should give sequential access [[nodiscard]] bool isSequential() const override { return true; } [[nodiscard]] qint64 bytesAvailable() const override { return mBuffer.size() + QIODevice::bytesAvailable(); } // Our size [[nodiscard]] qint64 size() const override { return mBuffer.size(); } protected: [[nodiscard]] qint64 readData(char* data, qint64 maxlen) override; [[nodiscard]] qint64 writeData(const char* data, qint64 maxlen) override; private: // disable copy & move semantics on QObject subclasses // https://www.cleanqt.io/blog/why-qobject-subclasses-are-not-copyable Q_DISABLE_COPY_MOVE(SinkDevice) void generateData(const QAudioFormat& format, qint64 durationUs, int sampleRate); QRingBuffer mBuffer; };
  • 0 Votes
    2 Posts
    111 Views
    D

    OK, I found the cause of the problem. Well, the problem is the right combination of codec, format and QMediaRecorder configuration. In the case of my systems, it turned out that they do not support WAV. Using AAC and a bitrate of 256kbit solved the problem. Previously I tried with AAC and 320kbit but the codec does not work with such a high bitrate and there was no error message.

  • 0 Votes
    5 Posts
    316 Views
    S

    @mzimmers Yes, I am sure that the url is pointing to the correct source. In fact what seems strange is that the first time I call setPosition it works, but any other time, regardless of the url being identical or changed to point to a different file, it ends up being in the StalledMedia state.

  • 0 Votes
    4 Posts
    341 Views
    SGaistS

    I would check the internals of the other platform plugins to see how they are used by these classes.

  • 0 Votes
    2 Posts
    424 Views
    J

    I'm hoping for an answer on this. Here is a screenshot of the QT Maintenance Tool.

    Shouldn't I see a way to install the QT Multimedia component here? I have a red arrow where I would have assumed I'd see it (I've seen examples on the web with screenshots showing it.) I have 6.3.1 installed.

    qt_maintain_qt.jpg

    Thanks,
    ...John

  • 0 Votes
    3 Posts
    326 Views
    B

    @Chris-Kawa said in QMediaRecorder(QMediaFormat) not support wave format:

    Is that on Windows? By default Qt uses Windows Media Foundation backend, which does support PCM audio in WAV containers, but for some reason this format doesn't seem to be mentioned in the windows platform plugin. I don't know if it's a omission by mistake or intentional. You might want to ask the developers on the mailing list.

    Qt 6.4 introduced experimental ffmpeg backend that seems to at least mention this format in the code. It's a technology preview, so you might need to compile it yourself though. Target platform and backend notes.

    Yes, I use Qt6.2.4 on Win 11.

    Thanks for you reply.

  • 0 Votes
    4 Posts
    237 Views
    F

    @SGaist looking at the QCamera example gave me a lot of info to fix my issue.
    I was using the QCamera wrongly.
    Too many start/stop followed by lock/unlock etc.
    Now the image is captured correctly.

  • 0 Votes
    1 Posts
    142 Views
    No one has replied
  • 0 Votes
    1 Posts
    176 Views
    No one has replied
  • 0 Votes
    3 Posts
    448 Views
    R

    @GrecKo It does, but it seems to be a read-only reflection of the viewport set for the video frame objects that are coming through the videoSink. When I attempt to assign to it, I get the QML error: Invalid property assignment: "sourceRect" is a read-only property. The docs do not appear to reflect the fact that sourceRect is read-only. I am using Qt 6.3.

    Looking at the source for VideoOutput (https://github.com/qt/qtmultimedia/blob/37c2d097eb5dd8671cc752dc920da11d66105905/src/multimediaquick/qquickvideooutput_p.h#L41), we can see that the Q_PROPERTY for sourceRect is read-only in both the 6.3 and dev branches.

    I have had the thought of attempting to manually set the viewport of the QVideoFrameFormat of the frames coming through the VideoOutput's videoSink, but I haven't created a working solution for that strategy yet.

  • 0 Votes
    4 Posts
    400 Views
    Christian EhrlicherC

    Since 5.15.5 is a commercial version you should ask the Qt support for help.

  • 0 Votes
    1 Posts
    200 Views
    No one has replied
  • 1 Votes
    2 Posts
    295 Views
    J

    ok looks like I've stumbled upon https://bugreports.qt.io/browse/QTBUG-86896

  • 0 Votes
    6 Posts
    768 Views
    P

    @SGaist i just used an older version of qt(5.12 instead of 6.1.2), and it worked

  • 0 Votes
    1 Posts
    294 Views
    No one has replied
  • 0 Votes
    5 Posts
    1k Views
    F

    Thanks for sharing this information. It's really helpful. Do i need a gmail account created from gmail accounts free list for playing this playlist?