Hi All,
I’ve been trying for a few days now to get a youtube stream into TD. I’m aware of the YoutubeTOP project (github.com/remap/YoutubeTOP) that Peter Gusev made but unfortunately it is only compiled for 32bit TD and seems to be made for videos rather than streams.
I thought I might be able to use youtube-dl to pipe video into ffmpeg and transcode it to a rtsp/rtmp stream which TouchDesigner could then receive via the VideoStreamIn TOP. The command would look something like this:
youtube-dl -f best "https://youtu.be/RtU_mdL2vBM" -o - | ffmpeg -re -f mp4 -i pipe:0 -ar 44100 -f flv rtmp://localhost:1935/test/test'
To view:
vlc rtmp://localhost:1935/test/test
This could also be done with vlc:
vlc -vvv https://youtu.be/RtU_mdL2vBM --sout '#transcode{vcodec=h264,vb=800,acodec=none}:rtp{sdp=rtsp://:554/test}'
or
youtube-dl -o - "https://youtu.be/RtU_mdL2vBM" | vlc - --sout '#transcode{vcodec=h264,vb=800,acodec=none}:rtp{sdp=rtsp://:554/test}'
and to view:
vlc rtsp://localhost:554/test
So far I haven’t been able to connect to the transcoded stream with TouchDesigner or VLC although I can play the youtube stream directly with either of these commands:
youtube-dl -o - "https://youtu.be/RtU_mdL2vBM" | vlc -
vlc -vvv https://youtu.be/RtU_mdL2vBM
I’ve also tried to use ffserver running on a ubuntu 16.04 machine between ffmpeg and TouchDesigner/VLC but haven’t had any success.
I’ve made a post on stackoverflow that contains a bit more information including the ffmpeg log. I’m curious if anyone has done this in the past or knows what I’m doing wrong. It would be really cool to have this working!
Thanks!
EDIT:
This is solved in the post below but I’ve been experimenting with other command line tools and found one that works particularly well called livestreamer [url]http://docs.livestreamer.io/[/url]
[url]http://docs.livestreamer.io/plugin_matrix.html[/url]
This has proven to be a bit more reliable than youtube-dl or vlc and has a nice option to retry the stream if it is lost.
livestreamer --retry-streams 1 https://www.youtube.com/watch?v=UQt2iLKqBbI best -O | vlc - --sout=#transcode{vcodec=h264,vb=15000,acodec=none}:rtp{sdp=rtsp://:563/test,proto=udp}
One thing you will need to do is edit the youtube plugin file. For some reason it is broken in the official release.
C:\Users[username]\AppData\Local\Programs\Python\Python35\Lib\site-packages\livestreamer\plugins\youtube.py
under _get_stream_info comment out “el”: “player_embedded” in the “params” dictionary like so:
params = {
"video_id": video_id,
#"el": "player_embedded"
}
Enjoy!