Add All existing
This commit is contained in:
32
deinterlacing_gpu.sh
Executable file
32
deinterlacing_gpu.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
INPUT="$HOME/mount/Ripping/Lutz/noch zu rendern/Brücke nach Terabithia/A1_t00.mkv"
|
||||
OTPUT="${INPUT%.*}_deinterlaced_vaapi.mp4"
|
||||
TEMP_STATS=$(mktemp)
|
||||
|
||||
ffmpeg -filter:v idet -frames:v 5000 -an -f rawvideo -y /dev/null -i "$INPUT" 2> "$TEMP_STATS"
|
||||
|
||||
SUMMARY_LINE=$(grep "Multi frame detection" "$TEMP_STATS")
|
||||
|
||||
# Extract counts allowing for leading spaces
|
||||
TFF_COUNT=$(echo "$SUMMARY_LINE" | grep -oP 'TFF:\s*\K[0-9]+' || echo 0)
|
||||
BFF_COUNT=$(echo "$SUMMARY_LINE" | grep -oP 'BFF:\s*\K[0-9]+' || echo 0)
|
||||
PROG_COUNT=$(echo "$SUMMARY_LINE" | grep -oP 'Progressive:\s*\K[0-9]+' || echo 0)
|
||||
|
||||
rm "$TEMP_STATS"
|
||||
|
||||
echo "Detected: TFF=$TFF_COUNT, BFF=$BFF_COUNT, Progressive=$PROG_COUNT"
|
||||
|
||||
TOTAL_INTERLACED=$((TFF_COUNT + BFF_COUNT))
|
||||
|
||||
if [ "$TOTAL_INTERLACED" -lt 100 ]; then
|
||||
echo "Video is mostly progressive. No deinterlacing needed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Deinterlacing required."
|
||||
|
||||
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi \
|
||||
-i "$INPUT" \
|
||||
-vf 'format=nv12,hwupload,deinterlace_vaapi' \U
|
||||
-c:v h264_vaapi -b:v 5M -c:a copy "$OUTPUT"
|
||||
Reference in New Issue
Block a user