Closed iexavl closed 1 year ago
provide details:
RequestVideoInfo request = new RequestVideoInfo(videoId);
Response<VideoInfo> response = downloader.getVideoInfo(request);
VideoInfo video;
if((video = response.data())==null){
throw new Exception("No internet connection");
}
Format playbackFormat=video.bestVideoWithAudioFormat();
this is basically the code I use. https://www.youtube.com/watch?v=ZRtdQ81jPUQ Here is a link to the video. The max quality there is 4k but the best audio with video format available is 720p. I look through the list of formats available and its not the bestVideoWithAudioFormat() not being able to detect a better format, it simply isn't on the list. I was wondering if perhaps an itag is missing but that does not seem to be the case.
I looked around and in the function "populateFormats" in class ParserImpl where the list of formats is, well ,populated I checked the itags and indeed the higher qualities are with itags no audio but that does not make sense as in youtube they should have audio.
here is a picture while I am debugging and this one and the one below it are 2160p and they are both no audio.
Okay.. the problem isn't in the program. It finds all the itags just fine but the thing is that the youtube video player (when quality is higher than say something like 720p) it seems to split up video and audio data. Basically to download a video with higher quality and audio with higher quality at the same time you have to make separate requests to the urls of each player (audio and video) and splice them together. When I have time I can try implementing a fix.
@iexavl
it seems to split up video and audio data
absolutely right, this is the way youtube works - it combines video and audio, only some formats have both audio and video
I was wondering, when I try to download best video with audio format for example if the video has a best video format of 4k the best format comes out as 720p. And its not as if it simply doesn't pick the 4k format, it's just simply not in the list. Is there a reason for that/ can it be fixed?