Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Best way to add metadata (ID3 tags) to m4a files in automated code??? #14271
Comments
|
Add |
|
ok, I have added the PP and tried a run, it fetches the title and artist but at the end, it isn't added. in which part of the code should I put the 'postprocessors': [{'key': 'FFmpegExtractAudio',
'preferredcodec': 'm4a',
'preferredquality': '0'},
{'key': 'EmbedThumbnail'},
{'key': 'MetadataFromTitle',
'titleformat': '(?P<title>.+)\ \-\ (?P<artist>.+)'}]}edit: Made it work after checking out the code for how the PP is called. Seems that MetadataFromTitle just fetches the metadata and changes the 'info' list where the title is modified to just the name of the song and author changes from uploader to the author fetched from the title. Finally you need to call FFmpegMetadata that gets the 'info' list and writes it as metadata. here is the code: MUSIC_OPTIONS_ = {
'writethumbnail': True,
'format': 'bestaudio/best',
'extractaudio': True,
'audioformat': 'best',
'outtmpl': '~/Music/Youtube_dl/%(uploader)s/%(title)s.%(ext)s',
'noplaylist': True,
'youtubeskipdashmanifest': True,
'nocheckcertificate': True,
'externaldownloader': 'aria2c',
'externaldownloaderargs': '-x 4 -k 2M',
'postprocessors': [{'key': 'FFmpegExtractAudio',
'preferredcodec': 'm4a',
'preferredquality': '0'},
{'key': 'MetadataFromTitle',
'titleformat': '(?P<title>.+)\ \-\ (?P<artist>.+)'},
{'key': 'FFmpegMetadata'},
{'key': 'EmbedThumbnail'}]}Now I just need to find a way to stop it from writing the comments and date released. |
This should be an example in the youtube-dl README within the section about embedding youtube-dl. Right now it's not possible to figure out how to setup the postprocessors dict without reading the actual postprocessor module code. |
Make sure you are using the latest version: run
youtube-dl --versionand ensure your version is 2017.09.15. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.Before submitting an issue make sure you have:
What is the purpose of your issue?
After a lot of trouble with online sites I made a code for personal use, to download the way I like it but this time when trying to upgrade the functionalities I had some trouble trying to implement it.
The main issue is that I wasn't able to even get the metadata functioning in any way. So I'm writing to ask if anyone has been able to implement it into actual code, not just use it in the terminal.
For now, I'm just using these options for the download:
I'm shure there must be an implementation of the --add-metadata and --metadata-from-title, but I couldn't find out how.
Full Code here for anyone interested in reviewing further and helping in any way.
Any commentary is welcomed.