Live video on the AT Protocol
79
fork

Configure Feed

Select the types of activity you want to include in your feed.

port over testing scripts from other place

+74 -21
+29 -17
hack/compare-hash.sh
··· 8 8 BASE_TWO="$(basename "$TWO")" 9 9 10 10 if [[ -d "$ONE" && -d "$TWO" ]]; then 11 - FILES_ONE=$(find "$ONE" -maxdepth 1 -mindepth 1 -type f | xargs -L 1 basename | sort) 12 - FILES_TWO=$(find "$TWO" -maxdepth 1 -mindepth 1 -type f | xargs -L 1 basename | sort) 11 + FILES_ONE=$(find "$ONE" -maxdepth 1 -mindepth 1 -type f -name '*.mp4' | xargs -L 1 basename | sort) 12 + FILES_TWO=$(find "$TWO" -maxdepth 1 -mindepth 1 -type f -name '*.mp4' | xargs -L 1 basename | sort) 13 13 14 14 NUM_FILES_ONE=$(echo "$FILES_ONE" | wc -l) 15 15 NUM_FILES_TWO=$(echo "$FILES_TWO" | wc -l) ··· 20 20 exit 1 21 21 fi 22 22 23 - if ! diff <(echo "$FILES_ONE") <(echo "$FILES_TWO") >/dev/null; then 24 - echo "Directory contents differ (filenames not matching):" 25 - comm -3 <(echo "$FILES_ONE") <(echo "$FILES_TWO") 26 - exit 1 27 - fi 28 - 29 - # Iterate by filename 30 - while read -r f; do 31 - [ -n "$f" ] || continue 32 - "$0" "$ONE/$f" "$TWO/$f" 33 - done <<< "$FILES_ONE" 34 - # after all sub-comparisons 23 + # Compare files by their order in the sorted lists, regardless of filenames 24 + paste <(echo "$FILES_ONE") <(echo "$FILES_TWO") | while read -r file_one file_two; do 25 + # skip if either file entry is empty (may only occur if line counts mismatched, but that's handled above) 26 + [ -n "$file_one" ] && [ -n "$file_two" ] || continue 27 + echo "Comparing $file_one <=> $file_two" 28 + set +e 29 + "$0" "$ONE/$file_one" "$TWO/$file_two" 30 + set -e 31 + done 35 32 exit 0 36 33 fi 37 34 ··· 49 46 50 47 xxd "$ONE" > "1.xxd" 51 48 xxd "$TWO" > "2.xxd" 52 - (diff --color=always "1.xxd" "2.xxd" || true) | head -n 20 49 + (diff --color=always "1.xxd" "2.xxd" || true) | head -n 5 53 50 54 51 ffmpeg -y -loglevel fatal -i "$ONE" -c copy -f framemd5 "1.md5" 55 52 ffmpeg -y -loglevel fatal -i "$TWO" -c copy -f framemd5 "2.md5" 56 - (diff --color=always "1.md5" "2.md5" || true) | head -n 20 53 + (diff --color=always "1.md5" "2.md5" || true) | head -n 5 57 54 58 55 ffprobe -loglevel fatal -show_frames "$ONE" > "1.frames" 59 56 ffprobe -loglevel fatal -show_frames "$TWO" > "2.frames" 60 - (diff --color=always "1.frames" "2.frames" || true) | head -n 20 57 + (diff --color=always "1.frames" "2.frames" || true) | head -n 5 58 + 59 + echo -e "\033[0m" 60 + video_frames_one="$(cat 1.frames | grep media_type=video | wc -l | xargs)" 61 + video_frames_two="$(cat 2.frames | grep media_type=video | wc -l | xargs)" 62 + if [[ "$video_frames_one" -ne "$video_frames_two" ]]; then 63 + echo "Video frame count mismatch: $video_frames_one -> $video_frames_two" 64 + exit 1 65 + fi 66 + 67 + audio_frames_one="$(cat 1.frames | grep media_type=video | wc -l | xargs)" 68 + audio_frames_two="$(cat 2.frames | grep media_type=video | wc -l | xargs)" 69 + if [[ "$audio_frames_one" -ne "$audio_frames_two" ]]; then 70 + echo "Audio frame count mismatch: $audio_frames_one -> $audio_frames_two" 71 + exit 1 72 + fi 61 73 62 74 # ffmpeg -y -loglevel fatal -i "$ONE" -frames:v 1 -c copy -an 1frame.h264 63 75 # ffmpeg -y -loglevel fatal -i "$TWO" -frames:v 1 -c copy -an 2frame.h264
+31
hack/compare-oneshot.sh
··· 1 + #!/bin/bash 2 + 3 + # Test that we can combine then split segments and get the same files 4 + 5 + set -euo pipefail 6 + 7 + SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 8 + 9 + # Detect platform/arch for correct build dir 10 + UNAME_S=$(uname -s | tr '[:upper:]' '[:lower:]') 11 + UNAME_M=$(uname -m) 12 + if [[ "$UNAME_S" == "darwin" && "$UNAME_M" == "arm64" ]]; then 13 + BUILD_DIR="build-darwin-arm64" 14 + elif [[ "$UNAME_S" == "linux" && "$UNAME_M" == "x86_64" ]]; then 15 + BUILD_DIR="build-linux-amd64" 16 + else 17 + echo "Unsupported platform: $UNAME_S/$UNAME_M" 18 + exit 1 19 + fi 20 + 21 + DEBUG_DIR="$(mktemp -d)" 22 + mkdir -p "$DEBUG_DIR/segments" 23 + set +e 24 + $SCRIPT_DIR/../$BUILD_DIR/streamplace combine --debug-dir="$DEBUG_DIR/segments-1" "$DEBUG_DIR/combined.mp4" $(find "$@" -name '*.mp4' | sort) 25 + EXIT_CODE=$? 26 + set -e 27 + if [ $EXIT_CODE -ne 0 ]; then 28 + $SCRIPT_DIR/compare-hash.sh "$@" "$DEBUG_DIR/segments-1" 29 + exit $EXIT_CODE 30 + fi 31 + echo "Success"
+14 -4
hack/compare-roundtrip.sh
··· 3 3 # Test that we can combine then split segments and get the same files 4 4 5 5 set -euo pipefail 6 - set -x 7 6 8 7 SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 9 8 9 + # Detect platform/arch for correct build dir 10 + UNAME_S=$(uname -s | tr '[:upper:]' '[:lower:]') 11 + UNAME_M=$(uname -m) 12 + if [[ "$UNAME_S" == "darwin" && "$UNAME_M" == "arm64" ]]; then 13 + BUILD_DIR="build-darwin-arm64" 14 + elif [[ "$UNAME_S" == "linux" && "$UNAME_M" == "x86_64" ]]; then 15 + BUILD_DIR="build-linux-amd64" 16 + else 17 + echo "Unsupported platform: $UNAME_S/$UNAME_M" 18 + exit 1 19 + fi 20 + 10 21 DEBUG_DIR="$(mktemp -d)" 11 - mkdir -p "$DEBUG_DIR/segments" 12 22 set +e 13 - $SCRIPT_DIR/../build-darwin-arm64/streamplace combine --debug-dir="$DEBUG_DIR/segments-1" "$DEBUG_DIR/combined.mp4" $(find "$@" -name '*.mp4' | sort) 14 - $SCRIPT_DIR/../build-darwin-arm64/streamplace combine --debug-dir="$DEBUG_DIR/segments-2" "$DEBUG_DIR/combined2.mp4" $(find "$DEBUG_DIR/segments-1" -name '*.mp4' | sort) 23 + $SCRIPT_DIR/../$BUILD_DIR/streamplace combine --debug-dir="$DEBUG_DIR/segments-1" "$DEBUG_DIR/combined.mp4" $(find "$@" -name '*.mp4' | sort) 24 + $SCRIPT_DIR/../$BUILD_DIR/streamplace combine --debug-dir="$DEBUG_DIR/segments-2" "$DEBUG_DIR/combined2.mp4" $(find "$DEBUG_DIR/segments-1" -name '*.mp4' | sort) 15 25 EXIT_CODE=$? 16 26 set -e 17 27 if [ $EXIT_CODE -ne 0 ]; then