Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
audiowmark
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
audiowmark
Commits
2bf8a91d
Commit
2bf8a91d
authored
Apr 03, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
videowmark: die on error
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
194957f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
TODO
src/TODO
+0
-1
videowmark
src/videowmark
+12
-5
No files found.
src/TODO
View file @
2bf8a91d
...
...
@@ -2,6 +2,5 @@ possible improvements:
- dynamic bit strength
plausibility checks
die on errors
stream issue
opus length ffprobe -show_format phil.mkv
src/videowmark
View file @
2bf8a91d
#!/bin/bash
function
die
{
echo
>
&2
"videowmark: error:
$@
"
exit
1
}
# auto detect codec and bitrate from input stream, generate ffmpeg options for audio encoder
function
audio_encode_options
{
...
...
@@ -85,20 +91,21 @@ if [ "$1" == "add" ]; then
wm_wav
=
/dev/fd/4
# get audio as wav
ffmpeg
$FFMPEG_VERBOSE
-y
-i
"
$2
"
-f
wav
"
$orig_wav
"
ffmpeg
$FFMPEG_VERBOSE
-y
-i
"
$2
"
-f
wav
"
$orig_wav
"
||
die
"extracting audio from video failed (ffmpeg)"
# watermark
audiowmark
"
${
AUDIOWMARK_ARGS
[@]
}
"
add
"
$orig_wav
"
"
$wm_wav
"
"
$4
"
audiowmark
"
${
AUDIOWMARK_ARGS
[@]
}
"
add
"
$orig_wav
"
"
$wm_wav
"
"
$4
"
||
die
"watermark generation failed (audiowmark)"
# rejoin
ffmpeg
$FFMPEG_VERBOSE
-y
-i
"
$2
"
-i
"
$wm_wav
"
-c
:v copy
$(
audio_encode_options
"
$2
"
)
-map
0:v:0
-map
1:a:0
"
$3
"
ffmpeg
$FFMPEG_VERBOSE
-y
-i
"
$2
"
-i
"
$wm_wav
"
-c
:v copy
$(
audio_encode_options
"
$2
"
)
-map
0:v:0
-map
1:a:0
"
$3
"
||
\
die
"merging video and watermarked audio failed (ffmpeg)"
elif
[
"
$1
"
==
"get"
]
;
then
# create tmpfiles
create_temp_files 3
wav
=
/dev/fd/3
# get audio as wav
ffmpeg
$FFMPEG_VERBOSE
-y
-i
"
$2
"
-f
wav
"
$wav
"
ffmpeg
$FFMPEG_VERBOSE
-y
-i
"
$2
"
-f
wav
"
$wav
"
||
die
"extracting audio from video failed (ffmpeg)"
# get watermark
audiowmark
"
${
AUDIOWMARK_ARGS
[@]
}
"
get
"
$wav
"
audiowmark
"
${
AUDIOWMARK_ARGS
[@]
}
"
get
"
$wav
"
||
die
"retrieving watermark from audio failed (audiowmark)"
elif
[
"
$1
"
==
"probe"
]
;
then
echo
$2
$(
audio_encode_options
"
$2
"
)
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment