Closed ghost closed 3 years ago
The quickest workaround is to change line: https://github.com/nksapphire/youtube/blob/3650856f77bfc076817ef793bbd3ef2760016e96/format_list.go#L14
to
if (list[i].Quality == quality || list[i].QualityLabel == quality) && list[i].AudioChannels > 0
There are a list of formats available, and we need to pick up a format with audio channels to download. Or else there will be no audio.
Eventually, a logic to filter out formats without audio channels should be applied in this function: https://github.com/kkdai/youtube/blob/3650856f77bfc076817ef793bbd3ef2760016e96/cmd/youtubedr/downloader.go#L97
Created a PR for formal solution: https://github.com/kkdai/youtube/pull/207
I have merged the @nksapphire 's bugfix. It should works with newest version.
In the last release, is it working?
@rodrigo-brito yes, it works in version 2.7.3
Even with #207 merged and v2.7.4 I can stillĀ reproduce this problem.
Hi @prologic, I solved it using WithAudioChannels()
filter.
video, err := client.GetVideo(youtubeID)
if err != nil {
return "", err
}
formats := video.Formats.WithAudioChannels()
stream, _, err := client.GetStream(video, &formats[0])
if err != nil {
return "", err
}
It is not documented, I discovered in the Pull Request linked https://github.com/kkdai/youtube/pull/207
Nice! Thanks.
Hi @prologic, I solved it using
WithAudioChannels()
filter.video, err := client.GetVideo(youtubeID) if err != nil { return "", err } formats := video.Formats.WithAudioChannels() stream, _, err := client.GetStream(video, &formats[0]) if err != nil { return "", err }
@rodrigo-brito how about making a PR for the example code š
updated example_test. Close issue.
Hello,
I'm using this code to download videos:
I'm using the example code.
The video downloads but there is no audio.
Possibly related to #204