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
194957f1
Commit
194957f1
authored
Apr 03, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
videowmark: support more command line options
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
afdac573
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
8 deletions
+31
-8
TODO
src/TODO
+2
-3
videowmark
src/videowmark
+29
-5
No files found.
src/TODO
View file @
194957f1
possible improvements:
possible improvements:
- dynamic bit strength
- dynamic bit strength
videowmark:
plausibility checks
--help
die on errors
stream issue
stream issue
where?
opus length ffprobe -show_format phil.mkv
opus length ffprobe -show_format phil.mkv
src/videowmark
View file @
194957f1
...
@@ -37,18 +37,42 @@ function create_temp_files
...
@@ -37,18 +37,42 @@ function create_temp_files
done
done
}
}
GETOPT_TEMP
=
`
getopt
-o
v
--long
verbose,key:,
-n
'videowmark'
--
"
$@
"
`
function
show_help_and_exit
{
cat
<<
EOH
usage: videowmark <command> [ <args>... ]
Commands:
* create a watermarked video file with a message
videowmark add <input_video> <watermarked_video> <message_hex>
* retrieve message
videowmark get <watermarked_video>
Global options:
--strength <s> set watermark strength
--key <file> load watermarking key from file
-q, --quiet disable information messages
-v, --verbose enable ffmpeg verbose output
EOH
exit
0
}
GETOPT_TEMP
=
`
getopt
-o
vhq
--long
verbose,quiet,help,key:,strength:
-n
'videowmark'
--
"
$@
"
`
[
$?
!=
0
]
&&
exit
1
# exit on option parser errors
[
$?
!=
0
]
&&
exit
1
# exit on option parser errors
eval set
--
"
$GETOPT_TEMP
"
eval set
--
"
$GETOPT_TEMP
"
AUDIOWMARK_
KEY
=()
AUDIOWMARK_
ARGS
=()
FFMPEG_VERBOSE
=
"-v error"
FFMPEG_VERBOSE
=
"-v error"
while
true
;
do
while
true
;
do
case
"
$1
"
in
case
"
$1
"
in
-v
|
--verbose
)
FFMPEG_VERBOSE
=
"-v info"
;
shift
;;
-v
|
--verbose
)
FFMPEG_VERBOSE
=
"-v info"
;
shift
;;
--key
)
AUDIOWMARK_KEY
=(
"--key"
"
$2
"
)
;
shift
2
;;
-q
|
--quiet
)
AUDIOWMARK_ARGS+
=(
"-q"
)
;
shift
;;
--key
)
AUDIOWMARK_ARGS+
=(
"--key"
"
$2
"
)
;
shift
2
;;
--strength
)
AUDIOWMARK_ARGS+
=(
"--strength"
"
$2
"
)
;
shift
2
;;
--help
)
show_help_and_exit
;;
--
)
shift
;
break
;;
--
)
shift
;
break
;;
*
)
break
;;
*
)
break
;;
esac
esac
...
@@ -63,7 +87,7 @@ if [ "$1" == "add" ]; then
...
@@ -63,7 +87,7 @@ if [ "$1" == "add" ]; then
# get audio as wav
# get audio as wav
ffmpeg
$FFMPEG_VERBOSE
-y
-i
"
$2
"
-f
wav
"
$orig_wav
"
ffmpeg
$FFMPEG_VERBOSE
-y
-i
"
$2
"
-f
wav
"
$orig_wav
"
# watermark
# watermark
audiowmark
"
${
AUDIOWMARK_
KEY
[@]
}
"
add
"
$orig_wav
"
"
$wm_wav
"
"
$4
"
audiowmark
"
${
AUDIOWMARK_
ARGS
[@]
}
"
add
"
$orig_wav
"
"
$wm_wav
"
"
$4
"
# rejoin
# 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
"
elif
[
"
$1
"
==
"get"
]
;
then
elif
[
"
$1
"
==
"get"
]
;
then
...
@@ -74,7 +98,7 @@ elif [ "$1" == "get" ]; then
...
@@ -74,7 +98,7 @@ elif [ "$1" == "get" ]; then
# get audio as wav
# get audio as wav
ffmpeg
$FFMPEG_VERBOSE
-y
-i
"
$2
"
-f
wav
"
$wav
"
ffmpeg
$FFMPEG_VERBOSE
-y
-i
"
$2
"
-f
wav
"
$wav
"
# get watermark
# get watermark
audiowmark
"
${
AUDIOWMARK_
KEY
[@]
}
"
get
"
$wav
"
audiowmark
"
${
AUDIOWMARK_
ARGS
[@]
}
"
get
"
$wav
"
elif
[
"
$1
"
==
"probe"
]
;
then
elif
[
"
$1
"
==
"probe"
]
;
then
echo
$2
$(
audio_encode_options
"
$2
"
)
echo
$2
$(
audio_encode_options
"
$2
"
)
else
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