- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting only audio to file/AssetReader ? #61
Comments
I usually do it via |
Thanks for your response, very helpful ! In my experience nearly all YT audio is coded as "m4a". Are you aware of any other codings ? If so, can you provide a test link to a video that has audio coded other than m4a ? |
Yes, usually you see print(streams.filter { $0.includesAudioTrack }.map { $0.fileExtension })
// → [YouTubeKit.FileExtension.m4a, YouTubeKit.FileExtension.m4a, YouTubeKit.FileExtension.mp4, YouTubeKit.FileExtension.webm, YouTubeKit.FileExtension.webm, YouTubeKit.FileExtension.webm] |
Hi, currently with the code segment:
I get an exception and find those logs. Is YTKit currently broken due to a change at YT ?
|
The problem is fixed. Thanks for this project ! |
Hi Alex,
I have updated to 0.2.5 but still I have problems with:
let stream = try await YouTube(url: inUrl).streams
.filterAudioOnly()
.filter { $0.isNativelyPlayable }
.highestAudioBitrateStream()
It worked a few days ago and now it fails again. I get the output:
from my logs: inURL: https://www.youtube.com/watch?v=u_LaF1L-EEs
finding initial function name
pattern (ytplayer\.config\s*=\s*) failed: Der Vorgang konnte nicht abgeschlossen werden. (YouTubeKit.YouTubeKitError-Fehler 1.)
applying descrambler
applying descrambler
finding initial function name
getting transform plan
finding initial function name
pattern (ytplayer\.config\s*=\s*) failed: Der Vorgang konnte nicht abgeschlossen werden. (YouTubeKit.YouTubeKitError-Fehler 1.)
finding initial function name
getting transform plan
Do you have any ideas what could be wrong here ? Is YT changing their API so frequently ?
Thanks and regards
Christian
… Am 16.11.2024 um 13:23 schrieb Alexander Eichhorn ***@***.***>:
Yes, usually you see m4a and webm audio files. For example, for video 2lAe1cqCOXo, you get:
print(streams.filter { $0.includesAudioTrack }.map { $0.fileExtension })
// → [YouTubeKit.FileExtension.m4a, YouTubeKit.FileExtension.m4a, YouTubeKit.FileExtension.mp4, YouTubeKit.FileExtension.webm, YouTubeKit.FileExtension.webm, YouTubeKit.FileExtension.webm]
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I need to extract the audio part and save it to a file. Currently my code works like this:
Now my problem is that I am restricting to m4a audio files which I don't want to. However, if I remove the filter modifier I can get audio which is not coded in MPEG4 audio. Obviously I can't copy such a file with "conformingTo: .mpeg4audio".
How can I download ALL audio coding types and feed this into AssetReader ? (I think AssetReader needs a correct file extension to work properly. How do I get the audio coding file type of a correct filetype extension for the stream ?)
Thanks !
The text was updated successfully, but these errors were encountered: