kkdai / youtube

Download Youtube Video in Golang
MIT License
3.38k stars 434 forks source link

The downloaded video has no sound #342

Open 4strodev opened 2 months ago

4strodev commented 2 months ago

I tried it with different videos and all has the same problem. Maybe it's a failure that only happens on Linux. I found this similar issue #279, but the provided advice doesn't work.

noahlove commented 2 months ago

Not all streams have audio. Are you sure you are downloading one that has audio?

4strodev commented 2 months ago

Yes I tried with three different videos all of them with audio. I don't know if the bug is something replicable or not, but I just cloned the repo and executed the CLI, giving them a YouTube link. The video downloaded successfully but without audio.

7z3m commented 1 month ago

same happened to me as well.

Mrkouhadi commented 1 month ago

I have the same issue. I kinda solved it, but i don't get the best quality, i always get either 360p or something lower even though the video has multiple options for quality.

    var format *youtube.Format
    for _, f := range video.Formats {
            if f.AudioChannels > 0 && f.QualityLabel != "" { // Ensure it has both video and audio
                if format == nil || f.Height > format.Height {
                    format = &f // Select the format with the highest resolution
                }
            }
    }
7z3m commented 1 month ago

indeed, i share the low quality issue with you. thanks for sharing the code.