【发布时间】:2017-10-16 11:40:30
【问题描述】:
我在 bash 脚本 encode.sh 中有以下脚本。
echo "1 configuration out of 936"
x265 incident_10d_384x288_25.yuv --input-res 384x288 --fps 25 str/incident_10d_384x288_25_QP_0_ON_B0.bin --tune psnr --psnr --preset medium --max-merge 5 --merange 64 --no-open-gop -I 48 -i 8 --tu-intra-depth 3 --tu-inter-depth 3 --input-depth 8 --aq-mode 0 --b-adapt 0 --scenecut 48 --ref 4 --sao --deblock=0:0 --bframes 0 --qp 0 --csv-log-level 2 --log-level 4 --csv csv/incident_10d_384x288_25_QP_0_ON_B0.csv > txt/1_incident_10d_384x288_25_QP_0_ON_B0.txt 2<&1
echo "2 configuration out of 936"
x265 incident_10d_384x288_25.yuv --input-res 384x288 --fps 25 str/incident_10d_384x288_25_QP_1_ON_B0.bin --tune psnr --psnr --preset medium --max-merge 5 --merange 64 --no-open-gop -I 48 -i 8 --tu-intra-depth 3 --tu-inter-depth 3 --input-depth 8 --aq-mode 0 --b-adapt 0 --scenecut 48 --ref 4 --sao --deblock=0:0 --bframes 0 --qp 1 --csv-log-level 2 --log-level 4 --csv csv/incident_10d_384x288_25_QP_1_ON_B0.csv > txt/2_incident_10d_384x288_25_QP_1_ON_B0.txt 2<&1
echo "3 configuration out of 936"
x265 incident_10d_384x288_25.yuv --input-res 384x288 --fps 25 str/incident_10d_384x288_25_QP_2_ON_B0.bin --tune psnr --psnr --preset medium --max-merge 5 --merange 64 --no-open-gop -I 48 -i 8 --tu-intra-depth 3 --tu-inter-depth 3 --input-depth 8 --aq-mode 0 --b-adapt 0 --scenecut 48 --ref 4 --sao --deblock=0:0 --bframes 0 --qp 2 --csv-log-level 2 --log-level 4 --csv csv/incident_10d_384x288_25_QP_2_ON_B0.csv > txt/3_incident_10d_384x288_25_QP_2_ON_B0.txt 2<&1
我想使用> txt/3_incident_10d_384x288_25_QP_2_ON_B0.txt 2<&1 将终端中每个编码的输出写入一个txt 文件。我使用python 2.7 从windows 创建了bash 脚本,我想在ubuntu 中运行它。
当我从 bash 脚本复制一行并在终端中运行它时,它正在工作。但是当我想从批处理文件中运行它时它不起作用。
我在终端中没有收到错误,但x265 编码器没有运行并出现警告:
[warning]: extra unused command arguments given <
我的 shell 脚本中有什么特殊字符吗?
你知道如何解决这个问题吗?
【问题讨论】:
-
我想你正在寻找
2>&1,将标准错误重定向到当前打开的标准输出。 -
2<&1应该做什么?如果你想将标准输出重定向到标准错误,那就是1>&2,或者将标准错误重定向到标准输出:2>&1
标签: python bash shell ubuntu libx265