Re: Length of a video file (.avi, .mpg) from the command line

2019-08-14 Thread Michael Lange
Hi,

On Wed, 14 Aug 2019 17:43:42 +0200 (CEST)
Jean-Baptiste Thomas  wrote:

> Can anyone recommend a command line program that could tell me
> the length of the video stream in a .avi or .mpg file ? Thanks
> in advance.
> 

as Jonas already suggested, I would use mediainfo, with for example

$ mediainfo --Inform="Video;%Duration/String3%" 

which will output something like:

01:58:39.029

See 

$ mediainfo --Info-Parameters

for a list of possible output parameters and formats.

Regards

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

On my planet, to rest is to rest -- to cease using energy.  To me, it
is quite illogical to run up and down on green grass, using energy,
instead of saving it.
-- Spock, "Shore Leave", stardate 3025.2



Re: Length of a video file (.avi, .mpg) from the command line

2019-08-14 Thread Jonas Smedegaard
Quoting Jean-Baptiste Thomas (2019-08-14 17:43:42)
> Can anyone recommend a command line program that could tell me
> the length of the video stream in a .avi or .mpg file ? Thanks
> in advance.

mediainfo

Ffmpeg and mpv also can do this, but IMO mediainfo is the right tool for 
this specific task.


 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private



Re: Length of a video file (.avi, .mpg) from the command line

2019-08-14 Thread Andy Smith
Hi,

On Wed, Aug 14, 2019 at 05:43:42PM +0200, Jean-Baptiste Thomas wrote:
> Can anyone recommend a command line program that could tell me
> the length of the video stream in a .avi or .mpg file ?

ffprobe from the ffmpeg package can extract the duration, and offers
programmatically-friendly output formats such as CSV, JSON and so
on.

http://trac.ffmpeg.org/wiki/FFprobeTips#Duration

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting



Re: Length of a video file (.avi, .mpg) from the command line

2019-08-14 Thread Dan Ritter
Jean-Baptiste Thomas wrote: 
> Can anyone recommend a command line program that could tell me
> the length of the video stream in a .avi or .mpg file ? Thanks
> in advance.

If you invoke

mplayer -vo none -ao none 

you will get a set of statistics which include the resolution, 
frame rate, and encoding rate for both video and audio streams.

A little addition and division with the total size of the file
should get you a good idea.

ffmpeg -i 

will do a similar set of stats, including doing some math for
you. (Look at "duration" in the output.)

However, everything is only *likely* to be correct, because
there are a number of encodings which can cause variable length.


-dsr-



Length of a video file (.avi, .mpg) from the command line

2019-08-14 Thread Jean-Baptiste Thomas
Can anyone recommend a command line program that could tell me
the length of the video stream in a .avi or .mpg file ? Thanks
in advance.