Ffprobe with print json doesn't print anything

2019-05-06 05:57发布

问题:

I am trying to get information about a movie (resolution, frame rate, bit rate, codecs, duration etc) in a human readable way. I found this commnad:

ffprobe -v quiet -print_format json -show_format -show_streams somefile.asf

In this Stack Overflow question: Get ffmpeg information in friendly way

But it doesn't work for me. When I try it in a terminal, the output is empty:

richard@richard-desktop:~/projects/hello-python$ ffprobe -v quiet -print_format json -show_format -show_streams tests/test_1.mpg 
richard@richard-desktop:~/projects/hello-python$ 

回答1:

Ok, the current version of ffmpeg in Ubuntu repos is not up to date.

What I did was I added this more up to date repository:

sudo add-apt-repository ppa:jon-severinsson/ffmpeg

And then did:

sudo apt-get remove ffmpeg
sudo apt-get autoremove
sudo apt-get update
sudo apt-get install ffmpeg

And voila. It works and I get correct JSON output from ffprobe :)