Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
Cambiar las etiquetas ID3 de un archivo MP3

Encontré un sitio web recientemente que le permite cargar un archivo y cambiar sus etiquetas ID3 ( Imagen , Título , todas esas otras cosas ) y actualmente estoy almacenando archivos en un directorio después de analizarlos desde otro sitio web antes de empujarlos externamente.

Me pregunto si alguien conoce una biblioteca donde pueda leer cómo cambiar las etiquetas ID3 predeterminadas en PHP . ¿Es esta una característica ya existente con PHP ?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

if( writeTags($row['title'],$new) ) { $fileName = rand(000000000,999999999).'_'.rand(0000000000,9999999999).'_'.rand(000000000,999999999).'.mp3'; $imageName = rand(000000000,999999999).'_'.rand(0000000000,9999999999).'_'.rand(000000000,999999999).'.jpg'; rename($new, $DPATH.'uploads/tracks/'.$fileName); save_image($row['image'],$DPATH.'uploads/media/'.$imageName); $track['uid'] = 151; $track['title'] = $row['title']; $track['description'] = ''; # fileName $track['name'] = $fileName; # make tag $track['tag'] = $tag.','; # download image $track['art'] = $imageName; # today date $track['release'] = date("Ymd"); $track['size'] = filesize($DPATH.'uploads/tracks/'.$fileName); $row['slippery_id'] = add_to_slippery($track); } function writeTags($title,$file) { $TextEncoding = 'UTF-8'; require_once($DPATH.'cron/getid3/getid3.php'); $getID3 = new getID3; $getID3->setOption(array('encoding'=>$TextEncoding)); require_once($DPATH.'cron/getid3/write.php'); $tagwriter = new getid3_writetags; $tagwriter->filename = $file; $tagwriter->tagformats = array('id3v1','id3v2.3'); $tagwriter->overwrite_tags = true; $tagwriter->tag_encoding = $TextEncoding; $tagwriter->remove_other_tags = true; $TagData = array( 'album' => array($MP3TAG), 'comment' => array($MP3TAG), ); $fd = fopen($DPATH.'cron/mp3image.png', 'rb'); $APICdata = fread($fd, filesize($DPATH.'cron/mp3image.png')); fclose($fd); $TagData['attached_picture'][0]['data'] = $APICdata; $TagData['attached_picture'][0]['picturetypeid'] = 2; $TagData['attached_picture'][0]['description'] = $MP3TAG; $TagData['attached_picture'][0]['mime'] = 'image/jpeg'; $tagwriter->tag_data = $TagData; if ($tagwriter->WriteTags()) { return true; } else { return false; } }

Recientemente hice algo similar, puede editar el código anterior para que coincida con sus requisitos, si quería que fuera más útil, debería haber proporcionado su propio código dentro de su pregunta.

Tenga en cuenta que hacer preguntas como esta es a menudo la forma en que sus preguntas se cierran, buena suerte en el futuro y espero que esto lo ayude.

EDITAR: use este GitHub para obtener las etiquetas ID3.

over 4 years ago · Santiago Trujillo Report

0

Recientemente hice un envoltorio PHP para eyeD3, un excelente módulo de Python para leer y actualizar metadatos ID3. Compruébalo aquí .
El uso es bastante simple si está familiarizado con Composer. Sin embargo, deberá instalar eyed3 para poder usarlo. Entonces:

  1. Instale el contenedor php usando el compositor:

     composer require stormiix/php-eyed3 dev-master
  2. Agregue la biblioteca a su código:

     require __DIR__ . '/vendor/autoload.php';
  3. Use el siguiente código para leer y actualizar etiquetas.

     use Stormiix\EyeD3\EyeD3; $eyed3 = new EyeD3("mp3 file path"); $tags = $eyed3->readMeta(); // $tags is an array that contains the following keys: // artist, title, album, comment(s), lyrics ..etc $meta = [ "artist" => "MyArtist", "title" => "MyTitle", "album" => "MyAlbum", "comment" => "MyComment", "lyrics" => "MyLyrics", "album_art" => "cover.png" ]; // Update the mp3 file with the new meta tags $eyed3->updateMeta($meta);
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!