Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MP4の動画ファイルの再生時間を取得するワンライナー
#!/bin/sh
# http://qiita.com/takashisite/items/0eeb45c8bbd232e915dd
ffmpeg -i movie.mp4 2>&1 | grep "Duration" | cut -d ' ' -f 4 | sed s/,// | sed 's@\..*@@g' | awk '{ split($1, A, ":"); split(A[3], B, "."); print 3600*A[1] + 60*A[2] + B[1] }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment