【问题标题】:MP4Box shell script not workingMP4Box shell 脚本不工作
【发布时间】:2015-12-30 03:29:40
【问题描述】:

我正在尝试使用 MP4Box 连接目录中的多个 .mp4 文件。简单形式的基本命令如下所示:

mp4box -cat 'Film.mp4' -cat 'Credits.mp4' -new Total.mp4

我制作了这个脚本,但它不起作用:

#!/bin/bash
files='*.mp4'; for i in $files; do MP4Box -cat "'"$i"'" -new Total.mp4; done

它只是给出:

Error appending '01_Introduction.mp4': Requested URL is not valid or cannot be found
Error - 2 input names specified, please check usage
Error - 2 input names specified, please check usage
Error - 2 input names specified, please check usage
Error - 2 input names specified, please check usage
Error - 2 input names specified, please check usage
Error - 2 input names specified, please check usage
... etc.

我的表达有什么问题?

我同意了:

#!/bin/bash

rm Total.mp4; files='*.mp4'; for i in $files; do
echo " -cat " "'"$i"'" >>input.txt; done

file="input.txt"; name=$(cat "$file"); 

eval "MP4Box " $name " -new Total.mp4"; 

【问题讨论】:

  • 你为什么要在扩展的文件名周围加上单引号?你不想要他们。只需使用"$i" 作为文件名。
  • for 循环之前添加set -x,在done 之后添加set +x。 (外壳调试/跟踪)。您会看到 MP4box 正在为*.mp4 中的每个文件执行,而不是构建一个命令来同时执行。祝你好运。
  • 我用了单引号,因为文件名有空格。

标签: shell mp4box


【解决方案1】:

我同意了:

#!/bin/bash

rm Total.mp4; files='*.mp4'; for i in $files; do
echo " -cat " "'"$i"'" >>input.txt; done

file="input.txt"; name=$(cat "$file"); 

eval "MP4Box " $name " -new Total.mp4";

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-25
    • 2013-10-29
    • 2015-07-24
    • 1970-01-01
    • 2011-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多