-
Notifications
You must be signed in to change notification settings - Fork 9
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
Watch JuliaCon in the Terminal #14
Comments
Yeah I thought the same. I wonder if we could expose a youtube stream to VideoIO |
Maybe something along the lines of https://stackoverflow.com/questions/37040798/how-do-you-use-youtube-dl-to-download-live-streams-that-are-live ? Shouldn't it be somewhat similar to how the camera stream gets displayed with VideoIO? Unfortunately I have no experience in this area ... :( |
|
This was easier than I expected... using HTTP, JSON3, FFMPEG, VideoInTerminal
function get_youtube(id = "j18ECUhkeY0")
f, io = mktemp()
dest = string(f,".mp4")
r = HTTP.request("GET", "https://www.youtube.com/get_video_info?video_id=$(id)&html5=1")
lines = split(HTTP.unescapeuri(String(r.body)), '&')
for line in lines
if startswith(line, "player_response")
pr = JSON3.read(split(line, "player_response=", keepempty = false)[1])
for format in pr[:streamingData][:adaptiveFormats]
if format[:height] == 240
FFMPEG.exe("-i", format[:url], dest, collect=true)
return dest
end
end
end
end
error("Could not find usable video")
end
function watch_juliacon(id = "TPuJsgyu87U")
@info "Grabbing video..."
vid = get_youtube(id)
VideoInTerminal.play(vid)
end name that talk... |
This is awesome! Needs a little bit of tweaking though to handle live streams I guess? Example: |
And, just for my understanding, we're still downloading to file in some sense right? ( |
Sorry, one more thing. Any idea how to make audio work ? 😀 |
Nope. It might be possible to extract a subtitle file and print that underneath though For live streams I think it would probably have to be through VideoIO via an AVInput, but I couldn't figure it out quickly |
If we want maximum style points, we could use the |
I'd still love to have this... it's so cool :) Maybe we could try to use https://github.com/eschnett/SixelTerm.jl to get a reasonable quality? :) |
@logankilpatrick had an awesome idea on the JuliaCon call: Wouldn't it be super cool if one could watch JuliaCon (the YouTube streams) in the terminal? @IanButterworth, maybe VideoInTerminal.jl can help with this?
The text was updated successfully, but these errors were encountered: