有没有办法在转码之前使用ffmpeg来确定文件的编码? [英] Is there a way to use ffmpeg to determine the encoding of a file before transcoding?

查看:181
本文介绍了有没有办法在转码之前使用ffmpeg来确定文件的编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算使用ffmpeg来确保上传到我的网站的所有视频文件被编码为mp4 h264。

I am planning to use ffmpeg to ensure all video files uploaded to my website are encoded as mp4 h264.

而不是自动处理每个文件,我想通过仅处理那些尚未mp4 h264的文件来最小化处理开销。使用ffmpeg还是使用另一个命令行实用程序,是否有简单的方法?

Rather than automatically processing every file I would like to minimise the processing overhead by only processing those files that are not already mp4 h264. Is there an easy way to do this either with ffmpeg or with another command line utility?

推荐答案

如果将输入文件传递给ffmpeg,没有其他参数,将会提供有关视频源的信息:

If you pass an input file to ffmpeg, without other parameters, it will give you information about the video source:

ffmpeg -i myfile.avi

另一种方式是mplayer的 -identify 选项,可能会更容易解析。有一个包装脚本 midentify ,它给你更好的输出。请参阅这个例子。

Another way would be the -identify option of mplayer, which might be slightly easier to parse. There is a wrapper script midentify which gives you even better output. See this example.

这篇关于有没有办法在转码之前使用ffmpeg来确定文件的编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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