Skip to content

Instantly share code, notes, and snippets.

@ysugimoto
Created June 24, 2015 11:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ysugimoto/50e24d1e22988d79b0dd to your computer and use it in GitHub Desktop.
Save ysugimoto/50e24d1e22988d79b0dd to your computer and use it in GitHub Desktop.
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