Skip to content

Commit 00a07de

Browse files
committed
增加ffmpeg和ifv转码下载选项
1 parent 22fb3df commit 00a07de

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

setup-services.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,63 @@ if [[ -n "$SSL_CERT_VAL" ]] && [[ "$SELECTED_EXAMPLE" == *"https"* || "$SELECTED
357357
echo -e "${YELLOW}=================================================${NC}"
358358
fi
359359

360+
# --- 5. Install Optional Tools (FFmpeg & ifv2mp4) ---
361+
echo -e "\n${BLUE}Optional Tools Installation (FFmpeg & ifv2mp4)${NC}"
362+
echo -e "These tools are recommended for video processing services (e.g. jtt808)."
363+
364+
if [ "$AUTO_YES" == "true" ]; then
365+
INSTALL_TOOLS="n"
366+
echo -e "${YELLOW}Skipping optional tools in non-interactive mode.${NC}"
367+
else
368+
read -p "Install video processing tools (FFmpeg, ifv2mp4)? (y/N) " INSTALL_TOOLS
369+
fi
370+
371+
if [[ "$INSTALL_TOOLS" == "y" || "$INSTALL_TOOLS" == "Y" ]]; then
372+
OPT_DIR="$TARGET_DIR/opt"
373+
mkdir -p "$OPT_DIR"
374+
375+
# 1. FFmpeg
376+
if [[ -f "$OPT_DIR/ffmpeg" && -f "$OPT_DIR/ffprobe" ]]; then
377+
echo -e "${GREEN}FFmpeg already exists in $OPT_DIR. Skipping download.${NC}"
378+
else
379+
echo -e "${BLUE}Installing FFmpeg...${NC}"
380+
curl -L -o "$OPT_DIR/ffmpeg.tar.xz" "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz"
381+
382+
if [ -f "$OPT_DIR/ffmpeg.tar.xz" ]; then
383+
echo "Extracting FFmpeg..."
384+
tar -xf "$OPT_DIR/ffmpeg.tar.xz" -C "$OPT_DIR"
385+
386+
# Flatten structure: move binaries to $OPT_DIR
387+
FFMPEG_SUBDIR=$(find "$OPT_DIR" -maxdepth 1 -type d -name "ffmpeg-*-static" | head -n 1)
388+
if [ -n "$FFMPEG_SUBDIR" ]; then
389+
cp "$FFMPEG_SUBDIR/ffmpeg" "$FFMPEG_SUBDIR/ffprobe" "$OPT_DIR/"
390+
echo -e "${GREEN}FFmpeg installed to: $OPT_DIR${NC}"
391+
fi
392+
rm "$OPT_DIR/ffmpeg.tar.xz"
393+
else
394+
echo -e "${RED}Failed to download FFmpeg.${NC}"
395+
fi
396+
fi
397+
398+
# 2. ifv2mp4
399+
IFV_DIR="$OPT_DIR/ifv2mp4"
400+
if [[ -f "$IFV_DIR/release/tlgrectomp4" ]]; then
401+
echo -e "${GREEN}ifv2mp4 already exists in $IFV_DIR. Skipping download.${NC}"
402+
else
403+
echo -e "${BLUE}Installing ifv2mp4...${NC}"
404+
mkdir -p "$IFV_DIR"
405+
curl -L -o "$IFV_DIR/tlg.tar.gz" "https://github.com/TranscodeGroup/docker/releases/download/v1.0.4/tlgrectomp4_linux1.0.0.4.tar.gz"
406+
407+
if [ -f "$IFV_DIR/tlg.tar.gz" ]; then
408+
echo "Extracting ifv2mp4..."
409+
tar -xzf "$IFV_DIR/tlg.tar.gz" -C "$IFV_DIR"
410+
echo -e "${GREEN}ifv2mp4 installed to: $IFV_DIR${NC}"
411+
else
412+
echo -e "${RED}Failed to download ifv2mp4.${NC}"
413+
fi
414+
fi
415+
fi
416+
360417
if [ -n "$INPUT_IP" ]; then
361418
echo -e "\n${GREEN}Service Access URLs:${NC}"
362419
echo -e " HTTP: ${BLUE}http://${INPUT_IP}${NC}"

0 commit comments

Comments
 (0)