Truth Matters! Index

A Judaizing Christian Anti-Romanizing Protestant Forum

You are not logged in.

Announcement

"I mock only with my feeble mockery, so that those who live now, AND THOSE WHO COME AFTER US, SHALL KNOW WHAT I HAVE THOUGHT ABOUT THE POPE, THE ACCURSED ANTICHRIST, and so that anyone who wishes to be a Christian can be WARNED AGAINST SUCH AN ABOMINATION." - Martin Luther 1545 - Against the Papacy in Rome, founded by the Devil, page 16.

#1 2025-07-05 00:32:25

Darkijah
Admin
From: Danmark
Registered: 2021-10-13
Posts: 55
Website
LinuxChrome 137.0

FFmpeg

#!/bin/bash

# Output directory
mkdir -p av1-c30c5g60k30Loadnorm

# Function to encode a single file
encode_video() {
  input="$1"
  filename="${input%.*}"
  output="av1-c30c5g60k30Loadnorm/${filename}.mp4"
  echo "#### ENCODING: $input → $output"
  ffmpeg -hide_banner -loglevel warning -y \
    -i "$input" \
    -c:v libaom-av1 -crf 30 -b:v 0 -cpu-used 5 -g 60 -keyint_min 30 \
    -movflags +faststart \
    -c:a libopus -b:a 128k \
    -af "loudnorm=I=-14:LRA=11:TP=-2" \
    "$output"
}

export -f encode_video

# Run with GNU parallel (2 jobs at a time)
find . -maxdepth 1 -type f \( -iname "*.mp4" -o -iname "*.m4a" -o -iname "*.mkv" -o -iname "*.webm" -o -iname "*.avi" -o -iname "*.flv" \) \
  | parallel -j 2 encode_video {}

echo "#### ✅ ALL VIDEOS PROCESSED WITH AV1, LOUDNORM, FASTSTART, AND PARALLEL (2 JOBS). ####"

Added later 49 min 54 s:

#!/bin/bash

mkdir -p av1-c30c5g60k30Loadnorm

encode_video() {
  input="$1"
  filename="${input%.*}"
  output="av1-c30c5g60k30Loadnorm/${filename}.mp4"
  echo "#### ENCODING: $input → $output"

  ffmpeg -hide_banner -loglevel warning -y \
    -i "$input" \
    -c:v libaom-av1 -crf 30 -b:v 0 -cpu-used 5 -g 60 -keyint_min 30 \
    -movflags +faststart \
    -c:a copy \
    "$output"
}

export -f encode_video

# Run 2 in parallel using find and parallel
find . -maxdepth 1 -type f \( -iname "*.mp4" -o -iname "*.mkv" -o -iname "*.webm" -o -iname "*.avi" -o -iname "*.flv" -o -iname "*.m4a" \) -print0 \
  | parallel -0 -j 2 encode_video

echo "#### ✅ DONE: ALL FILES ENCODED WITH AV1 (VIDEO ONLY), AUDIO COPIED. ####"

Added later 1 h 03 min 55 s:

#!/bin/bash

mkdir -p av1-c30c5g60k30Loadnorm

find . -maxdepth 1 -type f \( -iname "*.mp4" -o -iname "*.mkv" -o -iname "*.webm" -o -iname "*.avi" -o -iname "*.flv" -o -iname "*.m4a" \) -print0 \
| parallel -0 -j 2 bash -c '
  for input; do
    filename="${input%.*}"
    output="av1-c30c5g60k30Loadnorm/${filename}.mp4"
    echo "#### ENCODING: $input → $output"
    ffmpeg -hide_banner -loglevel warning -y \
      -i "$input" \
      -c:v libaom-av1 -crf 30 -b:v 0 -cpu-used 5 -g 60 -keyint_min 30 \
      -movflags +faststart \
      -c:a copy \
      "$output"
  done
' bash {}

Added later 1 h 07 min 24 s:
#!/bin/bash
mkdir -p av1-c30

find . -maxdepth 1 -iname "*.avi" -print0 \
| parallel -0 -j3 bash -c '
  f="${1%.*}"
  ffmpeg -y -i "$1" -c:v libaom-av1 -crf 30 -b:v 0 -cpu-used 5 -g 60 -keyint_min 30 \
  -movflags +faststart -c:a copy "av1-c30/${f##*/}.mp4"
' _ {}

Added later 1 h 15 min 32 s:

#!/bin/bash
mkdir -p av1-c30
N=0

for f in *.avi; do
  [ -f "$f" ] || continue
  out="av1-c30/${f%.*}.mp4"
  echo "Encoding: $f → $out"

  ffmpeg -y -i "$f" \
    -c:v libaom-av1 -crf 30 -b:v 0 -cpu-used 5 -g 60 -keyint_min 30 \
    -movflags +faststart -c:a copy "$out" &

  ((N++))
  if ((N % 2 == 0)); then
    wait  # Wait after every 2 jobs
  fi
done

wait
echo "✅ All AVI files encoded with AV1"

Added later 1 h 19 min 20 s:

#!/bin/bash
mkdir -p av1-c30
jobcount=0

for f in *.avi; do
  [ -f "$f" ] || continue  # skip if no avi files
  out="av1-c30/${f%.*}.mp4"
  echo "Encoding: $f → $out"

  ffmpeg -y -i "$f" \
    -c:v libaom-av1 -crf 30 -b:v 0 -cpu-used 5 -g 60 -keyint_min 30 \
    -movflags +faststart -c:a copy "$out" &

  ((jobcount++))
  if (( jobcount % 2 == 0 )); then
    wait
  fi
done

wait
echo "✅ All AVI files processed."

Added later 1 h 22 min 19 s:
#!/bin/bash
mkdir -p av1-c30

for f in *.avi; do
  [ -f "$f" ] || continue
  out="av1-c30/${f%.*}.mp4"
  echo "Encoding: $f → $out"

  ffmpeg -y -i "$f" \
    -c:v libaom-av1 -crf 30 -b:v 0 -cpu-used 5 -g 60 -keyint_min 30 \
    -movflags +faststart -c:a copy "$out"
done

echo "✅ All AVI files processed one by one."


Dearly regards - Brother, Disciple and Child of Jehovah - Darkijah
May Jehovah bless you, Jayshua, be by you a most precious pearl, and their Spirit of Truth in us All, Amayn!

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB 1.5.11
Modified by Visman

[ Generated in 0.022 seconds, 8 queries executed - Memory usage: 1.54 MiB (Peak: 1.75 MiB) ]