从FFmpeg获取视频的宽高比 [英] Get aspect ratio of video from FFmpeg

查看:1180
本文介绍了从FFmpeg获取视频的宽高比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FFmpeg将视频从一种格式转换为另一种格式。我需要首先提取视频的宽高比。如何找到这些信息?

I am using FFmpeg to convert a video from one format to another. I need to extract the aspect ratio of the video first. How can I find that information?

推荐答案

只需运行

ffmpeg -i <yourfilename>

,文件中包含的视频流的详细信息将打印到屏幕上。为每个视频流列出的两个参数将是PAR(像素长宽比)和DAR(显示宽高比)。你会看到这样的:

and details about the video stream/s contained in the file will be printed to the screen. Two of the parameters listed for each video stream will be the PAR (Pixel Aspect Ratio) and DAR(Display Aspect Ratio). You'll see something like this:

 Stream #0.10[0x258]: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:9], 4350 kb/s, 27.97 fps, 25 tbr, 90k tbn, 50 tbc

DAR是最终显示的视频的比例。 PAR指示像素的尺寸必须如何实现。例如,在刚刚显示的情况下,(720 * 64)/(576 * 45)= 16/9

The DAR is what ratio the final displayed video will have. The PAR indicates how the pixels have to be sized to achieve this. For example, in the case I just showed, (720*64)/(576*45) = 16/9.

很多时候,PAR将等于1:1,这意味着DAR应等于视频分辨率的比例。

Many times, PAR will be equal to 1:1, which means that the DAR should be equal to the ratio of the video resolution.

这篇关于从FFmpeg获取视频的宽高比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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