1

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?

1

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 :)

  • Thank you. This works, but I think I'm going to send a feature request to youtube-dl, because this is very unintuitive. – Kryptomatrix Jul 14 at 12:24
  • @Kryptomatrix It would be good to see this clearer :). The developers are reasonably responsive: github.com/ytdl-org/youtube-dl/issues – andrew.46 Jul 21 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.