commit 1a9396b4a297b327e8a3c34e6e3e5dc1839ea061 parent ac0afced34f8b59343d1082bb39759cce3b5552a Author: Alex Balgavy <a.balgavy@gmail.com> Date: Fri, 4 Sep 2020 15:35:03 +0200 ffmpres: unless a new filename provided, don't transcode Former-commit-id: a1a920d76734196698c6c39755be5d78111d80e6 Diffstat:
M | scripts/ffmpres | | | 20 | +++++++++++++++----- |
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/scripts/ffmpres b/scripts/ffmpres @@ -124,12 +124,22 @@ process_video() { read -rp "From time: " starttime read -rp "To time: " endtime read -rp "Save as: " outfile - if [ -z "$endtime" ]; then - ffmpeg -i "$1" -ss "$starttime" "${outfile:-out-$1}" - elif [ -z "$starttime" ]; then - ffmpeg -i "$1" -to "$endtime" "${outfile:-out-$1}" + if [ -z "$outfile" ]; then + if [ -z "$endtime" ]; then + ffmpeg -i "$1" -ss "$starttime" -acodec copy -vcodec copy "out-$1" + elif [ -z "$starttime" ]; then + ffmpeg -i "$1" -to "$endtime" -acodec copy -vcodec copy "out-$1" + else + ffmpeg -i "$1" -ss "$starttime" -to "$endtime" -acodec copy -vcodec copy "out-$1" + fi else - ffmpeg -i "$1" -ss "$starttime" -to "$endtime" "${outfile:-out-$1}" + if [ -z "$endtime" ]; then + ffmpeg -i "$1" -ss "$starttime" "$outfile" + elif [ -z "$starttime" ]; then + ffmpeg -i "$1" -to "$endtime" "$outfile" + else + ffmpeg -i "$1" -ss "$starttime" -to "$endtime" "$outfile" + fi fi break;; "VOLUME")