我有这个脚本:
extract.sh:
ffmpeg –i $1 –ss $2 –t $3 –c:v copy –c:a copy $4
如果我输入
ffmpeg –i full.mp4 –ss 114 –t 30 –c:v copy –c:a copy out.mp4
一切顺利但是,如果我尝试
sh extract.sh full.mp4 114 30 out.mp4
我明白了:
ffmpeg version 2.1 Copyright (c) 2000-2013 the FFmpeg developers
built on May 5 2014 11:41:48 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl
libavutil 52. 48.100 / 52. 48.100
libavcodec 55. 39.100 / 55. 39.100
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
[NULL @ 0x2a20b00] Unable to find a suitable output format for '–i'
–i: Invalid argument
对于使脚本无法读取的参数,sh做了什么?
编辑:
user@domain:~/test$ sh extract.sh cdr.mp4 0 7 generique.mp4
ffmpeg –i cdr.mp4 –ss 0 –t 7 –c:v copy –c:a copy generique.mp4
答案 0 :(得分:0)
我最终重写了sh文件,似乎其中有一个隐形字符,其中包含在命令中。