Getting video information from MediaInfo

To get the file sizes, I can do:

$ mediainfo '--Inform=Video;%Width%x%Height%' ~/Desktop/lawandorder.mov 1920x1080 

However, if I give a URL instead of a file, it returns None:

 $ mediainfo '--Inform=Url;%Width%x%Height%' 'http://url/lawandorder.mov' (none) 

How to pass URL in MediaInfo ?

+8
source share
2 answers

You can also use curl | head curl | head to partially download the file before running mediainfo .

Here is an example of getting a file size of 12 MB from the Internet, where you need to download only a small part (less than 10 KB):

 curl --silent http://www.jhepple.com/support/SampleMovies/MPEG-2.mpg \ | head --bytes 10K > temp.mpg mediainfo '--Inform=Video;%Width%x%Height%' temp.mpg 
+5
source

To do this, I needed to recompile the source code using the -with-libcurl option.

 $ ./CLI_Compile.sh --with-libcurl $ cd MediaInfo/Project/GNU/CLI $ make install 

Then I used this command to get the video sizes via http:

 $ mediainfo '--Inform=Video;%Width%x%Height%' 'http://url/lawandorder.mov' 

Please note: it took a considerable amount of time to return the results. I would recommend using ffmpeg if the file is not local.

0
source

Source: https://habr.com/ru/post/897070/


All Articles