Commit 22045d08 authored by Stefan Westerfeld's avatar Stefan Westerfeld

Merge branch 'rf64-support'

* rf64-support:
  README.adoc: document --output-format rf64 and some other options
  SRC: videowmark: use rf64 as format to support huge files
	See also:
	 - https://github.com/swesterfeld/audiowmark/issues/30
  SRC: support setting output format to rf64 for huge files
	See also:
	 - https://github.com/swesterfeld/audiowmark/issues/2
	 - https://github.com/swesterfeld/audiowmark/issues/30Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parents 99ffa6b4 7eee2705
......@@ -481,6 +481,24 @@ same. The watermarker has been designed and tested for stereo files,
so the number of channels should really be `2`. This is also the
default.
== Other Command Line Options
--output-format rf64::
Regular wav files are limited to 4GB in size. By using this option,
`audiowmark` will write RF64 wave files, which do not have this size limit.
This is not the default because not all programs might be able to read RF64
wave files.
--q, --quiet::
Disable all information messages generated by `audiomark`.
--strict::
This option will enable strict error checking, which may in some situations
make `audiowmark` return an error, where it could continue.
[[hls]]
== HTTP Live Streaming
......
......@@ -87,9 +87,16 @@ AudioOutputStream::create (const string& filename, int n_channels, int sample_ra
}
else
{
SFOutputStream::OutFormat out_format;
if (Params::output_format == Format::RF64)
out_format = SFOutputStream::OutFormat::RF64;
else
out_format = SFOutputStream::OutFormat::WAV;
SFOutputStream *sfostream = new SFOutputStream();
out_stream.reset (sfostream);
err = sfostream->open (filename, n_channels, sample_rate, bit_depth);
err = sfostream->open (filename, n_channels, sample_rate, bit_depth, out_format);
if (err)
return nullptr;
}
......
......@@ -112,6 +112,9 @@ parse_format (const string& str)
return Format::RAW;
if (str == "auto")
return Format::AUTO;
if (str == "rf64")
return Format::RF64;
error ("audiowmark: unsupported format '%s'\n", str.c_str());
exit (1);
}
......@@ -657,6 +660,11 @@ parse_add_options (ArgParser& ap)
{
Params::test_no_limiter = true;
}
if (Params::input_format == Format::RF64)
{
error ("audiowmark: using rf64 as input format has no effect\n");
exit (1);
}
}
void
......
......@@ -53,6 +53,8 @@ SFOutputStream::open (std::function<SNDFILE* (SF_INFO *)> open_func, int n_chann
{
case OutFormat::WAV: sfinfo.format = SF_FORMAT_WAV;
break;
case OutFormat::RF64: sfinfo.format = SF_FORMAT_RF64;
break;
case OutFormat::FLAC: sfinfo.format = SF_FORMAT_FLAC;
break;
default: assert (false);
......
......@@ -28,7 +28,7 @@
class SFOutputStream : public AudioOutputStream
{
public:
enum class OutFormat { WAV, FLAC };
enum class OutFormat { WAV, RF64, FLAC };
private:
SFVirtualData m_virtual_data;
......
......@@ -85,11 +85,11 @@ function add_watermark
local wm_wav=/dev/fd/4
# get audio as wav
ffmpeg $FFMPEG_VERBOSE -y -i "$in_file" -f wav "$orig_wav" || die "extracting audio from video failed (ffmpeg)"
ffmpeg $FFMPEG_VERBOSE -y -i "$in_file" -f wav -rf64 always "$orig_wav" || die "extracting audio from video failed (ffmpeg)"
# watermark
[ -z "$QUIET" ] && echo >&2 "Audio Codec: $(audio_encode_options "$in_file")"
audiowmark add "${AUDIOWMARK_ARGS[@]}" "$orig_wav" "$wm_wav" "$bits" \
--set-input-label "$in_file" --set-output-label "$out_file" || die "watermark generation failed (audiowmark)"
--set-input-label "$in_file" --set-output-label "$out_file" --output-format rf64 || die "watermark generation failed (audiowmark)"
# rejoin
ffmpeg $FFMPEG_VERBOSE -y -i "$in_file" -i "$wm_wav" -c:v copy $(audio_encode_options "$in_file") -map 0:v:0 -map 1:a:0 "$out_file" || \
die "merging video and watermarked audio failed (ffmpeg)"
......@@ -111,7 +111,7 @@ function get_watermark
local wav=/dev/fd/3
# get audio as wav
ffmpeg $FFMPEG_VERBOSE -y -i "$in_file" -f wav "$wav" || die "extracting audio from video failed (ffmpeg)"
ffmpeg $FFMPEG_VERBOSE -y -i "$in_file" -f wav -rf64 always "$wav" || die "extracting audio from video failed (ffmpeg)"
# get watermark
audiowmark get "${AUDIOWMARK_ARGS[@]}" "$wav" || die "retrieving watermark from audio failed (audiowmark)"
}
......
......@@ -28,7 +28,7 @@
#include <assert.h>
enum class Format { AUTO = 1, RAW = 2 };
enum class Format { AUTO = 1, RAW = 2, RF64 = 3 };
class Params
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment