From 14327a3a49ded0c72ba63270d21763ada465f42b Mon Sep 17 00:00:00 2001 From: Mikhail Serebryakov Date: Sat, 3 Oct 2026 23:26:44 +0500 Subject: первый шаг - экспорт видео с аудиодорожками из Telegram-чата MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/00-export-videos.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 scripts/00-export-videos.sh (limited to 'scripts') diff --git a/scripts/00-export-videos.sh b/scripts/00-export-videos.sh new file mode 100755 index 0000000..42f5d6f --- /dev/null +++ b/scripts/00-export-videos.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +CHAT_EXPORT="$1" + +jq \ + -r '.messages | map(select(.media_type == "video_file")) | .[].file' \ + "$CHAT_EXPORT/result.json" | while read -r file; do + + FILE="$CHAT_EXPORT/$file" + + ffprobe \ + -v quiet \ + -print_format json \ + -select_streams a \ + -show_streams \ + "$FILE" > "$FILE.tmp.json" + + HAS_AUDIO="$(jq '.streams | length > 0' "$FILE.tmp.json")" + + if [ "$HAS_AUDIO" = "true" ]; then + + cp "$FILE" videos/$(basename "$FILE") + + fi + + rm "$FILE.tmp.json" + +done -- cgit v1.3