Skip to content

Commit

Permalink
fix ffmpeg corrupt files
Browse files Browse the repository at this point in the history
  • Loading branch information
eshrh committed Jun 8, 2021
1 parent 413c3a2 commit cd27431
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ames.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,24 @@ record() {
-af 'silenceremove=1:0:-50dB' \
-ab $AUDIO_BITRATE \
"$audioFile" 1>/dev/null &
echo "$!" >> "$recordingToggle"

if [[ "$LANG" == en* ]]; then
notify-send --hint=int:transient:1 -t 500 -u normal "Recording started..."
fi
if [[ "$LANG" == ja* ]]; then
notify-send --hint=int:transient:1 -t 500 -u normal "録音しています..."
fi

echo "Started recording."
else
local -r audioFile="$(cat "$recordingToggle")"
local audioFile="$(sed -n "1p" "$recordingToggle")"
local pid="$(sed -n "2p" "$recordingToggle")"

rm "$recordingToggle"
killall ffmpeg
kill -15 "$pid"

while [ $(du $audioFile | awk '{ print $1 }') -eq 0 ]; do
true
done
store_file "${audioFile}"
update_sound "$(basename -- "$audioFile")"

Expand Down

0 comments on commit cd27431

Please sign in to comment.