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
2d420d47
Commit
2d420d47
authored
Apr 03, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
videowmark: ensure temp files get deleted when done
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
4c8c4a7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
7 deletions
+26
-7
TODO
src/TODO
+0
-1
videowmark
src/videowmark
+26
-6
No files found.
src/TODO
View file @
2d420d47
...
...
@@ -2,7 +2,6 @@ possible improvements:
- dynamic bit strength
videowmark:
temp files
--key
--help
stream issue
...
...
src/videowmark
View file @
2d420d47
...
...
@@ -24,21 +24,41 @@ function audio_encode_options
}'
}
function
create_temp_files
{
local
fd
for
fd
in
"
$@
"
do
local
tmpfile
=
$(
mktemp
/tmp/videowmark.XXXXXX
)
eval
"exec
$fd
>
$tmpfile
"
rm
"
$tmpfile
"
done
}
if
[
"
$1
"
==
"add"
]
;
then
# create tmpfiles
create_temp_files 3 4
orig_wav
=
/dev/fd/3
wm_wav
=
/dev/fd/4
# get audio as wav
ffmpeg
-y
-i
"
$2
"
tmp.wav
ffmpeg
-y
-i
"
$2
"
-f
wav
"
$orig_wav
"
# watermark
audiowmark add
tmp.wav tmp1.wav
"
$4
"
audiowmark add
"
$orig_wav
"
"
$wm_wav
"
"
$4
"
# rejoin
ffmpeg
-y
-i
"
$2
"
-i
tmp1.wav
-c
:v copy
$(
audio_encode_options
"
$2
"
)
-map
0:v:0
-map
1:a:0
"
$3
"
ffmpeg
-y
-i
"
$2
"
-i
"
$wm_wav
"
-c
:v copy
$(
audio_encode_options
"
$2
"
)
-map
0:v:0
-map
1:a:0
"
$3
"
elif
[
"
$1
"
==
"get"
]
;
then
# create tmpfiles
create_temp_files 3
wav
=
/dev/fd/3
# get audio as wav
ffmpeg
-y
-i
"
$2
"
tmp.wav
ffmpeg
-y
-i
"
$2
"
-f
wav
"
$wav
"
# get watermark
audiowmark get
tmp.wav
audiowmark get
"
$wav
"
elif
[
"
$1
"
==
"probe"
]
;
then
echo
$2
$(
audio_encode_options
"
$2
"
)
else
echo
"videowmark: error parsing command line arguments"
fi
rm
-f
tmp
*
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