keep the original (e.g., archiving)

# 6️⃣ Clean temporary files rm -rf "$tmp_dir"

Below is a wrapper that loops over all source files in a folder ( /src ) and spits out cleaned MKVs in /out . It also prints a nice progress bar using tqdm (Python) for visual feedback.

Keep a copy of the original broadcast files (e.g., .ts or .mxf ) in a read‑only folder. All FFmpeg work should be done on copies.

ffmpeg -i The_Rookie_S07E01.mkv -c:v libx265 -crf 22 -c:a aac -b:a 128k S07E01_mobile.mp4 Use code with caution. Copied to clipboard

All of this is doable with a —no need for commercial suites, and you stay fully in control of quality.

The seventh season introduces two new rookies and maintains the high-stakes action the series is known for. Key plot points include:

Some older devices (e.g., Apple TV 2nd gen) lack Main10 support. The above command creates a compatible 1080p version while preserving most visual fidelity.

# 2️⃣ Demux video, audio, subtitles (keeps original bit‑depth) ffmpeg -i Rookie_S07E01.ts \ -map 0:v:0 -c copy Rookie_S07E01_video.hevc \ -map 0:a:0 -c copy Rookie_S07E01_audio_ac3.ac3 \ -map 0:s:0 -c copy Rookie_S07E01_subs.pgs

# Use tqdm for a pretty progress bar find "$SRC_DIR" -type f -name "*.ts" | tqdm --total $(find "$SRC_DIR" -type f -name "*.ts" | wc -l) | while read -r file; do process_episode "$file" done

Broadcast audio often has dynamic range compression that we want to tame for home‑theater listening.

echo "✅ All episodes processed! 🎉"