剥离ID标签的其它从原料MP3

剥离ID标签的其它从原料MP3

本文介绍了剥离ID标签的其它从原料MP3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我要得到一个干净的MP3文件,而像ID标签,封面图片任何aditional的数据,连接codeR信息或还有什么。
就在一个有效的文件的MP3,至极可以播放所有的MP3播放器。

I want to get an clean Mp3 File, without any aditional data like id Tags, Cover Image, encoder info or what else.Just the mp3 in an valid file, wich can play every mp3 player.

我开始用这一个:
Access MP3音频数据独立于ID3标签?
HTTP://$c$c.google.com/p/kodebucket/source/browse/trunk/bin/mp3dump.rb

I started with this one:Access MP3 audio data independently of ID3 tags?http://code.google.com/p/kodebucket/source/browse/trunk/bin/mp3dump.rb

它的工作原理很好得到的MP3的一个有效的哈希没有ID标签,但是当你保存输出到一个mp3文件,它是坏了。

It works nice to get an valid hash of the mp3 without id Tags, but when you save the output into an mp3 file, it's broken.

也许你有一个想法,如何让这项工作。

Maybe you have there an idea, how to get this work.

推荐答案

应该是pretty直截了当这个Ruby库:

it should be pretty straight forward with this Ruby library:

preferably版本0.5.0或更高

preferably version 0.5.0 or higher

检查文件中的例子目录一旦安装了宝石

check the files in the 'examples' directory once the gem is installed

require 'id3'

filename = "bla.mp3"
if ID3.hasID3v1tag?( filename ) || ID3.hasID3v2tag?( filename )

   puts "File size: #{ File::Stat.new(filename).size }"   # file size including tags

   myfile = ID3::AudioFile.new( filename )
   puts "Audio length: #{myfile.audioLength}"
   puts "Audio MD5sum: #{myfile.audioMD5sum}"

   # delete both id3 v1 and id3 v2 tags from the file:
   myfile.tagID3v1 = nil     # it might be a good idea to store the info somewhere before deleting it
   myfile.tagID3v2 = nil
   myfile.write              # we only write if we modified it..

end

例如:在IRB交互测试此

e.g.: testing this interactively in irb

# /usr/bin/irb
irb> RUBY_VERSION
 => "1.8.6"
irb>  require 'id3'   # version 0.5.0
 => true
irb> filename = '/tmp/b.mp3'
 => "/tmp/b.mp3"
irb>      puts "File size: #{ File::Stat.new(filename).size }"
File size: 8040064
irb>      myfile = ID3::AudioFile.new( filename )
irb>    puts "Audio length: #{myfile.audioLength}"
Audio length: 8037877
irb>    puts "Audio MD5sum: #{myfile.audioMD5sum}"
Audio MD5sum: 47719e1881e5a2488e51fc250ccd2396
irb>       # /usr/bin/irb
irb> RUBY_VERSION
 => "1.8.6"
irb>  require 'id3'   # version 0.5.0
 => true
irb> filename = '/tmp/b.mp3'
 => "/tmp/b.mp3"
irb>      puts "File size: #{ File::Stat.new(filename).size }"
File size: 8040064
irb>      myfile = ID3::AudioFile.new( filename )
irb>    puts "Audio length: #{myfile.audioLength}"
Audio length: 8037877
irb>    puts "Audio MD5sum: #{myfile.audioMD5sum}"
Audio MD5sum: 47719e1881e5a2488e51fc250ccd2396
irb> myfile.tagID3v2
 => {"ARTIST"=>{"encoding"=>0, "text"=>"Juno reactor"}, "CONTENTTYPE"=>{"encoding"=>0, "text"=>"Electronica/Dance"}, "ALBUM"=>{"encoding"=>0, "text"=>"Bible of Dreams"}, "ENCODEDBY"=>{"encoding"=>0, "text"=>"iTunes v2.0"}, "TRACKNUM"=>{"encoding"=>0, "text"=>"6/9"}, "TITLE"=>{"encoding"=>0, "text"=>"Kaguya Hime"}, "YEAR"=>{"encoding"=>0, "text"=>"1997"}, "COMMENT"=>{"encoding"=>0, "language"=>"eng", "short"=>"iTunes_CDDB_IDs", "long"=>"9+647C467468A248173A4A203ED2204CAB+163399"}}

irb>      myfile.tagID3v1 = nil
irb>      myfile.tagID3v2 = nil
irb>      myfile.write
irb>  puts "File size: #{ File::Stat.new(filename).size }"
File size: 8037877

这篇关于剥离ID标签的其它从原料MP3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 00:28