ffmpeg的不是有空格的文件名工作 [英] ffmpeg not working with filenames that have whitespace

查看:1369
本文介绍了ffmpeg的不是有空格的文件名工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用FFMPEG来衡量存储在Amazon S3的桶的视频时长。

I'm using FFMPEG to measure the duration of videos stored in an Amazon S3 Bucket.

我看过FFmpeg的文档,并且他们明确规定所有的空白和特殊字符需要转义,为了FFMPEG,妥善处理中:

I've read the FFMPEG docs, and they explicitly state that all whitespace and special characters need to be escaped, in order for FFMPEG to handle them properly:

请参阅文档2.1和2.1.1: https://ffmpeg.org/ffmpeg-utils.html

See docs 2.1 and 2.1.1: https://ffmpeg.org/ffmpeg-utils.html

然而,随着文件的文件名包含空格打交道时,FFMPEG无法呈现的结果。

However, when dealing with files whose filenames contain whitespace, ffmpeg fails to render a result.

我试过以下,但没有成功。

I've tried the following, with no success

ffmpeg -i "http://s3.mybucketname.com/videos/my\ video\ file.mov" 2>&1 | grep Duration | awk '{print $2}' | tr -d
ffmpeg -i "http://s3.mybucketname.com/videos/my video file.mov" 2>&1 | grep Duration | awk '{print $2}' | tr -d
ffmpeg -i "http://s3.mybucketname.com/videos/my'\' video'\' file.mov" 2>&1 | grep Duration | awk '{print $2}' | tr -d
ffmpeg -i "http://s3.mybucketname.com/videos/my\ video\ file.mov" 2>&1 | grep Duration | awk '{print $2}' | tr -d

不过,如果我在文件名中去掉空白 - 一切都很好,并返回视频的持续时间。

However, if I strip out the whitespace in the filename – all is well, and the duration of the video is returned.

任何帮助AP preciated!

Any help is appreciated!

推荐答案

如果你碰巧有您的文件名称空间,只是引用他们:

If you happen to have spaces in your file name, just quote them:

ffmpeg -i "my video file.mov"

在一个URL,一个空间不能有。最可能的是你有更换每一个空间 20%,使您获得:

In a URL, a space cannot be there. Most probably you have to replace every single space with a %20, so that you get:

ffmpeg -i http://myurl.com/my%20video%20file.mov
                             ^^^     ^^^

这篇关于ffmpeg的不是有空格的文件名工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆