| input_file="/mnt/bn/yufan-dev-my/ysh/Ckpts/SpatialVID/e6d91e1b-e366-5fa9-aef4-9769eb0bf631.mp4" | |
| output_file="output_trimmed.mp4" | |
| # 获取总帧数 | |
| total_frames=$(ffprobe -v quiet -select_streams v:0 -count_frames -show_entries stream=nb_frames -of csv=p=0 "$input_file") | |
| # 计算要保留的帧数 | |
| keep_frames=$((total_frames - 19)) | |
| # 执行裁剪 | |
| ffmpeg -i "$input_file" -vf "select='lt(n,$keep_frames)'" -vsync 0 -c:a copy "$output_file" | |
| echo "处理完成: $output_file" | |
| echo "原始帧数: $total_frames" | |
| echo "保留帧数: $keep_frames" | |