From cf82fab833e4b4c4c0767deed69a52d0921ce738 Mon Sep 17 00:00:00 2001 From: Timofey Martynov Date: Thu, 27 Aug 2020 02:35:12 +0300 Subject: [PATCH] Skip empty segments on concat (#79) --- scripts/upload_record.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/upload_record.sh b/scripts/upload_record.sh index 42921d90..a824602f 100755 --- a/scripts/upload_record.sh +++ b/scripts/upload_record.sh @@ -38,8 +38,14 @@ cd ${RECORDINGS_DIR}/${RTC_ID} # Convert video .mjr dumps into .webm files. for FILE in *.video.mjr; do - ${SCRIPT_ABS_DIR}/janus-pp-rec $FILE ${FILE%.*}.webm - echo "file '${FILE%.*}.webm'" >> video_sources.txt + OUTPUT_FILE="${FILE%.*}.webm" + ${SCRIPT_ABS_DIR}/janus-pp-rec ${FILE} ${OUTPUT_FILE} + + if [[ -f ${OUTPUT_FILE} ]]; then + echo "file '${OUTPUT_FILE}'" >> video_sources.txt + else + >&2 echo "[ERROR] ${OUTPUT_FILE} not created; skipping segment" + fi done # Get video segments durations and write to segments.csv file. @@ -53,8 +59,14 @@ ffmpeg -f concat -i video_sources.txt -c copy -y concat.webm # Convert audio .mjr dumps into .opus files. for FILE in *.audio.mjr; do - ${SCRIPT_ABS_DIR}/janus-pp-rec $FILE ${FILE%.*}.opus - echo "file '${FILE%.*}.opus'" >> audio_sources.txt + OUTPUT_FILE="${FILE%.*}.opus" + ${SCRIPT_ABS_DIR}/janus-pp-rec ${FILE} ${OUTPUT_FILE} + + if [[ -f ${OUTPUT_FILE} ]]; then + echo "file '${OUTPUT_FILE}'" >> audio_sources.txt + else + >&2 echo "[ERROR] ${OUTPUT_FILE} not created; skipping segment" + fi done # Concat audio segments into a single .opus file.