How to parse ffmpeg info in PHP?

前端 未结 4 1755
梦谈多话
梦谈多话 2020-12-28 23:48

How does one go about getting specific pieces of information, like the \'duration\' from the output of ffmpeg -i /var/thismovie.avi ?

I need frame heigh

4条回答
  •  青春惊慌失措
    2020-12-29 00:36

    Use ffprobe instead.

    ffprobe is the tool packaged with FFmpeg for exactly the sort've purpose you're after: extracting video info. It outputs a variety of easily parsed formats and will be far easier than parsing the incidental information that FFmpeg outputs.

    For example:

    $ ffprobe -show_format -loglevel quiet mptestsrc.mp4 
    [FORMAT]
    filename=mptestsrc.mp4
    nb_streams=1
    format_name=mov,mp4,m4a,3gp,3g2,mj2
    format_long_name=QuickTime/MPEG-4/Motion JPEG 2000 format
    start_time=0.000000
    duration=12.040000
    size=237687
    bit_rate=157931
    TAG:major_brand=isom
    TAG:minor_version=512
    TAG:compatible_brands=isomiso2avc1mp41
    TAG:encoder=Lavf54.20.100
    [/FORMAT]
    

提交回复
热议问题