MINI² - Die ComMINIty

Normale Version: Hilfe!!!! Wie wandele ich BR4-Datei (.BR4) um?
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Habe meine Musik auf das Festplatten Navi von BMW gespielt beim sichern wurden die MP3 Dateien in BR4-Datei (.BR4) umgewandeltMotzen und ich möchte sie gerne wieder verwenden können kann mir da jemand helfen bitteAnbeten
Das iDrive erzeugt diese Bryce Dateien durch Negieren* aller Bits aus dem Original als kopiergeschützes Backup.

Dementsprechend ist:

- br3: mp4
- br4: mp3
- br5: wma

und eine einfache Umbennenung in .mp3 (trotz übereinstimmender Größe) *daher nicht möglich.

Hier hat ein findiger User ein Python Skript geschrieben, welches die Dateien wieder zurück negiert.

Aufgrund fehlender Testdateien und/oder BMW iDrive habe ich es natürlich nicht testen können.

Code:
#!/usr/bin/python
import os,struct,sys,string
#----------------------------------------------------------------------
# In my case, I've got a number of ogg files with embedded vorbis
# comments.  Script is run in some directory within that ogg
# collection, and it reads all the ogg files below that point
# converting the vorbis comments to id3 tags, creating the BR4
# files BMW wants.  You do have to create the BMWData / Music /
# data_1 file with all the directory names to read for it to
# restore properly.  So for a different car than my 2010, you could
# make a backup and then see if your structure is the same as my:
#
#   BMWData
#     BMWBackup.ver
#     Music
#       data_1                <-script creates this
#       media_directory_1     <-script creates this
#       media_directory_2     <-script creates this
#
# ...and update the script as necessary.  Code_1 and Code_2
# could also be unique to my car or the year or model.  I just
# copy a bunch of CD directories ripped in ogg format for other
# players into some fresh directory and then run this script
# from the top of that fresh directory to get a new USB load for
# the vehicle.
#----------------------------------------------------------------------

# base_directory=os.getenv('HOME')+'/conversion/BMWData/Music/'
base_directory='/media/disk/BMWData/Music/'
data_1=[]
code_1='1258287780'
code_2='8'
quality='160k'  # Or you can go down to 128k rate MP3 if acceptable
# I think a -q6 setting ogg file is the equivalent of a 192k MP3, but
# in a car I dunno if anyone but the most refined audiophile could
# hear the difference on our BMW speakers between 160k and a higher
# fidelity (and thus much larger) file.
map={'.BR3':'.mp4','.BR4':'.mp3','.BR5':'.wma',
     '.mp4':'.BR3','.mp3':'.BR4','.wma':'.BR5'}
number_of_files=0

print 'Removing existing',base_directory+'*'
# Caution: the following line removes existing USB music
# collection.  In your environment change the base_directory and
# comment out this line until it all works to your satisfaction.
os.system('rm -rf '+base_directory+'*')

# Get the count of all .ogg files below this point...
for root, dirs, files in os.walk('.', topdown=True):
  for name in files:
    filename=os.path.join(root, name)
    if filename.find('.ogg')>0:
      number_of_files+=1
file_number=0

# And then process all those .ogg files into .BR4 files
for root, dirs, files in os.walk('.', topdown=True):
  for name in files:
    filename=os.path.join(root, name)
    if filename.find('.ogg')>0:
      file_number+=1
      os.system('vorbiscomment -l '+filename+' > foo')
      fh=open('foo')
      fd=fh.readlines()
      os.unlink('foo')
      the_title=filename[filename.rfind('/')+1:-4]
      the_artist='Unknown'
      the_genre='Unknown'
      the_date='2009'
      the_album='Unknown'
      the_track='1'
      for l in fd:
        if   l.find('title=')==0:       the_title=l[6:-1]
        elif l.find('artist=')==0:      the_artist=l[7:-1]
        elif l.find('genre=')==0:       the_genre=l[6:-1]
        elif l.find('date=')==0:        the_date=l[5:-1]
        elif l.find('album=')==0:       the_album=l[6:-1]
        elif l.find('tracknumber=')==0: the_track=str(int(l[12:-1]))
      album_directory=string.lower(the_album.replace(' ','_'))
      data_1_entry='/'+album_directory+'/\t'+the_album+'\t'+code_1+'\t'+code_2+'\t\n'

      if not os.access(base_directory+album_directory,os.R_OK):
        os.mkdir(base_directory+album_directory)
      output_filename=base_directory+album_directory+'/'+the_title+'.mp3'
      sys.stdout.write('  '+str(file_number)+'/'+str(number_of_files)+' '+the_artist+','+the_album+','+the_track+':'+the_title+'...')
      sys.stdout.flush()
      # Create the mp3 from the ogg in the correct USB directory
      if os.access(output_filename,os.R_OK):
        os.unlink(output_filename)
      command='ffmpeg -i "'+filename+'" -ab '+quality+' "'+output_filename+'" >& /dev/null'
      os.system(command)
      sys.stdout.write(' MP3,')
      sys.stdout.flush()
      # Put the tag back on
      command= 'id3v2 -a "'+the_artist+'" -A "'+the_album+'" -t "'+the_title+\
               '" -g "'+the_genre+'" -y "'+the_date+'" -T "'+the_track+'" "'+\
               output_filename+'" >& /dev/null'
      os.system(command)
      sys.stdout.write(' ID3,')
      sys.stdout.flush()
      bmw_name=output_filename.replace('.mp3',map['.mp3'])
      ih=open(output_filename,'rb')
      oh=open(bmw_name,'wb')
      while True:
        element = ih.read(1)
        if len(element)>0:
          mybyte = struct.unpack("<b",element)[0]
          inverted_data = ~ mybyte
          oh.write(struct.pack(">b",inverted_data))
        else: break
      oh.close()
      sys.stdout.write(' Flipped.\n')
      os.unlink(output_filename)
      # Remove the .mp3 file now that the .BR4 is there...
      sys.stdout.flush()
      if not data_1_entry in data_1:
        data_1.append(data_1_entry)
    elif filename.find('.BR5')>0:
      # This was just to test/verify that a BR5 was just a flipped wma
      ih=open(filename,'rb')
      bmw_name=filename.replace('.BR5',map['.BR5'])
      oh=open(bmw_name,'wb')
      while True:
        # I know... one byte at a time is too slow...
        element = ih.read(1)
        if len(element)>0:
          mybyte = struct.unpack("<b",element)[0]
          inverted_data = ~ mybyte
          oh.write(struct.pack(">b",inverted_data))
        else: break
      oh.close()

print 'Writing out data_1 index'
data_1.sort()
fh=open(base_directory+'data_1','w')
fh.writelines(data_1)
fh.close()

print 'Done.  Size in Mb should be under 12500 for a 2010 iDrive'
os.system('du -ms '+base_directory)
iamone schrieb:Das iDrive erzeugt diese Bryce Dateien durch Negieren* aller Bits aus dem Original als kopiergeschützes Backup.

Dementsprechend ist:

- br3: mp4
- br4: mp3
- br5: wma

und eine einfache Umbennenung in .mp3 (trotz übereinstimmender Größe) *daher nicht möglich.

Hier hat ein findiger User ein Python Skript geschrieben, welches die Dateien wieder zurück negiert.

Aufgrund fehlender Testdateien und/oder BMW iDrive habe ich es natürlich nicht testen können.

Code:
#!/usr/bin/python
import os,struct,sys,string
#----------------------------------------------------------------------
# In my case, I've got a number of ogg files with embedded vorbis
# comments.  Script is run in some directory within that ogg
# collection, and it reads all the ogg files below that point
# converting the vorbis comments to id3 tags, creating the BR4
# files BMW wants.  You do have to create the BMWData / Music /
# data_1 file with all the directory names to read for it to
# restore properly.  So for a different car than my 2010, you could
# make a backup and then see if your structure is the same as my:
#
#   BMWData
#     BMWBackup.ver
#     Music
#       data_1                <-script creates this
#       media_directory_1     <-script creates this
#       media_directory_2     <-script creates this
#
# ...and update the script as necessary.  Code_1 and Code_2
# could also be unique to my car or the year or model.  I just
# copy a bunch of CD directories ripped in ogg format for other
# players into some fresh directory and then run this script
# from the top of that fresh directory to get a new USB load for
# the vehicle.
#----------------------------------------------------------------------

# base_directory=os.getenv('HOME')+'/conversion/BMWData/Music/'
base_directory='/media/disk/BMWData/Music/'
data_1=[]
code_1='1258287780'
code_2='8'
quality='160k'  # Or you can go down to 128k rate MP3 if acceptable
# I think a -q6 setting ogg file is the equivalent of a 192k MP3, but
# in a car I dunno if anyone but the most refined audiophile could
# hear the difference on our BMW speakers between 160k and a higher
# fidelity (and thus much larger) file.
map={'.BR3':'.mp4','.BR4':'.mp3','.BR5':'.wma',
     '.mp4':'.BR3','.mp3':'.BR4','.wma':'.BR5'}
number_of_files=0

print 'Removing existing',base_directory+'*'
# Caution: the following line removes existing USB music
# collection.  In your environment change the base_directory and
# comment out this line until it all works to your satisfaction.
os.system('rm -rf '+base_directory+'*')

# Get the count of all .ogg files below this point...
for root, dirs, files in os.walk('.', topdown=True):
  for name in files:
    filename=os.path.join(root, name)
    if filename.find('.ogg')>0:
      number_of_files+=1
file_number=0

# And then process all those .ogg files into .BR4 files
for root, dirs, files in os.walk('.', topdown=True):
  for name in files:
    filename=os.path.join(root, name)
    if filename.find('.ogg')>0:
      file_number+=1
      os.system('vorbiscomment -l '+filename+' > foo')
      fh=open('foo')
      fd=fh.readlines()
      os.unlink('foo')
      the_title=filename[filename.rfind('/')+1:-4]
      the_artist='Unknown'
      the_genre='Unknown'
      the_date='2009'
      the_album='Unknown'
      the_track='1'
      for l in fd:
        if   l.find('title=')==0:       the_title=l[6:-1]
        elif l.find('artist=')==0:      the_artist=l[7:-1]
        elif l.find('genre=')==0:       the_genre=l[6:-1]
        elif l.find('date=')==0:        the_date=l[5:-1]
        elif l.find('album=')==0:       the_album=l[6:-1]
        elif l.find('tracknumber=')==0: the_track=str(int(l[12:-1]))
      album_directory=string.lower(the_album.replace(' ','_'))
      data_1_entry='/'+album_directory+'/\t'+the_album+'\t'+code_1+'\t'+code_2+'\t\n'

      if not os.access(base_directory+album_directory,os.R_OK):
        os.mkdir(base_directory+album_directory)
      output_filename=base_directory+album_directory+'/'+the_title+'.mp3'
      sys.stdout.write('  '+str(file_number)+'/'+str(number_of_files)+' '+the_artist+','+the_album+','+the_track+':'+the_title+'...')
      sys.stdout.flush()
      # Create the mp3 from the ogg in the correct USB directory
      if os.access(output_filename,os.R_OK):
        os.unlink(output_filename)
      command='ffmpeg -i "'+filename+'" -ab '+quality+' "'+output_filename+'" >& /dev/null'
      os.system(command)
      sys.stdout.write(' MP3,')
      sys.stdout.flush()
      # Put the tag back on
      command= 'id3v2 -a "'+the_artist+'" -A "'+the_album+'" -t "'+the_title+\
               '" -g "'+the_genre+'" -y "'+the_date+'" -T "'+the_track+'" "'+\
               output_filename+'" >& /dev/null'
      os.system(command)
      sys.stdout.write(' ID3,')
      sys.stdout.flush()
      bmw_name=output_filename.replace('.mp3',map['.mp3'])
      ih=open(output_filename,'rb')
      oh=open(bmw_name,'wb')
      while True:
        element = ih.read(1)
        if len(element)>0:
          mybyte = struct.unpack("<b",element)[0]
          inverted_data = ~ mybyte
          oh.write(struct.pack(">b",inverted_data))
        else: break
      oh.close()
      sys.stdout.write(' Flipped.\n')
      os.unlink(output_filename)
      # Remove the .mp3 file now that the .BR4 is there...
      sys.stdout.flush()
      if not data_1_entry in data_1:
        data_1.append(data_1_entry)
    elif filename.find('.BR5')>0:
      # This was just to test/verify that a BR5 was just a flipped wma
      ih=open(filename,'rb')
      bmw_name=filename.replace('.BR5',map['.BR5'])
      oh=open(bmw_name,'wb')
      while True:
        # I know... one byte at a time is too slow...
        element = ih.read(1)
        if len(element)>0:
          mybyte = struct.unpack("<b",element)[0]
          inverted_data = ~ mybyte
          oh.write(struct.pack(">b",inverted_data))
        else: break
      oh.close()

print 'Writing out data_1 index'
data_1.sort()
fh=open(base_directory+'data_1','w')
fh.writelines(data_1)
fh.close()

print 'Done.  Size in Mb should be under 12500 for a 2010 iDrive'
os.system('du -ms '+base_directory)

Ok wie wende ich das an?
Hängt von deinem Betriebssystem ab. Windows, Linux oder OS X?
iamone schrieb:Hängt von deinem Betriebssystem ab. Windows, Linux oder OS X?
WindowsTop
Eine Anleitung findet sich in der Python Dokumentation.

Wenn du damit aber noch nicht zu tun hattest wird das vermutlich keine leichte Übung. Confused

Hast du schon mal BMW gefragt, was die dazu sagen? Was soll man deren Meinung nach machen, wenn man die gesicherten Dateien wieder nutzen möchte? Head Scratch
iamone schrieb:Eine Anleitung findet sich in der Python Dokumentation.

Wenn du damit aber noch nicht zu tun hattest wird das vermutlich keine leichte Übung. Confused

Hast du schon mal BMW gefragt, was die dazu sagen? Was soll man deren Meinung nach machen, wenn man die gesicherten Dateien wieder nutzen möchte? Head Scratch


ja habe ich ... und ich fand das war eine Sehr bescheuerte aussage!
Ok ich bin ehrlich ich komme damit wirklich nicht klar Traurig
Doc schrieb:ja habe ich ... und ich fand das war eine Sehr bescheuerte aussage!

Dachte ich mir schon. Augenrollen

Doc schrieb:Ok ich bin ehrlich ich komme damit wirklich nicht klar Traurig

Hier beim BMW Treff hat sich jemand ein Programm geschrieben. Natürlich weiß ich nicht, ob es das gleiche Python Skript ist oder ein richtiges Programm. Vielleicht kannst du diesen Diesel Frank nett um das Programm fragen?

http://www.auto-treff.com/bmw/vb/showthr...ost2594392

Winke 02
iamone schrieb:Dachte ich mir schon. Augenrollen



Hier beim BMW Treff hat sich jemand ein Programm geschrieben. Natürlich weiß ich nicht, ob es das gleiche Python Skript ist oder ein richtiges Programm. Vielleicht kannst du diesen Diesel Frank nett um das Programm fragen?

http://www.auto-treff.com/bmw/vb/showthr...ost2594392

Winke 02


Würde ich gerne jedoch kann ich ihn nicht anschreibenTraurig