Skip to content
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

QuickTime player preset #511

Open
ptkovsky opened this issue Nov 20, 2017 · 14 comments
Open

QuickTime player preset #511

ptkovsky opened this issue Nov 20, 2017 · 14 comments

Comments

@ptkovsky
Copy link

Hello!

So this is sort of a feature request as I would like to know if there is a simple way to implement a function of starting a video playback with this little app https://github.com/jo-sm/twitch from this GUI?

To me personally this type of video playback (using dedicated internal decoders paired with QuickTime Player) looks like arguably the best Twitch experience on a Mac in terms of resource usage and heat, especially for many older machines out there, so it should be definitely worth a consideration.

I do realize, that this GUI was made entirely for Streamlink. But maybe a simple script or command line parameter or something would do the job, or is this way more complicated than we could ever imagine? Thanks for your detailed answers and honest opinions, cheers!

@bastimeyer
Copy link
Member

Nope, that's not possible. Streamlink is an integral part of Streamlink Twitch GUI and there are no plans to change that. What does the application you're linking do better than Streamlink, except being written in ruby, hardcoded for Twitch and having very limited features? I had a quick look at the code and all what it's doing is fetching the stream URL and passing it to the player as the first argument. That's basically the same as using the HLS passthrough option when using Streamlink. If you want to watch streams with Quicktime, just set its executable as a custom player in the Twitch GUI settings menu.

@ptkovsky
Copy link
Author

ptkovsky commented Nov 20, 2017

Hi @bastimeyer and thank you for the interest in the issue.

The application, despite having limited functionality, actually gives me an option for using QuickTime Player for Twitch out of the box and without any tweaking.

Also using this player looks like the best option for Macs as it is coded to use less resources than other players like mpv or IINA. So my laptop doesn't heat up that hard and the fan doesn't ramp up fast, so I can sit comfortably and watch videos without thinking about wearing headphones when watching streams like 1080p60.

Sure, one of the first things that I did is tried using QuickTime Player with Streamlink Twitch GUI. Sounds easy, but is this even possible? Because setting Video player executable as /Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player in the appropriate options section just doesn't work as it says that Starting player: /Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player error: Failed to start player: /Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player ([Errno 2] No such file or directory) but setting it as /Applications/mpv.app/Contents/MacOS/mpv for example, works fine.

I've also tried different Player input options like HLS too, but again, no luck. It just doesn't start. Tried setting different paths thinking that's the issue, like /Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player,/Applications/QuickTime\ Player.app/Contents/MacOS/QuickTime\ Player,'/Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player' or even"/Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player" but this gives me popup saying Error watch ENOENT.

Basically I'm really having trouble with proper configuration if it's not buggy. Would be really nice if somebody could try and test this. It looks trivial, but somehow you get this weird behavior. Something is missing? Maybe we need to enter some additional parameters or tweak some settings?

@bastimeyer
Copy link
Member

bastimeyer commented Nov 20, 2017

best option for Macs as it is coded to use less resources than other players like mpv or IINA

That entirely depends on your mpv config and its vo (video output) and hwdec (hardware decoding) settings. Quicktime is surely not doing anything special, as it's making use of basically the same accelerator APIs.

Running mpv on Linux on my Asus ultrabook I've bought this year with a KabyLake i5 CPU doesn't even trigger the fans and it's staying 100% silent while watching 1080p60 h264 videos when I'm using the opengl video output and vaapi hardware decoding options. It's going nuts when I'm using a web browser, though. There you can see why Streamlink exists...

Starting player: /Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player error: Failed to start player: /Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player ([Errno 2] No such file or directory)

That is a Streamlink error log. The Twitch GUI is resolving the player executable and setting all Streamlink parameters correctly, as you can see in the log files when launching the app with the --loglevel debug parameter:

$ open -a "/Applications/Streamlink Twitch GUI.app" --args --loglevel debug
$ open $TMPDIR/streamlink-twitch-gui/logs

If you run Streamlink without the Twitch GUI, you get the same error. This may be worth opening a new issue on the Streamlink repo...

$ streamlink -p "/Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player" --player-passthrough hls URL QUALITY

That's all I can do here for you.

@ptkovsky
Copy link
Author

ptkovsky commented Nov 20, 2017

Thanks for the explanations and help. Sure, seems like I didn't use the right words here. I meant that QuickTime Player looks to be configured better out of the box so it gives better results.

I personally lack knowledge of configuring mpv properly and recently (maybe a year or two ago) it stopped even playing 60 fps streams out of the box, so after googling, reading manuals a bit and playing a bit with hwdec options I just abandoned an idea of using it. If somebody could explain how to configure it properly that would be a huge win.

Yeah, I've read that KBL GPUs have fresher architecture and specifically lot more advanced hardware decoding blocks than some older chips. My MBA has a Sandy Bridge HD 3000 GPU though and it's going crazy when playing 1080p60 whatever I tried to use for playback, and temps reach about hundred degrees very fast. I also have a Windows laptop with the same GPU and it overheats even harder. So I was wondering if one could find the best software solution for it to stop heating this fast and not to mention that the fan noise that can quickly harm even healthy nervous system. Yes you can change the TIM and clean some dust but it doesn't help much as I've already digged into that part of the story.

So this is the same output I'm getting again here while following your suggestion.

streamlink -p "/Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player" --player-passthrough hls https://www.twitch.tv/agentjkezoor best
[cli][info] Found matching plugin twitch for URL https://www.twitch.tv/agentjkezoor
[cli][info] Available streams: audio_only, 160p (worst), 360p, 480p, 720p, 720p60 (best)
[cli][info] Opening stream: 720p60 (hls)
[cli][info] Starting player: /Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player
error: Failed to start player: /Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player ([Errno 2] No such file or directory)

Big thanks for the tips and time. Looks like I should definitely try to open an Issue there.

@ptkovsky
Copy link
Author

ptkovsky commented Nov 20, 2017

So it seems to work in a weird way as described here streamlink/streamlink#1338. Now, what to put in GUI settings to make it work? Should user try manual configuration? I personally tried different stuff but again ENOENT error appears or it just doesn't start. Or maybe Mac version should get it as a player preset for easy configuration in the future?

@ptkovsky
Copy link
Author

ptkovsky commented Nov 22, 2017

Alright, so seems like we have a sort-of-working solution now unless a player preset will be implemented soon which will make things even easier.

Tested this with recommended commands from the other thread and it worked fine on High Sierra (10.13.1) environment with Streamlink Twitch GUI 1.4.1 and Streamlink 0.9.0. Thanks @bastimeyer for this solution, as always.

So if somebody is still curious how to start streams from the GUI using QuickTime Player, please don't forget to set Player input as HLS (passthrough) in Streaming Settings, seems like it doesn't work otherwise. Now select Player tab, choose no Player preset and set Video player as /usr/bin/open and Parameters as -W -n -a '/Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player' {filename}.

@bastimeyer bastimeyer changed the title An option for starting QuickTime Player via Twitch ruby gem from this GUI. QuickTime player preset Nov 22, 2017
@bastimeyer
Copy link
Member

I've changed the issue title...
Don't forget the leading space in the player args.

As I've said, before this can get implemented, a few things need to get changed first. Also, player dependent Streamlink parameters are also a thing that needs to happen first.

@ptkovsky
Copy link
Author

Tried without leading space and it worked fine too. Btw I didn't test much but there is a bug in the UI where it shows the number of opened streams in the upper right corner. The counter doesen't decrease after you've opened something and then closed the player, it keeps stacking over and over.

@anilanar
Copy link

Just chiming here, opening twitch streams with livestreamer is trivial:

open -a "quicktime player" $(livestreamer --http-header Client-ID=jzkbprff40iqj646a697cyrvl0zt2m6 --stream-url twitch.tv/the_happy_hob best)

Summary: Livestreamer generates a m3u8 URL that quicktime can open given --stream-url option. Rest is simple.

@bastimeyer
Copy link
Member

livestreamer

@anilanar please stop using and recommending Livestreamer, it's a dead project and its maintainer is not active anymore since several years. There is a reason why it got forked and why the Twitch GUI has been renamed a year ago. I'm still seeing many people suggesting to install Livestreamer in combination with the Twitch GUI. This really makes me sad and I don't understand what I could have done better to communicate this change. Streamlink is a continuation of Livestreamer, so there is absolutely no reason to ever use Livestreamer. Streaming platforms change, which means you can't be using a software which won't receive updates anymore. The required Twitch API access token when using Livestreamer is the best example here and once Twitch has switched over to their new API next year, Livestreamer will break 100%.

Regarding your Quicktime player example, that's basically the same which has already been posted here. You're just launching Quicktime manually while substituting the URL parameter by using shell syntax. The --player-passthrough hls parameter works exactly the same way and lets Streamlink/Livestreamer launch the player instead. What's important is the behavior of macOS's open command, which requires certain parameters in order to play nicely with Streamlink/Livestreamer and the Twitch GUI.

See this thread over here:
streamlink/streamlink#1338

@NilsEnevoldsen
Copy link
Contributor

I used to stream via Quicktime by using the "player" /usr/bin/open and the parameters -W -n -a '/Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player' {filename}. As of MacOS Catalina 10.15, this stopped working for me, but changing the parameters to -W -n -a 'QuickTime Player' {filename} made it work again. (I'm not sure why.)

@ptkovsky
Copy link
Author

ptkovsky commented Oct 8, 2019

After upgrading to 10.15 when trying to play any stream using methods mentioned in this thread, the VTDecoderXPCService starts working with the first video, and begins consuming a lot of CPU time. It is looking like the video is being processed without any GPU usage involved.

Could this behavior be some sort of hardware acceleration/GPU driver issue? Or there is just a syntax issue and we need a correct command?

Before upgrading to 10.15, using these methods of launching streams, the first instance of the QuickTime Player would conveniently start playing the desired stream, consuming very little CPU time, and importantly, the ill-fated VTDecoderXPCService would not start, resulting in very moderate energy consumption and quiet operation. It would only kick in after launching second or third stream. Not sure if this is ideal behavior or not, but machine stayed cool when watching one stream, so it was sort of fine I guess.

Testing this on officially unsupported mac with all the necessary patches re-applied a few times already. Any constructive thoughts would be greatly appreciated.

@ptkovsky
Copy link
Author

ptkovsky commented Oct 8, 2019

Would like to confirm that changing parameters like @NilsEnevoldsen proposed works just fine. Thank you for the solution.

Also, the described issue is persistent. Tested now and when launching two random streams, sadly, getting instant 100% CPU usage. Can someone explain what's happening?

@ptkovsky
Copy link
Author

ptkovsky commented Oct 8, 2019

So from what I understand, it looks like hardware acceleration patches are still not there yet, despite being in development for few months now. Will probably just wait, or consider downgrading back to High Sierra or something. Don't see how Streamlink can help solving these issues. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants