Open mad-ady opened 7 years ago
This is a feature I already wanted to support. I just have not figured out the best way to do it. There really is no need to mux the streams together. It may actually be simple to do with the beta1 architecture by having two independent source elements and graphs with only the clock line connecting them for synchronization.
I have started experimental support for this in the "dualstream" branch: https://github.com/OtherCrashOverride/c2play/tree/dualstream
./c2play-x11 http://video_stream --dual https://audio_stream
[edit] Note that for urls, it may be necessary to enclose them in quotation marks if they contain characters like "&" since they have special meaning to the shell.
./c2play-x11 "http://video_stream" --dual "https://audio_stream"
I've tried it and... it seems to work. I was unable to test sound and audio synchronization because I don't have a sound card, but playback has a bit of "lost packets" that could be seen in the logs:
Oct 12 12:40:31 uy-scuti odroid.c2.video.helper[21084]: AmlVideoSink: Adjust PTS - pts=134.311922 vpts=134.200733 drift=-0.111189 (-3.332334 frames)
Oct 12 12:40:31 uy-scuti odroid.c2.video.helper[21084]: AmlVideoSink: Adjust PTS - pts=134.409856 vpts=134.300833 drift=-0.109022 (-3.267399 frames)
Oct 12 12:40:31 uy-scuti odroid.c2.video.helper[21084]: AmlVideoSink: Adjust PTS - pts=134.410467 vpts=134.300833 drift=-0.109633 (-3.285714 frames)
Oct 12 12:40:31 uy-scuti odroid.c2.video.helper[21084]: AmlVideoSink: Adjust PTS - pts=134.411056 vpts=134.300833 drift=-0.110222 (-3.303363 frames)
Oct 12 12:40:31 uy-scuti odroid.c2.video.helper[21084]: AmlVideoSink: Adjust PTS - pts=134.411400 vpts=134.300833 drift=-0.110567 (-3.313686 frames)
I'm guessing you're on the right track. I will update my packages and request for testers.
I will likely need to add some kind of stream pre-buffering so that playback does not start until a certain amount of both video and audio have arrived.
Here's the problem. If you want to play youtube content higher than 720p you will have a video-only stream and an audio-only stream returned by youtube-dl:
It would be nice if a client could feed a video URL (such as the one returned by format 264) followed by an audio URL (such as 140) and the player could play them together. (For me playing the DASH video with your player crashes X11 and also MALI, so it may not be an option - https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP)
I realize that it will be problematic to play from two network streams (you'll have to use threads and synchronization). If you feel there's a better approach (e.g. use ffmpeg to mux them and playing from STDIN), let me know.