ffmpeg不使用有空格的文件名 [英] ffmpeg not working with filenames that have whitespace

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

问题描述

我正在使用FFMPEG来衡量存储在Amazon S3 Bucket中的视频的持续时间。

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.

任何帮助不胜感激!

推荐答案

您的文件名中的空格,只是引用:

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天全站免登陆