Open jphellemons opened 7 years ago
That just means that YouTube doesn't provide any more Flash videos, since it's an outdated technology
Thank you for the fast reply. But does that mean that audio extraction is not possible anymore? I used the zero resolution, download mp4 video and save as mp3 before. but that also didn't work
Well, since YouTube is not splitting the video and audio tracks, you could just download them directly
Sorry to bother you again, but when I ran this:
VideoInfo video = videoInfos.Where(i => i.VideoType == VideoType.Mp4 && i.Resolution == 0).OrderByDescending(q => q.AudioBitrate).First();
my video object was not null and had 128bit audio in it. But I got this error thrown at line 68 of FlvFile.cs
throw new AudioExtractionException("Invalid input file. Impossible to extract audio track.");
as found on https://www.heyrick.co.uk/blog/index.php?diary=20160113
' FLV files begin "FLV[" which is 0x464C5601 If (WordA = &H1564C46) Then Files(FileCount).Exten = "flv"
So that also depends on flash. So perhaps remove the whole audioextraction class and flash references (readme.md) or make the audioextraction take the highest bitrate value of a 0 resolution mp4 file?
@jphellemons Well, you passed in an Mp4
video, but YoutubeExtractor can only extract the audio of Flash videos, so no surprises there
Yes, this is also a problem for me.
The code example you post to your Read Me does not work: https://github.com/flagbug/YoutubeExtractor
videoInfo.Where(info => info.CanExtractAudio).OrderByDescending(info => info.AudioBitrate).First();
Additional information: Sequence contains no elements
Perhaps a little more patience and this could be an awesome product!!!
@GuntaButya I have removed the CanExtractAudio stuff. https://github.com/flagbug/YoutubeExtractor/pull/247 You can get the audio from the zero video resolution m4a files.
public bool CanExtractAudio { get { return this.VideoType == VideoType.Flash; } }
Of course, if the Video is not a Flash File, this will always return false. Which is by design. So if YouTube have not served you a Flash File, then this method of Extracting audio can never happen, your *.mp4 file or what ever will never have an associated Audio File to Join at a later stage! So how can we work around this?
IEnumerable<VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(link);
VideoInfo video = videoInfos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);
So, we can try changing the : info.VideoType == VideoType.Mp4
to info.VideoType == VideoType.Flash
However, this currently is giving me trouble: Additional information: System.InvalidOperationException: Sequence contains no matching element
So same problem, no Flash Files Served...
@GuntaButya it's in the pr in the updated readme.md https://github.com/jphellemons/YoutubeExtractor/blob/805926ebdb521a79439dd4c321101a2d97c20858/readme.md You only have to rename the mp3 extension to m4a. So even the pr is not up to date ha ha :)
Yes Sir, you have fixed the problem! This works perfectly! The ups and downs of a Library dependant on a First Party's changes I guess.
This is such an awesome Product! I use YouTube Extractor regularly! Just for the Odd download and so on.
So the file downloaded is actually a: mp4a: MPEG-4 AAC LC
and in my case: 44100Hz , mono (1/0)
So this could actually be treated as a separate Video Download!
public bool CanExtractAudio { get { return this.Resolution == 0 & this.VideoType == VideoType.Mp4; } }
A small mod may be needed to make this work a bit more elegantly, like in your code. As you point out, the entire AudioDownloader
Class is now obsolete. Use the VideoDownloader
class instead!
perhaps something is changed with the audioextraction? This worked before:
and this returns null:
when the videoInfos object contains 22 items from the "DownloadUrlResolver.GetDownloadUrls"
tested it on https://www.youtube.com/watch?v=VaxFIr3GJ-8