admin管理员组

文章数量:1122846

I'll explain the scenario better: I set up a karaoke "system" with a frontend called Attract Mode, in Linux Mint 22, where the videos are played by VLC. The command line that plays the video looks like this: --aspect-ratio=16:9 --no-video-title-show --play-and-exit --fullscreen "[romfilename]" /home/pc/KARAOKE/NOTA/nota.mp4, where "[romfilename]" is the file to be played and the second video is the note displayed at the end of the first video playback.

The target of this script is the second video, which will vary with each execution. At first, I thought that each time this script ran the loop, it would modify the Nota.mp4 file with another one that would have a different "note" for the singers.

Despite using Linux, I don't have much knowledge of shell scripting.

I tried to create this .sh but as there are several files in the base, I didn't understand how to make it run in a loop.

I'll explain the scenario better: I set up a karaoke "system" with a frontend called Attract Mode, in Linux Mint 22, where the videos are played by VLC. The command line that plays the video looks like this: --aspect-ratio=16:9 --no-video-title-show --play-and-exit --fullscreen "[romfilename]" /home/pc/KARAOKE/NOTA/nota.mp4, where "[romfilename]" is the file to be played and the second video is the note displayed at the end of the first video playback.

The target of this script is the second video, which will vary with each execution. At first, I thought that each time this script ran the loop, it would modify the Nota.mp4 file with another one that would have a different "note" for the singers.

Despite using Linux, I don't have much knowledge of shell scripting.

I tried to create this .sh but as there are several files in the base, I didn't understand how to make it run in a loop.

Share Improve this question asked Nov 22, 2024 at 2:40 Cara do TICara do TI 1 1
  • Please read the How-to-ask and On-topic sections in the help center. Good luck. – shellter Commented Nov 22, 2024 at 5:31
Add a comment  | 

1 Answer 1

Reset to default 0

Put the videos you want to play in a folder, then just loop through them

#!/bin/bash

# Directory containing the karaoke videos and note videos
KARAOKE_DIR=/home/pc/KARAOKE/VIDEOS
NOTE_DIR=/home/pc/KARAOKE/NOTES

# List all the karaoke video files (you can adjust the pattern to match your files)
KARAOKE_VIDEOS=($KARAOKE_DIR/*.mp4)

# Loop through all karaoke videos
for karaoke_video in "${KARAOKE_VIDEOS[@]}"; do
    vlc --aspect-ratio=16:9 --no-video-title-show --play-and-exit --fullscreen "$karaoke_video"
    NOTE_VIDEO="$NOTE_DIR/nota.mp4"
    vlc --aspect-ratio=16:9 --no-video-title-show --play-and-exit --fullscreen "$NOTE_VIDEO"
done

本文标签: linuxHow to create a script that copies and renames a file to a certain folderStack Overflow