Skip to content

Commit

Permalink
ffmw: preserve file timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
XPhyro committed Jan 22, 2024
1 parent 1b59db2 commit d6e8a74
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sh/soft-wrapper/ffmw
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,7 @@ optimize() {
printf 'ffmpeg failed, exiting.\n'
exit 1
}
touch --reference="$fl" -- "$outfl"
after_size="$(stat --printf="%s\n" -- "$outfl")"
[ "$remove" = '1' ] && {
if [ "$after_size" -ge "$before_size" ]; then
Expand Down Expand Up @@ -996,6 +997,7 @@ compress() {
printf 'ffmpeg failed, exiting.\n'
exit 1
}
touch --reference=\"\$i\" -- '$outfl'
mv -f -- '$outfl' \"\${i%.*}.${outfl##*.}\"
" --
}
Expand Down Expand Up @@ -1027,6 +1029,7 @@ concat() {
[ -f "$lstfl" ] && rm -- "$lstfl"
exit 1
}
touch --reference="$lstfl" -- "$outfl"

[ "$remove" = "1" ] && printf "%s\n" "$infls" | xargs -d '\n' -r rm --

Expand All @@ -1044,6 +1047,7 @@ crop() {

$pperf ffmpeg -hide_banner $threads $overwrite $FFMW_FFMPEG_ARGS -ss "$beginmark" -i "$infl" $endmark -safe 0 -c:v $codec -c:a copy "$outfl" \
|| printferrq "ffmpeg failed, exiting.\n"
touch --reference="$infl" -- "$outfl"

[ "$remove" = "1" ] && rm -- "$infl"
[ -n "$movefile" ] && mv $mvoverwrite -- "$outfl" "$movefile"
Expand Down Expand Up @@ -1103,6 +1107,7 @@ trim() {
| head -n 1 \
| sed 's/^\s*[0-9]\+\s\+\(.*\)$/\1/'
)" -safe 0 -c:a copy "$outfl"
touch --reference="$infl" -- "$outfl"

[ "$remove" = "1" ] && rm -- "$infl"

Expand All @@ -1113,6 +1118,7 @@ reverse() {
[ -f "$infl" ] || printferrq "No such file [%s], exiting.\n" "$infl"

$pperf ffmpeg -hide_banner $threads $overwrite $FFMW_FFMPEG_ARGS -i "$infl" -vf reverse -af areverse "$outfl"
touch --reference="$infl" -- "$outfl"

[ "$remove" = "1" ] && rm -- "$infl"

Expand Down

0 comments on commit d6e8a74

Please sign in to comment.