Use of basic shell script statements (1)

1. Number multiplication operations

1. Addition

a=1
echo $a
b=123
let a=$a+$b
echo $a

The obtained a is 1+123=124

2. Video editing (FFmpeg)

1. Cut the specified clip

ffmpeg -ss 10 -t 60 -y -i "${input_video}" "${out_video}"
  • 10 means starting from the 10th second, and 60 means intercepting 60 seconds of video clips.
  • input_video is the input video path
  • out_video is the output video path.

3. Currently used shell command segment

1. Capture 10s-70s of all videos in the current folder

video_path="./video_input"
files=$(ls $video_path)
echo ${files}
i=0
for video in $files
do
    video=$video_path/$video
    echo ${video}
    let i=$i+1
    out_video=$i".mp4"
    out_video=$video_path/$out_video
    echo $out_video
    ffmpeg -ss 10 -t 60 -y -i "${video}" "${out_video}"
    # 10表示从第十秒开始 60表示截取60秒的视频
done

Guess you like

Origin blog.csdn.net/weixin_44463519/article/details/126202260