>>1375808>>1375809I believe in order to use MozJPEG in termux with ffmpeg you need to build MozJPEG and then configure and install ffmpeg in order to be using it with Moz's support. You'' need clang make and probably yasm, and also git.
[code:lit]pkg install git make clang yasm[/code:lit]
clone moz repo
[code:lit]git clone
https://github.com/mozilla/mozjpeg.git[/code:lit]
cd inside
[code:lit]cd mozjpeg[/code:lit]
build and install it
[code:lit]autoreconf -fiv
./configure --prefix=/data/data/com.termux/files/usr
make
make install[/code:lit]
clone ffmpeg repo
[code:lit]cd ..
git clone
https://github.com/FFmpeg/FFmpeg.git[/code:lit]
cd into it with cd FFmpeg and build it with mozjpeg support
[code:lit]./configure --pkg-config-flags="--static" --extra-cflags="-I/data/data/com.termux/files/usr/include" --extra-ldflags="-L/data/data/com.termux/files/usr/lib" --enable-libmozjpeg --disable-shared
make[/code:lit]
when it's built you can use it from inside the folder like that:
[code:lit]./ffmpeg -i input.jpg -c:v mjpeg -q:v 80 output.jpg[/code:lit]
if you wanna use from anywhere you have to add it to bash PATH:
open .bashrc
[code:lit]nano $HOME/.bashrc[/code:lit]
add this to the end of the file:
[code:lit]export PATH="/path/to/ffmpeg:$PATH"[/code:lit]
save the file by pressing CTRL+O, enter to confirm and then CTRL+X to exit the nano editor.
then you can call it from a script like that:
[code:lit]CURRENT_DIR=$(pwd)
OUTPUT_DIR="$CURRENT_DIR/outputFolder"
mkdir -p "$OUTPUT_DIR"
for file in "$CURRENT_DIR"/*; do
if [[ -f "$file" && $(file -b --mime-type "$file" | grep -c '^image/') -eq >
filename=$(basename "$file")
extension="${filename##*.}"
output_image="$OUTPUT_DIR/${filename%.*}_converted.jpg"
ffmpeg -i "$file" -c:v mjpeg -q:v 80 "$output_image"
echo "Converted: $file"
fi
done
[/code:lit]
>takes the current directory>sets an output folder called outputFolder inside the current one>iterates through all items>converts them and saves them in the new dirit will work on all formats