KraXen72 / shira

Download music from YouTube, YouTube Music and Soundcloud, with great metadata and little effort.
MIT License
60 stars 3 forks source link

[Bug] Expected opus output with `--itag 251` (opus codec), has m4a video container/extension. #4

Open Disonantemus opened 7 months ago

Disonantemus commented 7 months ago

From documentation, to download opus format, I have to use flag --itag 251, like this:

$ shiradl --overwrite --itag 251 aN9_RkCGzGM
$ ls YouTube\ Music/『T・Pぼん』予告編/
Netflix.m4a

But resulting file has an m4a extension. I was expecting opus extension (or maybe webm/mkv/ogg, in that order), maybe m4a as a container can have opus inside, but it's the 1st time that I see that.

If I check the filetype, says video/mp4:

$ xdg-mime query filetype YouTube\ Music/『T・Pぼん』予告編/Netflix.m4a
video/mp4

Resulting file is a video mime type, then, is a video mp4 container. Using defaults (without --itag 251) you get an audio mime type: audio/x-m4a, that is expected for AAC codec.


Checking streams:

$ ffprobe YouTube\ Music/『T・Pぼん』予告編/Netflix.m4a 2>&1 | grep Stream
  Stream #0:0[0x1](eng): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp, 115 kb/s (default)
  Stream #0:1[0x0]: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1280x1280 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn (attached pic)

Resulting file is indeed an opus stream.

If I do extract stream to have an opus extension/container:

$ ffmpeg -v -y -i Netflix.m4a -c copy output.opus
$ xdg-mime query filetype kk.opus
audio/ogg

Now resulting file is indeed and audio mime type and container, but the expected thumbnail (image) is gone.

Maybe I can export the image and then use something like opustags to include in the opus file, but the idea of shira is to do all this friction less ("with little effort"), and now for opus output, is not doing that.

KraXen72 commented 7 months ago

I'll investigate and fix this. Thanks for reporting.

KraXen72 commented 7 months ago

@Disonantemus can you please provide the youtube link you've used? I had some problems with some links not having opus, and it seems your link has it.

Disonantemus commented 7 months ago

@Disonantemus can you please provide the youtube link you've used? I had some problems with some links not having opus, and it seems your link has it.

Is there in the topic: aN9_RkCGzGM

CLEMDEF commented 1 week ago

I checked with vlc media player and it's a m4a container but opus audio codec underneath, so it is the correct audio codec. But it seems like it is just the opus container that is bad at embedding album covers.