How to print both filename and duration using mediainfo?

517 Views Asked by At

How to find duration of a video file using mediainfo in seconds or other formats?

This page only shows how to print the duration of a media file. I want to show both filename and duration for many media files.

The output should in the format of the following.

filename<TAB>duration

How can I call mediainfo to get this result?

1

There are 1 best solutions below

3
Jérôme Martinez On

This page only shows how to print the duration of a media file.

Actually it shows also how to print more than one item, see e.g. "iv)" in the best answer, you may adapt it for your needs.

filename<TAB>duration

Example:

$ mediainfo mediainfo --Inform="General;%CompleteName%,%Duration%" [inputfile]

tab is replaced by a comma, the command line interface does not permit the tab.

for a tab, you need to create a file e.g. template.csv with:

General;%CompleteName%<TAB>%Duration%

(replace "<TAB>" by a real tab character)

Then:

$ mediainfo mediainfo --Inform=file://template.csv [inputfile]

Jérôme, main developer of MediaInfo.