如何從ffmpeg
的信息輸出中獲取視頻的高度和寬度。例如,下面的輸出 -從ffmpeg獲取視頻尺寸-i
$ ffmpeg -i 1video.mp4
...
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/david/Desktop/1video.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1
creation_time : 2010-01-24 00:55:16
Duration: 00:00:35.08, start: 0.000000, bitrate: 354 kb/s
Stream #0.0(und): Video: h264 (High), yuv420p, 640x360 [PAR 1:1 DAR 16:9], 597 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc
Metadata:
creation_time : 2010-01-24 00:55:16
Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 109 kb/s
Metadata:
creation_time : 2010-01-24 00:55:17
At least one output file must be specified
如何,我會得到height = 640, width= 360
?謝謝。
完美,非常感謝你。 – David542
這個測試失敗,因爲流信息是流#0:0:視頻:mjpeg(MJPG/0x47504A4D),yuvj420p(pc,bt470bg /未知/未知),733x446 [SAR 1:1 DAR 733: 446],7516 kb/s,60 fps,60 tbr,60 tbn,60 tbc',所以結果是[] [] [] [] [] [] [] [] [] [] [] [] [] ['0x47504','733x446'] []' –