double quotes escaping in golang exec

六月ゝ 毕业季﹏ 提交于 2019-12-03 15:58:06

When you execute the given ffmpeg command line, your shell parses it into a set of command line arguments that are essentially:

{
    "ffmpeg",
    "-i",
    "input.jpg",
    "-vf",
    "scale='if(gt(a,4/3),320,-1)':'if(gt(a,4/3),-1,240)'",
    "output_320x240_boxed.png",
}

The extra quotes in the scale=... argument interpreted by the shell, rather than being passed on to the underlying program. So when executing the same program with Go, where you are passing a list of arguments directly, you should leave out those extra quotes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!