Always output MKV in transcode-hevc to avoid container codec issues
MP4 containers don't support all subtitle/codec combinations with HEVC. MKV handles everything, so always output .mkv and remove the original if it was a different format. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
603ac86f0a
commit
f431d1a5b0
1 changed files with 10 additions and 6 deletions
|
|
@ -163,12 +163,12 @@ while IFS= read -r -d '' file; do
|
||||||
|
|
||||||
log "Encoding: $file ($original_size_h)"
|
log "Encoding: $file ($original_size_h)"
|
||||||
|
|
||||||
# Encode to temp file in same directory (same filesystem for atomic move)
|
# Always output as MKV — it supports all codecs/subtitle formats
|
||||||
dir=$(dirname "$file")
|
dir=$(dirname "$file")
|
||||||
base=$(basename "$file")
|
base=$(basename "$file")
|
||||||
ext="${base##*.}"
|
|
||||||
name="${base%.*}"
|
name="${base%.*}"
|
||||||
tmp_file="${dir}/.transcode-${name}.${ext}"
|
tmp_file="${dir}/.transcode-${name}.mkv"
|
||||||
|
final_file="${dir}/${name}.mkv"
|
||||||
|
|
||||||
# Clean up any leftover temp file from a previous interrupted run
|
# Clean up any leftover temp file from a previous interrupted run
|
||||||
rm -f "$tmp_file"
|
rm -f "$tmp_file"
|
||||||
|
|
@ -199,9 +199,13 @@ while IFS= read -r -d '' file; do
|
||||||
saved_bytes=$((saved_bytes + diff_bytes))
|
saved_bytes=$((saved_bytes + diff_bytes))
|
||||||
diff_h=$(numfmt --to=iec "$diff_bytes" 2>/dev/null || echo "${diff_bytes}B")
|
diff_h=$(numfmt --to=iec "$diff_bytes" 2>/dev/null || echo "${diff_bytes}B")
|
||||||
|
|
||||||
# Replace original
|
# Move temp to final destination
|
||||||
mv "$tmp_file" "$file"
|
mv "$tmp_file" "$final_file"
|
||||||
mark_done "$file"
|
# Remove original if it was a different format (e.g. .mp4 -> .mkv)
|
||||||
|
if [[ "$file" != "$final_file" ]]; then
|
||||||
|
rm -f "$file"
|
||||||
|
fi
|
||||||
|
mark_done "$final_file"
|
||||||
encoded=$((encoded + 1))
|
encoded=$((encoded + 1))
|
||||||
|
|
||||||
log "Done: $file ($original_size_h -> $new_size_h) Saved: $diff_h"
|
log "Done: $file ($original_size_h -> $new_size_h) Saved: $diff_h"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue