Q:

Problem with mp3 tags using youtube-dl and id3v2

In short: I ran:
sudo apt install youtube-dl ffmpeg id3v2 -y
echo "youtube-dl version:"
youtube-dl --version
echo "id3v2 version:"
id3v2 --version
youtube-dl --extract-audio --audio-format mp3 "https://youtu.be/Sqk3B2041uk" --output test.mp3
id3v2 -t "cooltitle" -a "coolartist" test.mp3

The output was normal:
*normal output of apt install*
youtube-dl version:
2019.01.17
id3v2 version:
id3v2 0.1.12
Uses id3lib-3.8.3

This program adds/modifies/removes/views id3v2 tags, 
and can convert from id3v1 tags
[youtube] Sqk3B2041uk: Downloading webpage
[youtube] Sqk3B2041uk: Downloading video info webpage
[download] test.mp3 has already been downloaded
[download] 100% of 2.07MiB
[ffmpeg] Post-process file test.mp3 exists, skipping

In theory this script should download a mp3-file and set it's title to "cooltitle" and its artist to "coolartist".
But when I opened the file test.mp3 using rythmbox it does not show the correct title and artist.
Does anyone know why this does not work or how to fix it?

A:

youtube-dl actually downloads both video and audio even when you specify --extract-audio so your syntax has confused youtube-dl and FFmpeg by giving the same filename for both streams.
Perhaps the easiest fix (and there are a few other ways to accomplish your goal) is to change your youtube-dl syntax to the following:
youtube-dl --extract-audio --audio-format mp3 \
          "https://youtu.be/Sqk3B2041uk" --output "test.%(ext)s"

And certainly on my own system this successfully created a file that id3v2 can then process:
andrew@ilium~/tmp$ youtube-dl --extract-audio --audio-format mp3 \
>           "https://youtu.be/Sqk3B2041uk" --output "test.%(ext)s"
[youtube] Sqk3B2041uk: Downloading webpage
[youtube] Sqk3B2041uk: Downloading video info webpage
[download] Destination: test.webm
[download] 100% of 2.07MiB in 00:02
[ffmpeg] Destination: test.mp3
Deleting original file test.webm (pass -k to keep)
andrew@ilium~/tmp$ 

Note that by default youtube-dl downloads the best quality audio and video available, hence for this particular clip there is Opus audio and VP9 video in a webm container. FFmpeg then removes the video and converts the audio as ordered, have a look at the --keep-video option to see the magic at work :)

