From 898d1976db94af9b6e53076703fcd36d92240704 Mon Sep 17 00:00:00 2001 From: Jan Jastrow Date: Mon, 18 Dec 2023 22:30:59 +0100 Subject: [PATCH] Two new scripts to cut off the start or end --- zsh/ffmpeg | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/zsh/ffmpeg b/zsh/ffmpeg index 03d1ac4..530ea12 100644 --- a/zsh/ffmpeg +++ b/zsh/ffmpeg @@ -133,3 +133,19 @@ function ff-wma-m4a() { mv "$dir/temp_$name.mp4" "$dir/$file"; done } + +## ffmpeg cut X seconds from start +function ff-cutstart { + local time="${2:-00:00:08.590}" + mv "$1" "_$1" + ffmpeg -ss $time -i "_$1" -map 0 -c copy -movflags faststart "$1" +} + +## ffmpeg cut X seconds from start +function ff-cutend { + local time="${2:-24.250}" + duration=`ffprobe -v error -show_entries format=duration -of csv=p=0 "$1"` + duration=`bc --expression=$duration-$time` + mv "$1" "_$1" + ffmpeg -ss 00:00:00 -to $duration -i "_$1" -map 0 -c copy -movflags faststart "$1" +} \ No newline at end of file