QtAV
QtAV copied to clipboard
Can not copy codec properties when it's open
QtAV, Qt 5.15.0 and macOS Catalina
Compress video using FFmpeg via QtAV
Hello! Check the logs below, please. The program crashes after execution!
I have asked a question here before, but it has not been solved. So, now I have some new logs to you, check the logs and new information. Help me to fix the problem! or show me a sample of video scaling :)
AudioQueue is not created. skip close
Log file
QtAV 1.13.0(Sep 8 2020, 20:42:26)
Multimedia framework base on Qt and FFmpeg.
Distributed under the terms of LGPLv2.1 or later.
Shanghai, China Copyright (C) 2012-2019 Wang Bin (aka. Lucas Wang) [email protected]
Donate: http://qtav.org/donate.html
Source: https://github.com/wang-bin/QtAV
Home page: http://qtav.org
"video thread gets an eof packet."
"(repeat 1)video thread gets an eof packet.\nwaiting audio thread......."
"audio thread gets an eof packet. pkt.pts: -1.000, d.render_pts0:-1.000"
"[AudioDecoder] got_frame_ptr=false. decoded: 0, un: 3 Undefined error: 0"
"Decode audio failed. undecoded: 3"
"audio decode eof done"
"Audio thread stops running..."
"waiting video thread......."
"video thread gets an eof packet."
"(repeat 2)video thread gets an eof packet.\nno frame could be decompressed: Undefined error: 0 3/3"
"video decode eof done. d.render_pts0: -1.000"
"video thread gets an eof packet."
"no frame could be decompressed: Undefined error: 0 3/3"
"video decode eof done. d.render_pts0: -1.000"
"Video thread stops running..."
"Demux thread stops running...."
"demuxer thread emit finished. repeat: 0/0"
"avplayer emit stopped()"
"About finish video encoding"
**"Can not copy codec properties when it's open"**
"(repeat 1)Can not copy codec properties when it's open\nclosing d->format_ctx"
"no packet got"
"AVTranscoder stopped"
"Not playing~"
"(repeat 1)Not playing~\n~~~~~~~~~resetGL 0x7fcc62c87b60. from sender 0x7fcc62eed380"
"Not playing~"
"AudioQueue is not created. skip close"
"(repeat 1)AudioQueue is not created. skip close\nNot playing~"
"~AVThreadPrivate wake up paused thread"
And here my codes:
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtAV>
#include <QtAVWidgets>
#include <QtAV/AVTranscoder.h>
#include <QtAV/VideoEncoder.h>
#include <QtAV/AudioEncoder.h>
#include <QtDebug>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
// QtAV::Widgets::registerRenderers();
QtAV::setLogLevel(QtAV::LogLevel::LogAll);
QtAV::AVPlayer player;
QtAV::LibAVFilter *mVideoFilter;
const QString cv = QString::fromLatin1("mpeg4");
QString outFile = QString::fromLatin1("out.MOV");
mVideoFilter = new QtAV::LibAVFilterVideo(&player);
mVideoFilter->setOptions("scale=320:240");
QtAV::AVTranscoder avt;
player.setFile("IMG_0630.MOV");
player.setFrameRate(10000.0);
player.audio()->setBackends(QStringList() << QString::fromLatin1("null"));
avt.setMediaSource(&player);
avt.setOutputFormat("mp4");
avt.setOutputMedia(outFile);
if (!avt.createVideoEncoder()) {
qWarning("Failed to create video encoder");
return 1;
}
QtAV::VideoEncoder *venc = avt.videoEncoder();
venc->setCodecName(cv);
venc->setBitRate(1024*1024);
QObject::connect(&avt, SIGNAL(stopped()), qApp, SLOT(quit()));
avt.setAsync(true);
avt.start();
player.play();
QQmlApplicationEngine engine;
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);
return app.exec();
}