Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make under Mint / Ubuntu has no playback and no audio #24

Open
fezzzza opened this issue May 16, 2024 · 6 comments
Open

Make under Mint / Ubuntu has no playback and no audio #24

fezzzza opened this issue May 16, 2024 · 6 comments

Comments

@fezzzza
Copy link

fezzzza commented May 16, 2024

Please add build instructions for popular distributions. I've used karlyriceditor on Windows for years but face problems crashing. Now I want to do away with my Windows VM and run native on Mint 21 = Ubuntu 22.04 = Debian 12.

From other issues posted here I gather the basic instructions are to install ffmpeg-devel and then all the other dependencies along the lines of:

apt install qtbase5-dev qtmultimedia5-dev libavutil-dev libavformat-dev libavcodec-dev openssl libswscale-dev libswresample-dev qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5

then run qmake
then run make

However, I can't find an install candidate for ffmpeg-devel or ffmpeg-dev, and so I get an error compiling at the make stage thus:

cd src/ && ( test -e Makefile || /usr/lib/qt5/bin/qmake -o Makefile /home/ferenc/karlyriceditor-master/src/src.pro ) && make -f Makefile 
make[1]: Entering directory '/home/ferenc/karlyriceditor-master/src'
g++ -c -pipe -O2 -Wall -Wextra -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/ffmpeg -I/usr/include/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtMultimedia -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o ffmpegvideoencoder.o ffmpegvideoencoder.cpp
In file included from ffmpegvideoencoder.cpp:33:
audioplayerprivate.h:25:10: fatal error: QAudioSink: No such file or directory
   25 | #include <QAudioSink>
      |          ^~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:888: ffmpegvideoencoder.o] Error 1
make[1]: Leaving directory '/home/ferenc/karlyriceditor-master/src'
make: *** [Makefile:47: sub-src-make_first] Error 2

...at least I assume this is down to not having ffmpeg-devel. I only have plain ffmpeg installed.

I have tried installing PPAs from savoury1 but find nothing listed there that can help.

I've also followed https://serverfault.com/questions/761992/unable-to-install-ffmpeg-php-on-ubuntu and installed all relevant -dev dependencies to no avail.

@fezzzza fezzzza changed the title No build instructions / failure to build under Ubuntu No build instructions / failure at make under Ubuntu May 16, 2024
@fezzzza fezzzza changed the title No build instructions / failure at make under Ubuntu No build instructions / make fails under Ubuntu May 16, 2024
@fezzzza
Copy link
Author

fezzzza commented May 17, 2024

I later noticed your comment on #12 , "On some distros libav and libsw are generally part of ffmpeg-devel**," so at least I now understand what's required. openssl-dev is not available on Ubuntu so I just have openssl for now, but I'm not convinced this is relevant to the matter in hand.

I discover that QAudioSink belongs to Qt6 and not Qt5, so I guess sometime since #12 (Feb 2022) we've moved on to Qt6? Changelog hasn't been updated since Dec 2016 but I see we went to Qt5 in Feb 2015, so a move to Qt6 was probably inevitable.

So I've installed Qt6, which has an install bug in Ubuntu (fix: https://askubuntu.com/questions/1460242/ubuntu-22-04-with-qt6-qmake-could-not-find-a-qt-installation-of ) and then installing the equivalent qt6 dependencies apt has thrown a dependency fit and so aptitude has uninstalled most of my laptop to realign the dependencies, but at least I have them now all installed. I still get the same error above.

It looks like QAudioSink is part of qt6-multimedia-dev, and that is installed correctly, along with libqt6multimedia6, libqt6multimediaquick6, and libqt6multimediawidgets6.

I have also tried installing Qt6 from the website and that hasn't helped at all.

@fezzzza
Copy link
Author

fezzzza commented Jun 28, 2024

I've now managed to get a compile working on a completely fresh install of Mint 21.3 = Ubuntu 22.04 = Debian 12. This also means that I have a pretty solid list of dependencies now because this was the first thing I did after installing Mint from scratch. Here's the steps that should work on Mint 21.3:

  1. Install the dependencies
apt install build-essential git libavutil-dev libavformat-dev libavcodec-dev libswscale-dev libswresample-dev qt6-base-dev qt6-multimedia-dev libqt6multimediawidgets6 libqt6multimedia6 libssl-dev libgl-dev
  1. Fix up Qt6 as per https://askubuntu.com/questions/1460242/ubuntu-22-04-with-qt6-qmake-could-not-find-a-qt-installation-of
  2. Fetch and compile:
git clone https://github.com/gyunaev/karlyriceditor.git
cd karlyriceditor
qmake
make

However, playback does not work at all so I can't insert timestamps. I can compile video of projects I worked on in my Windows VM, but when I do, audio is not included in the video. There is an audio stream on the video, but it is silent.

@fezzzza fezzzza changed the title No build instructions / make fails under Ubuntu Make under Mint / Ubuntu has no playback and no audio Jun 29, 2024
@gyunaev
Copy link
Owner

gyunaev commented Jul 1, 2024

Indeed Qt6 is required to build. As of "popular distros", its normally their job to build the packages, I don't want to maintain a package for Mint which I never used myself. It works on OpenSuSE just fine.

The crashes should be fixed in the latest Windows release.

@fezzzza
Copy link
Author

fezzzza commented Jul 1, 2024

Happy to report that under Windows 7, v3.2 does not crash like 2.3 and 3.0 used to, so I'll be using that for now. v3.3 requires DirectX 12 which is not supported on my Windows 7 VM afaik, but I have seen some mention of a special DX12 package existing somewhere I haven't been able to find it.

I had another bash at compiling under Mint with all the ffmpeg-dev libraries, not just those listed above, and all the Qt6-dev packages, and that made matters worse and I don't even get a successful compile now. I'll continue trying compiles on clean Mint VMs when I get time and will report back if I get any success.

@fezzzza
Copy link
Author

fezzzza commented Jul 4, 2024

Both problems solved.... well not solved, more like worked-around, so if anyone else wants to build on Mint / Ubuntu / Debian, here's what I found:

So it looks like the failure to compile is is essentially a versioning problem with ffmpeg, as the newer ffmpeg seems to require "Const AVOutputFormat" declarations and George seems to be aware of these when he's added them to fix Windows compilation but in doing so has broken some linux distros. Linux Mint 21.3 is still distributing ffmpeg 4.4.2 so the old syntax is required. Interestingly, I was able to compile in Ubuntu 24 and Debian 12 without this issue.

So just one change needs to be made on line 67 of ffmpegvideoencoder.cpp

const AVOutputFormat * outputFormat;

just needs to be

AVOutputFormat * outputFormat;

I was only able to compile on a freshly installed Linux Mint 21.3 VM and before apt update / apt upgrade, which then brings other updates that cause it to break. On a fully upgraded mint 21.3 I get a load of compilation errors such as:

ffmpegvideoencoder.cpp:387:24: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channels’ 387 | audioCodecCtx->channels = m_profile->channels; | ^~~~~~~~

Now to the failure to export audio to video (also mentioned in #23).

On exporting video to AVI, ffmpeg complains to the terminal with:

[mp2 @ 0c55b15df23200] frame size (1152) was not respected for a non-last frame
Could not send packet for encoding (error '-22')

Exporting to to mp4 gives a dialog box:

Cannot create video file: Could not find the sample format supported by the audio codec ac3; supported:7

Changing videoencodingprofiles.cpp so that
p.audioCodec = "aac"
ffmpeg complains:

[aac @ 0x55a97af1b040]more samples than frame size Could not send packet for encoding (error '22')

So the only one that seems to work is libmp3lame. So the workaround is:

in videoencodingprofiles.cpp:
find the profile you want to use and change the:
p.audioCodec = "libmp3lame";

I've updated the build instructions in my second post above with the correct dependencies which should give you a successful build on a freshly installed Mint 21.3

@dvalenca
Copy link

wor

I've now managed to get a compile working on a completely fresh install of Mint 21.3 = Ubuntu 22.04 = Debian 12. This also means that I have a pretty solid list of dependencies now because this was the first thing I did after installing Mint from scratch. Here's the steps that should work on Mint 21.3:

1. Install the dependencies
apt install build-essential git libavutil-dev libavformat-dev libavcodec-dev libswscale-dev libswresample-dev qt6-base-dev qt6-multimedia-dev libqt6multimediawidgets6 libqt6multimedia6 libssl-dev libgl-dev
2. Fix up Qt6 as per https://askubuntu.com/questions/1460242/ubuntu-22-04-with-qt6-qmake-could-not-find-a-qt-installation-of

3. Fetch and compile:
git clone https://github.com/gyunaev/karlyriceditor.git
cd karlyriceditor
qmake
make

However, playback does not work at all so I can't insert timestamps. I can compile video of projects I worked on in my Windows VM, but when I do, audio is not included in the video. There is an audio stream on the video, but it is silent.

Worked for me! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants