How to parse ffmpeg info in PHP?

前端 未结 4 1730
梦谈多话
梦谈多话 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:38

    You can use ffprobe which has an option to output JSON format.

    Take a look at this example:

    ffprobe -v quiet -print_format json -show_format Ramp\ -\ Apathy.mp3

    Which produces the follwing output:

    {
        "format": {
            "filename": "Ramp - Apathy.mp3",
            "nb_streams": 2,
            "format_name": "mp3",
            "format_long_name": "MP2/3 (MPEG audio layer 2/3)",
            "start_time": "0.000000",
            "duration": "203.638856",
            "size": "4072777",
            "bit_rate": "159999",
            "tags": {
                "title": "Apathy",
                "artist": "Ramp",
                "album": "Evolution Devolution Revolution",
                "date": "1999",
                "genre": "Metal"
            }
        }
    }
    

    I'm using ffprobe version 1.0.7.

提交回复
热议问题