initial
This commit is contained in:
commit
d2f97fa70b
28
random-screenshots.sh
Executable file
28
random-screenshots.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
PROGNAME="$0"
|
||||
|
||||
set -e
|
||||
#set -x
|
||||
|
||||
usage() {
|
||||
echo "usage: $PROGNAME FILENAME NUMBER"
|
||||
exit
|
||||
}
|
||||
|
||||
get_duration() {
|
||||
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$1" | awk '{print int($1+0.5)}'
|
||||
}
|
||||
|
||||
[ $# -lt 2 ] && usage
|
||||
|
||||
file="$1"
|
||||
left="$2"
|
||||
|
||||
duration=$(get_duration "$file")
|
||||
#echo "duration: $duration"
|
||||
|
||||
for n in $(seq 1 $left); do
|
||||
time=$(shuf -i 1-$duration -n 1)
|
||||
ffmpeg -y -nostats -loglevel error -ss $time -i "$file" -frames:v 1 -q:v 2 "${file}_$n.jpg" </dev/null || true
|
||||
done
|
23
strip-video-metadata.sh
Executable file
23
strip-video-metadata.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -z "$1" ] && {
|
||||
echo "usage: $0 FILENAME"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set -e
|
||||
|
||||
file="$1"
|
||||
|
||||
ffmpeg -i "$file" \
|
||||
-map_metadata -1 \
|
||||
-map_chapters -1\
|
||||
-fflags +bitexact \
|
||||
-metadata:s handler_name='' \
|
||||
-metadata:s DURATION='' \
|
||||
-metadata:s VENDOR_ID='' \
|
||||
-empty_hdlr_name 1 \
|
||||
-acodec copy -vcodec copy \
|
||||
"nometa_$file"
|
||||
rm "$file"
|
||||
mv "nometa_$file" "$file"
|
10
to-frames.sh
Executable file
10
to-frames.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -z "$1" ] && {
|
||||
echo "usage: $0 FILENAME"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set -e
|
||||
|
||||
ffmpeg -i "$1" -qscale:v 2 output_%03d.jpg
|
35
total-duration.sh
Executable file
35
total-duration.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
get_duration() {
|
||||
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$1" | awk '{print int($1+0.5)}'
|
||||
}
|
||||
|
||||
[ -z "$1" ] && {
|
||||
echo "usage: $0 FILENAME [FILENAME ...]"
|
||||
echo " or: $0 *.mp4"
|
||||
exit 1
|
||||
}
|
||||
|
||||
total=0
|
||||
while [ $# -gt 0 ]; do
|
||||
if [ -f "$1" ]; then
|
||||
dur=$(get_duration "$1")
|
||||
total=$(( total+dur ))
|
||||
else
|
||||
>&2 echo "error: $1: no such file"
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
echo "$total seconds"
|
||||
|
||||
days=$(( total / 86400 ))
|
||||
if [ $days -gt 0 ]; then
|
||||
echo -n "${days}d "
|
||||
fi
|
||||
|
||||
human="$(date -d@$total -u +%H:%M:%S)"
|
||||
echo "$human"
|
78
webdlrip.sh
Executable file
78
webdlrip.sh
Executable file
@ -0,0 +1,78 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
#set -x
|
||||
|
||||
die() {
|
||||
>&2 echo "error: $@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
>&2 echo "usage: $0 [OPTIONS] FILENAME"
|
||||
>&2 echo
|
||||
>&2 echo "options:"
|
||||
>&2 echo " -h|--height set video height, default is 720"
|
||||
>&2 echo " -265 encode with H.265"
|
||||
>&2 echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
do_webdlrip() {
|
||||
filename="$(basename -- "$FILE")"
|
||||
filename="${filename%.*}"
|
||||
|
||||
newname="$filename.mp4"
|
||||
|
||||
audio_params="-c:a aac -b:a 128k"
|
||||
if [ "$HEVC" = "1" ]; then
|
||||
video_params="-c:v libx265 -crf 27 -preset slow -vtag hvc1 -x265-params no-info=1"
|
||||
else
|
||||
video_params="-c:v libx264 -preset slow -crf 23 -bsf:v 'filter_units=remove_types=6'"
|
||||
fi
|
||||
|
||||
ffmpeg -i "$FILE" -vf scale=-1:$HEIGHT,format=yuv420p \
|
||||
-map_metadata -1 -map_chapters -1 \
|
||||
-fflags +bitexact -flags:v +bitexact -flags:a +bitexact \
|
||||
-metadata:s handler_name='' \
|
||||
-metadata:s DURATION='' \
|
||||
-metadata:s VENDOR_ID='' \
|
||||
-metadata:s encoder='' \
|
||||
-empty_hdlr_name 1 \
|
||||
$video_params $audio_params \
|
||||
-vf sidedata=delete,metadata=delete \
|
||||
"webdlrip_$newname"
|
||||
rm "$FILE"
|
||||
mv "webdlrip_$newname" "$FILE"
|
||||
}
|
||||
|
||||
[ -z "$1" ] && usage
|
||||
|
||||
FILE=
|
||||
HEIGHT=720
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
-h|--height)
|
||||
HEIGHT="$2"
|
||||
shift
|
||||
;;
|
||||
-265)
|
||||
HEVC=1
|
||||
;;
|
||||
*)
|
||||
[ -n "$FILE" ] && die "unexpected argument: $1"
|
||||
FILE="$1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[ -z "$FILE" ] && usage
|
||||
[ -f "$FILE" ] || die "$FILE: file not found"
|
||||
|
||||
echo "filename: $FILE"
|
||||
echo " height: $HEIGHT"
|
||||
echo
|
||||
|
||||
do_webdlrip
|
Loading…
x
Reference in New Issue
Block a user