小编ucq*_*ose的帖子

FFmpeg 脚本跳过文件

我编写了一个 shell 脚本来转换许多视频文件,并在文件名后附加一些内容来保存它们。该脚本有效,但它似乎随机跳过文件,而且很多。

当我重新运行脚本时,它会转换之前跳过的文件。我怎样才能让它停止跳过文件?

workingDir=/home/user/Videos

# get list of files to convert
find /video/folder -iname "*.mp4" > $workingDir/file_list

# convert files
cat $workingDir/file_list | while read LINE; do
    # FFmpeg often cuts off the beginning of this line
    echo "$(dirname "$LINE")/$(basename "$LINE")"
    if /usr/bin/ffmpeg -n -loglevel panic -v quiet -stats -i "$LINE" \
        -c:v libx264 -vf scale="trunc(oh*a/2)*2:320" \
        -pix_fmt yuv420p -preset:v slow -profile:v main -tune:v animation -crf 23 \
        "$(dirname "$LINE")/$(basename "$LINE" \.mp4)"_reencoded.mp4 2>/dev/null; then
            echo "Success: $(dirname "$LINE")/$(basename "$LINE")" …
Run Code Online (Sandbox Code Playgroud)

bash shell ffmpeg

5
推荐指数
1
解决办法
319
查看次数

标签 统计

bash ×1

ffmpeg ×1

shell ×1