gpt4 book ai didi

bash - 使用 FFMPEG 递归扫描和识别视频文件

转载 作者:行者123 更新时间:2023-12-04 23:21:01 25 4
gpt4 key购买 nike

更新
感谢大家分享您的建议。通过如下修改,我能够正常工作。

#!/bin/bash

ROOTPATH="/Volumes/NVME-RAID/ASSET-Processing/CORRUPT-SCAN/SCAN " # manually define root path to your folder that has subfolders
for subdir in *; do
cd ${ROOTPATH}${subdir}
mkdir 00errors

for path in *.{MOV,mov,MP4,mp4}; do

ffmpeg -i "${path}" -f null -; echo$?
RC=$?

if [ "${RC}" -ne "0" ]; then
# Do something to handle the error.
mv ${path} ./00errors
fi

done
cd ../
done
我现在唯一的问题是它似乎没有遍历子文件夹。据我了解,它应该在每个子文件夹中创建一个“00errors”文件夹,并在该子文件夹中移动错误文件。
试图筛选 14TB 的恢复视频...
我试图弄清楚如何正确转换这个脚本,以便它可以在 bash/MacOS 上运行。因为 MacOS 不使用 /mnt,所以我会遇到“ROOTPATH”调用。
#!/bin/bash

ROOTPATH="/mnt/f/00test/" # manually define root path to your folder that has subfolders
for subdir in *; do
cd ${ROOTPATH}${subdir}
mkdir 00errors

for path in *.mp4; do

ffmpeg error -i "${path}"
RC=$?

if [ "${RC}" -ne "0" ]; then
# Do something to handle the error.
mv ${path} ./00errors
fi

done
cd ../
done
编号 Quickly check the integrity of video files inside a directory with ffmpeg

最佳答案

如果您的测试目录在您的主目录中 /Users/username又名 ~ :

ROOTPATH="~/00test" # manually define ROOTPATH to your folder that has subfolders
for subdir in *; do
cd ${ROOTPATH}/${subdir}
我遵循约定不在路径中使用斜杠;在这里,我将斜杠移至 cd 命令。

关于bash - 使用 FFMPEG 递归扫描和识别视频文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66408392/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com