Getting video dimension / resolution / width x height from ffmpeg

前端 未结 8 1546
粉色の甜心
粉色の甜心 2020-11-27 05:33

How would I get the height and width of a video from ffmpeg\'s information output. For example, with the following output:

$ ffmpeg -i video.mp4         


        
8条回答
  •  -上瘾入骨i
    2020-11-27 05:58

    From Fredrik's tip above, here is how I did it using MediaInfo ( http://mediainfo.sourceforge.net/en ):

    >>> p1 = subprocess.Popen(['mediainfo', '--Inform=Video;%Width%x%Height%',         
        '/Users/david/Desktop/10stest720p.mov'],stdout=PIPE)
    >>> dimensions=p1.communicate()[0].strip('\n')
    >>> dimensions
    '1280x688'
    

提交回复
热议问题