Avidemux 2.8.x with Qt6 GUI

現在の Avidemux2 は安定版バージョンは 2.8.1 だが、頻繁に更新とバグフィックスが行われている。
少し前まではデフォルトのQT GUIフロントエンドは Qt5 だったが、今現在(2025年3月)は Qt6 が
GUIのデフォルトになっている。

今回、これまで Qt5ベースのGUIフロントエンドでコンパイルしていたスクリプトを見直して
Qt6版のスクリプト(avidemux.SlackBuild)にしてみた。

ベーススクリプトは AlienBoB (Eric Hameleers)氏のスクリプトを元にしている。
Thanks to Eric for your  excellent script.


Git source からパッケージ作成用の TarBall を作ってからスクリプトを走らせる。

fetch-the-latest-git-master.sh
[code]
:#!/bin/bash
#
# [2024-07-13] : new by J_W
# [2025.03.06] : update

MAINVER="2.8.2"
# Read date
echo -n DATE(yyyymmdd):
read DATE

# Download  git-master source
git clone https://github.com/mean00/avidemux2.git
# manipulate the commit number
COMMIT=$(cat avidemux2/.git/refs/heads/master)
COMMIT_SHORT_NBR=$(awk '{ print substr($1,1,7) }' avidemux2/.git/refs/heads/master)

# create tar.xz
mv avidemux2 avidemux_${MAINVER}_${DATE}_${COMMIT_SHORT_NBR}
tar cJvf avidemux_${MAINVER}_${DATE}_${COMMIT_SHORT_NBR}.tar.xz avidemux_${MAINVER}_${DATE}_${COMMIT_SHORT_NBR}/
rm -rf avidemux_${MAINVER}_${DATE}_${COMMIT_SHORT_NBR}
#
echo "Done..."


screen shot
Avidemux2_GUI_about

Avidemux2_encode_plugins


avidemux.SlackBuild
[code]
#!/bin/sh
# $Id: avidemux.SlackBuild,v 1.19 2021/12/29 15:38:00 root Exp root $
# Copyright 2009, 2010, 2011, 2013, 2017, 2021  Eric Hameleers, Eindhoven, NL
# All rights reserved.
#
#   Permission to use, copy, modify, and distribute this software for
#   any purpose with or without fee is hereby granted, provided that
#   the above copyright notice and this permission notice appear in all
#   copies.
#
#   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
#   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
#   IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
#   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#   SUCH DAMAGE.
# -----------------------------------------------------------------------------
#
# 2.8.2_20250306_71f5a15 update git source   commit:71f5a15(2025-03-06) -- Compiled "Qt6 Gui"
#
# Run 'sh avidemux.SlackBuild' to build a Slackware package.
# The package (.txz) and .txt file as well as build logs are created in /tmp .
# Install it using 'installpkg'.
#
# -----------------------------------------------------------------------------

# Set initial variables:
cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=
avidemux
MAJOR_VER=${VERSION:-
2.8.2}
DATE=${DATE:-
20250306}
COMMIT_VER=${COMMIT_VER:-
71f5a15}
VERSION=
${MAJOR_VER}_${DATE}_${COMMIT_VER}
I18N_COMMIT=${I18N_COMMIT:-
4d2693414068eb60ed9eea5720d8fa916ac7ab1a}
BUILD=${BUILD:-2}
NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
#NUMJOBS=${NUMJOBS:-" -j$(nproc) "}
TAG=${TAG:-jw}
#LC_MESSAGE_VER=${LC_MESSAGE_VER:-"20240316"}

DOCS="AUTHORS COPYING License.txt scripts"

# Where do we look for sources?
SRCDIR=$CWD

# Place to build (TMP) package (PKG) and output (OUTPUT) the program:
TMP=${TMP:-/tmp/build}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

SOURCE=$CWD/${PRGNAM}_${VERSION}.tar.xz
#SRCURL="https://github.com/mean00/avidemux2/releases/download/2.8.1/avidemux_2.8.1.tar.gz"

##
## --- with a little luck, you won't have to edit below this point --- ##
##

# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
  case "$(uname -m)" in
    i?86) ARCH=i586 ;;
    arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
    # Unless $ARCH is already set, use uname -m for all other archs:
    *) ARCH=$(uname -m) ;;
  esac
  export ARCH
fi

# Set CFLAGS/CXXFLAGS and LIBDIRSUFFIX:
case "$ARCH" in
  i?86)      SLKCFLAGS="-O2 -march=${ARCH} -mtune=i686"
             SLKLDFLAGS=""; LIBDIRSUFFIX=""
             ;;
  x86_64)    SLKCFLAGS="-O2 -fPIC"
             SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64"
             ;;
  armv7hl)   SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16"
             SLKLDFLAGS=""; LIBDIRSUFFIX=""
             ;;
  *)         SLKCFLAGS=${SLKCFLAGS:-"-O2"}
             SLKLDFLAGS=${SLKLDFLAGS:-""}; LIBDIRSUFFIX=${LIBDIRSUFFIX:-""}
             ;;
esac

case "$ARCH" in
    arm*)    TARGET=$ARCH-slackware-linux-gnueabi ;;
    *)       TARGET=$ARCH-slackware-linux ;;
esac

# Exit the script on errors:
set -e
trap 'echo "$0 FAILED at line ${LINENO}" | tee $OUTPUT/error-${PRGNAM}.log' ERR
# Catch unitialized variables:
set -u
P1=${1:-1}

# Save old umask and set to 0022:
_UMASK_=$(umask)
umask 0022

# Create working directories:
mkdir -p $OUTPUT          # place for the package to be saved
mkdir -p $TMP/tmp-$PRGNAM # location to build the source
mkdir -p $PKG             # place for the package to be built
rm -rf $PKG/*             # always erase old package's contents
rm -rf $TMP/tmp-$PRGNAM/* # remove the remnants of previous build
rm -rf $OUTPUT/{configure,make,install,error,makepkg,patch}-$PRGNAM.log
rm -rf $OUTPUT/{build*-$PRGNAM.log
                          # remove old log files

# --- PACKAGE BUILDING ---

echo "++"
echo "|| $PRGNAM-$VERSION"
echo "++"

cd $TMP/tmp-$PRGNAM
echo "Extracting the source archive(s) for $PRGNAM..."
tar -xvf ${SOURCE}

cd ${PRGNAM}_${VERSION}/avidemux/qt4/i18n
tar --strip-components=1 -xvf $CWD/avidemux2_i18n-${I18N_COMMIT}.tar.gz
cd ../../../

#  [ADM_demuxers/Mp4] index to file option #521 ; https://github.com/mean00/avidemux2/commit/60145f65297b6439ffbc139f580214c0f5b2115a
#patch -p1 < $SRCDIR/patches/0005-ADM_demuxers_Mp4_index-to-file-option.patch

chown -R root:root .
chmod -R u+w,go+r-w,a+rX-st .

# Thanks FreeBSD guys!
[[ "$ARCH" = "i586" ]] && patch -p0 < $CWD/patches/
extra-patch-i386-nosse.patch

#sed -i 's|../avidemux/qt4|../avidemux/qt4 -DLRELEASE_EXECUTABLE=/usr/bin/lrelease-qt5|' bootStrap.bash || exit 1
# We use a much more recent FriBiDi library:
sed -i 's|0.19|1.0|' avidemux_plugins/ADM_videoFilters6/ass/CMakeLists.txt || exit 1

# Apply bootStrap patch for fix Qt6 build (Thanks to kgha at slackware forum )
patch -p1 < $CWD/patches/
0001_fix_BUILDTOP_in_bootstrap.bash.patch
patch -p1 < $CWD/patches/
0006_bootStrap-CXXFLAGS.patch

# Fix org.avidemux.Avidemux.desktop for Qt6
patch -p1 < $CWD/patches/
0008_org.avidemux.Avidemux.desktop_Qt6.diff

# Since the internal FFmpeg version is "7.0.2", we do not need this nv-codec-headers patch, now.
#mkdir -p avidemux_core/ffmpeg_package/patches/upstream
#cp $CWD/0004-support-nv-codec-headers-12.2.patch avidemux_core/ffmpeg_package/patches/upstream

# Apply x265-4.1.diff patch from SBo
# Thanks Willy Sudiarto Raharjo of SBo team
#patch -p1 < $CWD/x265-4.1.diff --verbose || exit 1

echo "Building..."
NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}

# The Qt6 gui is the default now:
bash bootStrap.bash \
  2>&1 | tee $OUTPUT/configure-${PRGNAM}.log

# Install
cp -a install/* $PKG/

# Add an icon for the menu entry:
install -D -m0644 avidemux_icon.png $PKG/usr/share/pixmaps/avidemux.png

# Install the man page:
install -D -m0644 man/avidemux.1 -t $PKG/usr/man/man1

# Add this to the doinst.sh:
! [ -d $PKG/install ] && mkdir -p $PKG/install
cat <<EOT >> $PKG/install/doinst.sh
# Update the desktop database:
if [ -x usr/bin/update-desktop-database ]; then
  chroot . /usr/bin/update-desktop-database /usr/share/applications > /dev/null 2>&1
fi

# Update hicolor theme cache:
if [ -d usr/share/icons/hicolor ]; then
  if [ -x /usr/bin/gtk-update-icon-cache ]; then
    chroot . /usr/bin/gtk-update-icon-cache -f -t usr/share/icons/hicolor 1> /dev/null 2>&1
  fi
fi

# Update the mime database:
if [ -x usr/bin/update-mime-database ]; then
  chroot . /usr/bin/update-mime-database usr/share/mime >/dev/null 2>&1
fi

EOT

# Fix org.avidemux.Avidemux.desktop for Qt6
#sed -i 's/avidemux3_qt5/avidemux3_qt6/g' $PKG/usr/share/applications/org.avidemux.Avidemux.desktop

# Add documentation:
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION || true
cat $SRCDIR/$(basename $0) > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/patches

cp -a $SRCDIR/patches/0001_fix_BUILDTOP_in_bootstrap.bash.patch $PKG/usr/doc/$PRGNAM-$VERSION/patches/ || true
cp -a $SRCDIR/patches/0006_bootStrap-CXXFLAGS.patch $PKG/usr/doc/$PRGNAM-$VERSION/patches/ || true
cp -a $SRCDIR/patches/extra-patch-i386-nosse.patch $PKG/usr/doc/$PRGNAM-$VERSION/patches/ || true
cp -a $SRCDIR/patches/0008_org.avidemux.Avidemux.desktop_Qt6.diff $PKG/usr/doc/$PRGNAM-$VERSION/patches/ || true

chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION
find $PKG/usr/doc -type f -exec chmod 644 {} \;

# Compress the man page(s):
if [ -d $PKG/usr/man ]; then
  find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
  for i in $(find $PKG/usr/man -type l -name "*.?") ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
fi

# Strip binaries:
find $PKG | xargs file | grep -e "executable" -e "shared object" \
  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null

# Add a package description:
mkdir -p $PKG/install
cat $SRCDIR/slack-desc > $PKG/install/slack-desc
cat $SRCDIR/slack-required > $PKG/install/slack-required

# Build the package:
cd $PKG
makepkg --linkadd y --chown n $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.txz 2>&1 | tee $OUTPUT/makepkg-${PRGNAM}.log
cd $OUTPUT
md5sum ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.txz > ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.txz.md5
cd -
cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.txt
cat $PKG/install/slack-required > $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.dep

# Restore the original umask:
umask ${_UMASK_}


slack-desc
[code]
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in.  You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

        |-----handy-ruler------------------------------------------------------|
avidemux: avidemux (versatile video editor with a Qt gui)
avidemux:
avidemux: Avidemux is a free video editor designed for simple cutting
avidemux: filtering and encoding tasks.It supports many file types,
avidemux: including AVI, DVD compatible MPEG files, MP4 and ASF, using
avidemux: a variety of codecs. Tasks can be automated using projects,
avidemux: job queue and powerful scripting capabilities.
avidemux:
avidemux:
avidemux: Avidemux home: http://avidemux.org/
avidemux:


0001_fix_BUILDTOP_in_bootstrap.bash.patch
[code]
--- a/bootStrap.bash    2025-03-06 11:19:46.940437964 +0900
+++ b/bootStrap.bash    2025-03-06 11:47:07.604861922 +0900
@@ -351,20 +351,4 @@
 fi
 
 echo "** Packaging **"
-cd "${BUILDTOP}"
-if [ "x$packages_ext" = "x" ]; then
-  echo "No packaging"
-else
-  echo -e "${GREEN}Preparing packages${ENDCOLOR}"
-  rm -Rf "${packages_dir}"
-  mkdir "${packages_dir}"
-  find . -name "*.$packages_ext" | grep -vi cpa | xargs cp -t "${packages_dir}"
-  echo "** ${packages_dir} directory ready **"
-  ls -l "${packages_dir}"
-fi
 echo "** ALL DONE **"
-if [ "x$packages_ext" = "x" ]; then
-  echo "** Copy the folder \"${FAKEROOT_DIR}\" to your favorite location, i.e. sudo cp -R install/usr/* /usr/ **"
-else
-  echo "** Installable packages are in the ${packages_dir} folder **"
-fi

0006_bootStrap-CXXFLAGS.patch
[code]
--- a/bootStrap.bash    2025-02-15 11:23:21.875284589 +0100
+++ b/bootStrap.bash    2025-02-15 10:47:13.000000000 +0100
@@ -78,6 +78,7 @@
     mkdir "${BUILDDIR}" || fail "creating build directory"
   fi
   pushd "${BUILDDIR}" >/dev/null
+  CXXFLAGS+=" -fPIC" \
   cmake \
     $COMPILER \
     $PKG \


0008_org.avidemux.Avidemux.desktop_Qt6.diff
[code]
--- a/avidemux/qt4/xdg_data/org.avidemux.Avidemux.desktop    2025-03-06 15:15:09.084590154 +0900
+++ b/avidemux/qt4/xdg_data/org.avidemux.Avidemux.desktop    2025-03-06 15:14:40.877539662 +0900
@@ -1,8 +1,10 @@
 [Desktop Entry]
 Name=Avidemux
+Name[ja]=Avidemux (ビデオ編集GUIツール)
 GenericName=Video Editor
+GenericName[ja]=Video Editor (ビデオエディター)
 Comment=Multiplatform video editor
-Exec=avidemux3_qt5 %f
+Exec=avidemux3_qt6 %f
 Icon=org.avidemux.Avidemux
 Terminal=false
 Type=Application


extra-patch-i386-nosse.patch
[code]
--- avidemux/common/ADM_audioFilter/src/ADM_soundtouch/STTypes.h.orig    2022-09-17 13:59:16 UTC
+++ avidemux/common/ADM_audioFilter/src/ADM_soundtouch/STTypes.h
@@ -153,11 +153,6 @@ namespace soundtouch
         // efficient autovectorization
         typedef float LONG_SAMPLETYPE;
 
-        #ifdef SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS
-            // Allow SSE optimizations
-            #define SOUNDTOUCH_ALLOW_SSE       1
-        #endif
-
     #endif  // SOUNDTOUCH_INTEGER_SAMPLES
 

     #if ((SOUNDTOUCH_ALLOW_SSE) || (__SSE__) || (SOUNDTOUCH_USE_NEON))




===