スクリプトやcmdラインツールが必要です。mp3の長さをミリ秒で取得します。ファイルは、ラメで符号化された64kbモノラルcbrです。mp3の長さ(ミリ秒単位)
1
A
答えて
2
http://id3lib-ruby.rubyforge.org/(私は...、ルビーのためのlibmadのための選択の私の言葉を見えたが、注目すべきは何も見つかりませんでしたか)? This pageに必要なコードがあります。
3
はexiftoolをお試しください:
$ sudo apt-get install libimage-exiftool-perl
$ exiftool "Stone Sour-Stone Sour-Bother.mp3"
ExifTool Version Number : 6.93
File Name : Stone Sour-Stone Sour-Bother.mp3
Directory : .
File Size : 6 MB
File Modification Date/Time : 2006:05:15 19:09:52
File Type : MP3
MIME Type : audio/mpeg
MPEG Audio Version : 1
Audio Layer : 3
Audio Bitrate : 128000
Sample Rate : 44100
Channel Mode : Joint Stereo
MS Stereo : On
Intensity Stereo : Off
Copyright Flag : False
Original Media : True
Emphasis : None
Album : Stone Sour
Artist : Stone Sour
Comment : ***/Foobar2000: MPC->MP3
Genre : Rock
Title : Bother
Track : 08
Recording Time : 2002
User Defined Text : (sub-genre) Alt Metal
Year : 2002
Duration : 0:06:03.67 (approx)
1
私はffmpegのは簡単にこれを行うことができます知っている:
ffmpeg -i file.mp3 2>&1|sed -n "s/.*Duration: \([^,]*\).*/\1/p"
は、残念ながら、私はこれを取り扱う任意のRubyのライブラリを知りません。
4
def self.get_audio_length(filepath)
pipe = "ffmpeg -i "+ filepath.to_s+" 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,//"
command = `#{pipe}`
if command =~ /([\d][\d]):([\d][\d]):([\d][\d]).([\d]+)/
#convert the result to only secs
duration = ($2.to_i * 60) + $3.to_i
end
#return and array containing the seconds and the human readable time length, ["6453","03:54"]
return "#{duration.to_s},#{$2}:#{$3}".split(",")
end
関連する問題
- 1. NetStream.seek(ミリ秒単位)
- 2. getTime()でのミリ秒単位の日付
- 3. Androidでのミリ秒単位の変換
- 4. Excel:ミリ秒単位のテキスト変換
- 5. ミリ秒単位での表現
- 6. Realstudio(2011 4.2)ミリ秒単位の日付
- 7. ミリ秒単位のMFC測定機能
- 8. SQLiteは:ミリ秒単位の精度
- 9. ミリ秒単位の完全な日付
- 10. フレーム、バイト、およびintの長さをミリ秒単位で調べる方法
- 11. .gifアニメーションの長さをミリ秒単位で決定する方法
- 12. 秒単位のミリ秒単位の変換:JavaScriptの実行中のタイマー
- 13. MSSQL bigint Unixタイムスタンプ(ミリ秒単位)
- 14. ハイチャート:ミリ秒単位のdateTimeが認識されない
- 15. 変換時間(ミリ秒)の持続時間(BigDecimal値+時間単位)長い
- 16. NSTimer秒/ミリ秒単位で時間を短縮します。
- 17. Cでミリ秒を秒単位に変換
- 18. Wakanda表示時間にミリ秒単位:分:分:秒
- 19. 時間を秒単位+ミリ秒に換算
- 20. レンダリング前のミリ秒単位の角の重複
- 21. ミリ秒単位の基本時間への変換
- 22. Python:タイムスタンプの解析と時差の計算(ミリ秒単位)
- 23. bcなしのミリ秒単位の時間
- 24. ハードウェアの時間をミリ秒単位で取得する方法
- 25. RavenDB Query統計サーバの実行時間(ミリ秒単位)
- 26. Javaでミリ秒単位で現在の日を取得する
- 27. フォーマット日付/時刻は、ミリ秒単位で、Androidの
- 28. .Net String Formatミリ秒単位の通貨値を表示
- 29. C - プログラムの実行時間(ミリ秒単位)<time.h>
- 30. R 2カラム間の時間差(ミリ秒単位)
実際の時間が必要なのか、ID3タグが言っていることは時間ですか? –