2

I am using mediainfo to get the audio duration (in ms)

 .\mediainfo.exe --Output='Audio;%Duration%' file.mkv

Example for mkv with 1 audio: 1367130

Example for mkv with 2 audio tracks: 13671301367130

if the file has several audio tracks,I only want one value, is there is way to instruct mediainfo to only return 1 value? If it helps, in my script I do retrieve the default audio's ID, is there a way to use that to select audio with id=some_id with mediainfo and get the duration of that particular audio file?

thanks

1 Answers1

3

The program does what you request, no space or any other character between 2 values. You may want to append some extra characters after each value e.g. a carriage return:

.\MediaInfo.exe --Output='Audio;%Duration%' file.mkv
102240711022407110224071
.\MediaInfo.exe --Output='Audio;%Duration%\r\n' file.mkv
10224071
10224071
10224071

If you want to add the track ID:

.\MediaInfo.exe --Output='Audio;%ID%: %Duration%\r\n' file.mkv
2: 10224071
3: 10224071
4: 10224071

It is currently not possible to select a specific track but you can use a grep-like command after MediaInfo for peeking what you need.