Skip to content

Commit 8cd661a

Browse files
committed
Bugfix ffmpeg-convert
1 parent 42ddc6e commit 8cd661a

7 files changed

+776
-24
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
NAME=ffmpeg-tools
2-
VERSION=0.1
2+
VERSION=0.2
33

44
DIRS=bin etc share
55
INSTALL_DIRS=`find $(DIRS) -type d 2>/dev/null`
@@ -11,7 +11,7 @@ PKG_NAME=$(NAME)-$(VERSION)
1111
PREFIX?=/usr/local
1212
DOC_DIR=$(PREFIX)/share/doc/$(PKG_NAME)
1313

14-
BIN=$(notdir $(wildcard bin/*))
14+
BIN=$(filter-out ffmpeg-splitaudio-editor,$(notdir $(wildcard bin/*)))
1515

1616
MAN_SECTION ?= 1
1717
MAN_DIR = share/man/man$(MAN_SECTION)

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
This collection provides the following wrappers for **FFmpeg**:
44

5-
+ [ffmpeg-audioshift](share/doc/ffmpeg-audioshift.md)
65
+ [ffmpeg-concat](share/doc/ffmpeg-concat.md)
76
+ [ffmpeg-convert](share/doc/ffmpeg-convert.md)
87
+ [ffmpeg-cropdetect](share/doc/ffmpeg-cropdetect.md)
98
+ [ffmpeg-fadeinout](share/doc/ffmpeg-fadeinout.md)
109
+ [ffmpeg-gamma](share/doc/ffmpeg-gamma.md)
10+
+ [ffmpeg-offset](share/doc/ffmpeg-offset.md)
1111
+ [ffmpeg-splitaudio](share/doc/ffmpeg-splitaudio.md)
1212
+ [ffmpeg-watermark](share/doc/ffmpeg-watermark.md)
1313

bin/ffmpeg-convert

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
#
33
# Created: So 2023-08-06 01:34:08 CEST
4-
# Last Modified: Sa 2024-06-22 18:40:53 CEST
4+
# Last Modified: Mi 2025-01-15 19:54:10 CET
55
#
66
# ffmpeg-convert:
77
# Convert one or several video files
@@ -188,7 +188,7 @@ do
188188
fi
189189

190190
# Replace file extension
191-
OUTFILE="${INFILE%.*}.$EXT"
191+
OUTFILE="${INFILE%.*}$NAME.$EXT"
192192

193193
# Add output directory to output filename
194194
[ $(stat -c "%i" "$DIR") -ne $(stat -c "%i" $(pwd)) ] && OUTFILE="$DIR/$OUTFILE"

bin/ffmpeg-audioshift bin/ffmpeg-offset

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#!/usr/bin/env bash
22
#
33
# Created: Mo 2019-08-26 11:18:48 CEST
4-
# Last Modified: So 2024-06-16 18:04:41 CEST
4+
# Last Modified: So 2024-12-15 09:15:08 CET
55
#
6-
# ffmpeg-audioshift:
6+
# ffmpeg-offset:
77
# Delay the audio or video stream of one or several video files
88

99
set -euo pipefail
1010

1111
# Help text
1212
usage() {
1313
>&2 cat << EOF
14-
Delay the audio or video stream of one or several video files
14+
Offset audio stream of one or several video files
1515
16-
Usage: ffmpeg-audioshift [OPTION]... INFILE...
16+
Usage: ffmpeg-offset [OPTION]... INFILE...
1717
1818
Options:
1919
-o, --offset=VALUE Offset audio track in seconds (default: 0). Positive values delay the audio track.

bin/ffmpeg-splitaudio bin/ffmpeg-splitabook

+23-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22
#
33
# Created: Do 2024-08-22 08:27:21 CEST
4-
# Last Modified: Do 2024-08-22 21:31:41 CEST
4+
# Last Modified: Sa 2025-01-04 11:52:03 CET
55
#
6-
# ffmpeg-splitaudio:
6+
# ffmpeg-splitabook:
77
# Split an Audible audio book into chapter files
88
#
99
# see also:
@@ -16,11 +16,11 @@ usage() {
1616
>&2 cat << EOF
1717
Split monolithic audio book into chapter files
1818
19-
Usage: ffmpeg-splitaudio [OPTION]... INFILE...
19+
Usage: ffmpeg-splitabook [OPTION]... INFILE...
2020
2121
Options:
2222
-t, --to=FORMAT Set output format
23-
-r, --readonly Extract chapter information only
23+
-f, --fetchonly Fetch chapter information only
2424
-y, --yes Overwrite existing files
2525
-h, --help Show this help and exit
2626
EOF
@@ -48,12 +48,12 @@ then
4848
fi
4949

5050
# Defaults
51-
ro=0
51+
fetchonly=0
5252
to=
5353
yes=0
5454

5555
# Parse command line options
56-
if ! args=$(getopt -a -o ct:yh --long chapteronly,to:,yes,help -- "$@")
56+
if ! args=$(getopt -a -o t:fyh --long to:,fetchonly,yes,help -- "$@")
5757
then
5858
echoerr "Error processing command line options"
5959
usage
@@ -65,10 +65,10 @@ eval set -- "$args"
6565
while :
6666
do
6767
case $1 in
68-
-r | --readonly) ro=1 ; shift ;;
69-
-t | --to) to=$2 ; shift 2 ;;
70-
-y | --yes) yes=1 ; shift ;;
71-
-h | --help) usage ; shift ; exit 0;;
68+
-t | --to) to=$2; shift 2;;
69+
-f | --fetchonly) fetchonly=1; shift;;
70+
-y | --yes) yes=1; shift;;
71+
-h | --help) usage; shift; exit 0;;
7272
# -- means end of the arguments; drop this, and break out of the while loop
7373
--) shift; break;;
7474
*) echoerr "Unsupported option: $1"; usage; shift; exit 1;;
@@ -109,30 +109,41 @@ do
109109
# Check target format
110110
if [[ "$ext" == "$to" ]]
111111
then
112+
112113
# Source and target format are identical
113114
codec="copy"
115+
114116
elif [[ $to == "mp3" ]]
115117
then
118+
116119
# Convert to MP3
117120
codec="libmp3lame"
121+
118122
else
123+
119124
# Unsupported target format
120125
echoerr "Unsupported extension $to."
121126
exit 1
127+
122128
fi
123129

124130
# Create chapter file if it does not exist already
125131
if [ ! -e "$chapterdata" ]
126132
then
133+
134+
#
127135
"$FFPROBE" -i "$f" \
128136
-print_format json \
129137
-show_chapters \
130138
-loglevel error \
131139
-sexagesimal > "$chapterdata"
140+
141+
# Check output of FFPROBE, if empty invoke editor to set list manually
142+
132143
fi
133144

134-
# Skip rest if chapteronly flag is enabled
135-
[ "$ro" -eq 1 ] && continue
145+
# Skip rest if fetchonly flag is active
146+
[ "$fetchonly" -eq 1 ] && continue
136147

137148
# Read chapterdata file
138149
readarray -t id <<< $(jq -r '.chapters[].id' "$chapterdata")

0 commit comments

Comments
 (0)