Youtube-DL: How to strip video information/description when converting audiofile to MP3?

8

2

This might be picky, but when I use Youtube-DL to convert audio from a video to MP3, I let it also tag the title and embed the thumbnail from the video. Somehow it adds the video description and some other meta video info, which I don't want. This is the command I use:

youtube-dl -o "%(title)s.%(ext)s" -x --audio-format mp3 --audio-quality 320K --embed-thumbnail --add-metadata --metadata-from-title "%(artist)s - %(title)s" <youtube url>

When I check the ID3 tag info, it added the video title as expected. If I rename the extension to AVI, play the audio file, and open its properties, I can see unwanted info like the video description, version encoder, and brand. The option --add-metadata writes metadata to the video file, from which it gets the video description, but when I leave that out, the video does not get tagged at all.

I read through the documentation of Youtube-DL and FFMPEG, but I can’t find a proper way to strip the video description/info and keep the MP3 tagged.

Does anyone know how to do this?

jaleco

Posted 2016-04-20T04:50:49.890

Reputation: 81

Answers

4

I don't believe you can currently control the --add-metadata option.

However you can use the --exec option to execute a command afterwards using the reference to the output file {} and ask ffmpeg to strip the unwanted metadata like so:

--exec "ffmpeg -y -i {} -map 0 -c copy -metadata comment=\"\" -metadata description=\"\" -metadata purl=\"\" temp.mp3"

Performing the "convert" process in place (overwriting the same file) breaks the stream data of the output file but adding an auxiliary temp.mp3 and then overwriting it makes it work like a charm.

I've tested the following command combination:

youtube-dl -o "%(title)s.%(ext)s" -x --audio-format mp3 --audio-quality 320K --embed-thumbnail --add-metadata --metadata-from-title "%(artist)s - %(title)s" <youtube url> --exec "ffmpeg -y -i {} -map 0 -c copy -metadata comment=\"\" -metadata description=\"\" -metadata purl=\"\" temp.mp3;cp -r temp.mp3 {};rm -rf temp.mp3"

I hope this helps!

PS: I know the question is a bit old but posting a working solution might help you and others.

matthewd

Posted 2016-04-20T04:50:49.890

Reputation: 311

I had to add "-id3v2_version 3" to the ffmpeg line to be visible to "id3v2 -l" command – joshbaptiste – 2019-05-17T17:32:39.450