|
@@ -94,6 +94,7 @@ def extract_wav(path):
|
|
|
|
|
|
return bytes(data)
|
|
|
|
|
|
+
|
|
|
def extract_video(path):
|
|
|
logger.info(f"Extract video: '{path}'.")
|
|
|
|
|
@@ -108,6 +109,7 @@ def extract_video(path):
|
|
|
|
|
|
return data
|
|
|
|
|
|
+
|
|
|
def extract_lsbs(data):
|
|
|
logger.info("Extract LSBs.")
|
|
|
|
|
@@ -131,7 +133,10 @@ def whiten(data):
|
|
|
logger.info("Whitening.")
|
|
|
|
|
|
buffer = b""
|
|
|
- for chunk in chunks(data, 128):
|
|
|
+ for chunk in chunks(data, 256):
|
|
|
+ if len(chunk) < 256:
|
|
|
+ break
|
|
|
+
|
|
|
buffer += BLAKE2b.new(data=chunk, digest_bits=256).digest()
|
|
|
|
|
|
return buffer
|
|
@@ -151,7 +156,7 @@ def read_audio(source, duration=60):
|
|
|
tmpf = NamedTemporaryFile(suffix=".wav", mode=None, dir=tmp_dir)
|
|
|
|
|
|
run_check(
|
|
|
- f"ffmpeg -f alsa -i {source} -t {duration} -ar 48000 -f s16le -acodec pcm_s16le {tmpf.name}"
|
|
|
+ f"ffmpeg ffmpeg -hide_banner -loglevel error -y -f alsa -i {source} -t {duration} -ar 44100 -f s16le -acodec pcm_s16le {tmpf.name}"
|
|
|
)
|
|
|
|
|
|
return extract_wav(tmpf.name)
|
|
@@ -169,7 +174,7 @@ def read_audio_video(source, duration=60):
|
|
|
tmpf2 = NamedTemporaryFile(suffix=".wav", mode=None, dir=tmp_dir)
|
|
|
|
|
|
run_check(
|
|
|
- f"ffmpeg -hide_banner -loglevel error -y -i {tmpf.name} -vn -ar 48000 -f s16le -acodec pcm_s16le {tmpf2.name}"
|
|
|
+ f"ffmpeg -hide_banner -loglevel error -y -i {tmpf.name} -vn -ar 44100 -f s16le -acodec pcm_s16le {tmpf2.name}"
|
|
|
)
|
|
|
|
|
|
data_b = extract_wav(tmpf2.name)
|
|
@@ -265,6 +270,8 @@ def pusher(queue, pool_url, secret, cooldown=0):
|
|
|
except Exception as e:
|
|
|
logger.error(f"Push exception: {e}")
|
|
|
|
|
|
+ queue.put(piece)
|
|
|
+
|
|
|
if cooldown:
|
|
|
time.sleep(cooldown)
|
|
|
|