How to find the length of MP4 file in cygwin?

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to find the length of MP4 file in cygwin?
# 1  
Old 11-26-2013
How to find the length of MP4 file in cygwin?


Apologies if I'm posting in wrong section.

How can I find length (duration) of MP4 videos and m4a audio files on cygwin?

I heard about mediainfo, ffmpeg, avconv utilities on Linux platform but not sure if they work (or available) on cygwin.

Please advise,
# 2  
Old 11-27-2013
Why not just use the windows Mediainfo CLI exe you can download it from here.

You will need to convert your cygwin path to a windows path, I then used awk to extract the first Duration (usually the video stream) something like this:

CYGPATH="$(readlink -f "$1")"
DOSPATH="$(cygpath -w "$CYGPATH")"
/usr/local/bin/windows/Mediainfo.exe "$DOSPATH" | awk -F: '/Duration/ { print $2; exit}'

---------- Post updated at 07:48 PM ---------- Previous update was at 05:25 PM ----------

Or for the duration of the audio track in ms you could do:

/usr/local/bin/windows/Mediainfo.exe '--Inform=Audio;"%Duration%"' "$DOSPATH"

This User Gave Thanks to Chubler_XL For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Wget for downloading a public file (stream) as mp4

I need a hint for using wget for getting a free content from a TV station that is streaming its material for a while until it appears on any video platform, that means no use of illegal methods, because it is on air, recently published and available. But reading the manual for wget I tried the... (5 Replies)
Discussion started by: 1in10
5 Replies

2. UNIX for Advanced & Expert Users

howto remove meta info about MP4 or FLV file downloaded off Youtube?

Hi I tried a tool called mediainfo > brew info media-info media-info 0.7.51 Depends on: pkg-config /usr/local/Cellar/media-info/0.7.51 (3 files, 14M) Got details from a test... (3 Replies)
Discussion started by: slashdotweenie
3 Replies

3. Shell Programming and Scripting

Find the length of each line in the file

Hi, I want to find the length of each line(including all the characters, spaces etc.) in a file and check if all the lines are of same length using a ksh script. Please help. Thanks in advance. (7 Replies)
Discussion started by: Suryaaravindh
7 Replies

4. Linux

convert avi to cellphone friendly 320x176 mp4 file...ffmpeg to the rescue :)

found a few ffmpeg posts and after a few unsuccessful attempts, I have found a solution :) to encode an avi to to an nokia e71 recognized mp4 format: ffmpeg -y -i inputFILE.avi -acodec aac -ab 72k -s 320x176 -aspect 16:9 -vcodec h264 -b 300k -qcomp 0.6 -qmin 16 -qmax 51 -qdiff 4 -flags +loop... (2 Replies)
Discussion started by: mr_manny
2 Replies

5. UNIX for Dummies Questions & Answers

Convert a tab delimited/variable length file to fixed length file

Hi, all. I need to convert a file tab delimited/variable length file in AIX to a fixed lenght file delimited by spaces. This is the input file: 10200002<tab>US$ COM<tab>16/12/2008<tab>2,3775<tab>2,3783 19300978<tab>EURO<tab>16/12/2008<tab>3,28523<tab>3,28657 And this is the expected... (2 Replies)
Discussion started by: Everton_Silveir
2 Replies

6. UNIX for Dummies Questions & Answers

What the command to find out the record length of a fixed length file?

I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies

7. Shell Programming and Scripting

How To Find Length of a Field in XML File

Hi I have a xml file with below data...have to find the length of the filedvalues... <?xml version="1.0" encoding="ISO-8859-15" standalone="no"?><abc xmlns:xsi=" (3 Replies)
Discussion started by: naughty21
3 Replies

8. Shell Programming and Scripting

find the length of file names in a directory?

Hi, how can find length of file names in a directory. Examp: I have a directory with name "d1". directory: d1 files: aaa.log bbb.log abcd.log abcdef.log I wold like out put like: file name legnth aaa.log 3 bbb.log 3 abcd.log 4 abcdef.log 5 (5 Replies)
Discussion started by: koti_rama
5 Replies

9. UNIX for Dummies Questions & Answers

Need find a file based length

Can some please help me? Want to find files over 35 characters in length? I am running HPUX. Would it be possible with find? Thanks in advance (8 Replies)
Discussion started by: J_ang
8 Replies
Login or Register to Ask a Question