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

Support for MPC-BE as a player #9

Closed
Zero3K opened this issue Feb 18, 2018 · 50 comments
Closed

Support for MPC-BE as a player #9

Zero3K opened this issue Feb 18, 2018 · 50 comments
Labels
enhancement New feature or request

Comments

@Zero3K
Copy link

Zero3K commented Feb 18, 2018

It would be nice if it supported MPC-BE (https://www.videohelp.com/software/MPC-BE) as a player. You can add any questions you have regarding it since I'll post a link to this issue in the Doom9 Forums to see if anyone can help get it supported.

@Felmachersoft Felmachersoft added the enhancement New feature or request label Feb 19, 2018
@Felmachersoft
Copy link
Owner

It comes down to the question if it can be controlled remotely well enough to fulfill following tasks:

  1. Load a video with external audio source
  2. Get the current playback time relative precise. The time between the actual playback time of the player changed and the information about this change is noticed by StreamBuffRe should be below 100 ms. At best this is handled via an event instead of polling the player to get the new playback position.

Now that sourceforge is back up I can take a look at the source code to find out if it is possible.

@Zero3K
Copy link
Author

Zero3K commented Feb 19, 2018

Its source code is located at https://sourceforge.net/projects/mpcbe/.

@Zero3K
Copy link
Author

Zero3K commented Feb 23, 2018

Any news regarding this suggestion?

@Felmachersoft
Copy link
Owner

I looked into the source code and found some important stuff and think it is possible. I will try to implement it and will provide a plugin first to see if it works.

One minor problem I found so far is the selection of the audio device (MPC-BE seems to use a custom ordering of audio devices).

As soon as I have a plugin ready I will upload it here.

@Zero3K
Copy link
Author

Zero3K commented Feb 24, 2018

That's good to know. I'm looking forward to trying out the plugin and letting you know if it works or not.

@Zero3K
Copy link
Author

Zero3K commented Feb 25, 2018

How is it coming along?

@Felmachersoft
Copy link
Owner

It's done when it's done. Be patient.

@Zero3K
Copy link
Author

Zero3K commented Feb 26, 2018

Okay. I hope that it is going well.

@Zero3K
Copy link
Author

Zero3K commented Mar 2, 2018

It sure is taking a while.

@Felmachersoft
Copy link
Owner

It is not a simple task, and many little problems show up (and I had plenty other stuff to do this week).
What is working so far:

  • Starting MPC with a stream
  • Getting Playbackposition
  • Getting Playerstatus

What is not working so far:

  • Starting multiple MPCs (Instead of starting a new instance, the old instance plays the new stream)
  • It seems not possible to change the player title (to show what the actual stream name is)

The next update will contain some necessary changes for the MPC plugin. The plugin will be relased together with the update.

@Zero3K
Copy link
Author

Zero3K commented Mar 2, 2018

  1. Did you change the Open options in its Options?
  2. That's okay though.

EDIT: Would adding the /new command line parameter fix the first issue that you're having with the plugin or not?

@Felmachersoft
Copy link
Owner

  1. You are right. I only saw the option to start a new player every time in the settings, but missed the /new switch. Will use it then, might also help with another problem.
  2. It bothers me especially when using multiple players cause a title like "Player X - Streamname" helps identifying which player plays what. But if it can't be done, it can't be done.

I hope to release the update and plugin for testing this weekend.

@Zero3K
Copy link
Author

Zero3K commented Mar 2, 2018

Maybe the code shown on the linked page can be compiled into an exe and used by StreamBuffRe to rename the window(s) used by MPC-BE:

https://stackoverflow.com/questions/39021975/changing-title-of-an-application-when-launching-from-command-prompt

There's also https://ritchielawrence.github.io/cmdow/ which supports wildcards. So, the command would be cmdow MPC-BE* /ren Player 0 (or whatever you want).

@Felmachersoft
Copy link
Owner

I do know that this is possible, but manipulating foreign windows is everything but good practice. I will keep it mind though.

@Zero3K
Copy link
Author

Zero3K commented Mar 3, 2018

Its the weekend now. I hope that the plugin making is going well.

@Felmachersoft
Copy link
Owner

Felmachersoft commented Mar 4, 2018

I'm aware of that...

First ensure you are on version 0.5.8.1 .
Then take a look at: https://github.com/Felmachersoft/StreamBuffRe/tree/master/experimental

I uploaded the MPCPlayer.dll there for testing. The readme will tell you how to use the plugin.
After loading the plugin into StreamBuffRe create a new PlayerProfile for the MPC Player.
First ensure the path to the mpc-be.exe is correct.
Then check the settings in MPC-BE and set Player -> Open options and set the top option "Use same process for every file".
After that you should be ready for testing.

It has yet many flaws, if you find more add them in this issue only. Only tested with windows 7 so far.

Known problems so far:

  1. Livestreams take some time to load sometimes
  2. Closing MPC-BE directly makes it hang for a short time. (Could be an MPC-BE problem)
  3. The "play in running player" option is not working as intendent due to the way new streams are opened in MPC-BE.
  4. The name of the stream is not shown in MPC-BEs title bar (could be fixed with the hack from above).
  5. Resizing and moving player window can fail in certain cases (needs more testing to find which cases these are)
  6. The end of Streams is not yet detected, could be problematic for auto play.
  7. Settings another Audio device is possible but will most likely fail due to an MPC-BE specific error (at least on my machines...). Maybe I remove the setting from the PlayerProfile.
  8. Closing MPC-BE can cause sending an invalid time for the current stream corrupting the Playlistentry and making it unplayable ( for now just remove and readd the entry).

Happy testing

@Zero3K
Copy link
Author

Zero3K commented Mar 4, 2018

I tried it with https://www.twitch.tv/flarerdb at 720p. MPC-BE stated "Failed to render the file". Also, its expecting its file name to be mpc-be.exe. It should also accept its name to be mpc-be64.exe.

@Felmachersoft
Copy link
Owner

I will allow any .exe file with the next release of the plugin, cause MPC-HC should be fully compatible as well.

The problem with the stream might be caused by the 64bit version and/or windows 10. It works fine with windows 7 and the 32bit version 1.5.1.2985 for me. Problems with any other streams or VODs, including youtube and other sites?

@Zero3K
Copy link
Author

Zero3K commented Mar 4, 2018

  1. I noticed that it'll sometimes change the quality to the lowest possible.
  2. The VOD I am playing in it isn't being downloaded quickly. It is the one at https://www.twitch.tv/videos/234660490.

@Felmachersoft
Copy link
Owner

12 hours, okay that is quite a big one.

I checked it with MPC-BE directly (using the URL to the VODs .m3u8 file) and it crashed two times and one time the rendered failed to initialized. Hence this is a MPC-BE specific problem => can't fix.

The reason it loads so slow is the same problem as in #2 , MPC-BE reads the segments too slow, preventing StreamBuffRe from loading faster. The slow loading is the same MPC-BE specific problem as above.

The quality change occurs when a quality is not working (caused also by the MPC-BE problem above), hence this behavior is desired (You can change it at Settings -> All settings -> Main settings -> "if stream quality not available, automatically try next one" ).

Contact the MPV-BE developers to fix the issue with very, very long streams.

@Zero3K
Copy link
Author

Zero3K commented Mar 4, 2018

Here's the errors I am getting in the log when I uncheck the "Automatically try next quality" option:

1:29:58 PM - CommandQueue executing command: AddPlaylistEntries
1:30:02 PM - CommandQueue executing command: PlayStream
1:30:02 PM - OpenStream opening stream:TwitchPlaysPokemon
1:30:02 PM - PlaylistEntry starting creation StreamJob for url: https://www.twitch.tv/twitchplayspokemon
1:30:03 PM - PlaylistEntry finished creation of StreamJob for url: https://www.twitch.tv/twitchplayspokemon
1:30:03 PM - StartStreamConsumer started HTTP_StreamProvider with adress: http://localhost:55560/
1:30:09 PM - SegmentDownloadQueue1 Error while downloading segment (try nr: 0): Could not download data from https://video-edge-c2a1d4.atl01.hls.ttvnw.net/v1/segment/CuwC5lgSgHi0X7ceL7OK3e4DQNnRKpFG8kptxxQPHcDTZO1NOcihBMy9Ar_RuFsp95o6m47Feq0S4Nex6GCRwBJMVJZu8GEMt8nqJOUHSK-bvoAXJxol0qpfC3x4tlyCU2irpsLpWLu8Sv4lZof2IK87oaXsyVik4pXCRfC0mbxo_4yIHh8iiFJSyOaEGPSYRG_yiwUODZNYpsS--0h8nOS9ytFAtsYvQ7VOexsQCEd_Ht7hOIz1ViEd_UMFxAOJX8qAERg4gZqrukFzTR55-AP3xjUr49BWQYV_YX2UWfLfvoSSjw4NqcGeH6bhRDxzD3DwdwyTJhOUxH71gJZyw19qxFjysoWOyg-uOJNh3e7F0FBk47vwzgrWsaG4oO2tomd9h2enGZhygx8S7URJPEkL2QQtpQuBidodccRQ8bXKQjEaAgkhjZPupLyzIVeW_XzT9hSI46iJS4kKE3W6LY-OmVztuZiTNN2cQu2dehIQ7PZZ-Y648nJDXYqGvkYQYxoMNsr1gGEpHzgUaySY.ts in given time limit 6000 ms 1:30:13 PM - MainController HLS Stream 'TwitchPlaysPokemon' closed by user request - 1:30:13 PM - SegmentDownloadQueue1 disposed DownloadQueue for: TwitchPlaysPokemon
1:30:13 PM - HLS_StreamProvider Disposed
1:30:13 PM - MainController Quality not available - The stream 'TwitchPlaysPokemon' does not provide the selected quality.
1:30:24 PM - CommandQueue executing command: PlayStream
1:30:24 PM - OpenStream opening stream:TwitchPlaysPokemon
1:30:24 PM - PlaylistEntry starting creation StreamJob for url: https://www.twitch.tv/twitchplayspokemon
1:30:25 PM - PlaylistEntry finished creation of StreamJob for url: https://www.twitch.tv/twitchplayspokemon
1:30:25 PM - StartStreamConsumer started HTTP_StreamProvider with adress: http://localhost:55560/
1:30:31 PM - SegmentDownloadQueue1 Error while downloading segment (try nr: 0): Could not download data from https://video-edge-c2a1d4.atl01.hls.ttvnw.net/v1/segment/CuoCL4ucfYD9EbcMu9RlkLp3WuZyknWtZaWmpZqGcjoxgyTd3da2-d53TRTSoyuvEfjk0eO_j421qSe-5ZkuH-255Wcfu1gL_6N7Vsa58wDuVd33pEetfxfGYy5agqXrz_Cski9axjoQpHgOwpEGlPDjpYsw2U9h8zAfgTGExr32af4CcK0-Qi7Oyqj4FhWDgNvLXqu_ym8X522jHDponnHUdKwbMPnPTdUl00CggtasYKFlUjztkzg5Psz_oHXN1UgEtoqXk7s1II1jVpFLnGSdjeam4H87DjspMSEk5ZJzymlOgRU3sQ0kv1YbL90opCLoBdB8gjDL2yW-yT0CKQhwmnRl1fnjb14K64PEe3-IlQ-ovsQWF3d9nIv5peeNhDf95IkcvC8uWXi4V95VKYdy3qdc78rIN-yz-dovetAG4WUpYGgX7y6sNWIdURRRF8HXEqe4MSEZnDVc9x4k3WHquzp_IiBtvg0zIvESEPm38gtAB5nKLsYrjNPQ9N0aDLZ8BLSfhODyNYM8LQ.ts in given time limit 6000 ms 1:30:35 PM - MainController HLS Stream 'TwitchPlaysPokemon' closed by user request - 1:30:35 PM - SegmentDownloadQueue1 disposed DownloadQueue for: TwitchPlaysPokemon
1:30:35 PM - HLS_StreamProvider Disposed
1:30:35 PM - MainController Quality not available - The stream 'TwitchPlaysPokemon' does not provide the selected quality.

@Zero3K
Copy link
Author

Zero3K commented Mar 4, 2018

Also, https://hooktube.com/watch?v=d_GIhwOvXL4 is freezing/losing audio.

@Zero3K
Copy link
Author

Zero3K commented Mar 4, 2018

Hmm, The latest version of MPC-HC (which is available at https://github.com/clsid2/mpc-hc/releases) works better with StreamBuffRe than the latest nightly of MPC-BE.

EDIT: The only issue is that Twitch VODs aren't seekable when using the latest version of MPC-HC via the plugin you provided.

@Felmachersoft
Copy link
Owner

Felmachersoft commented Mar 5, 2018

Here's the errors I am getting in the log when I uncheck the "Automatically try next quality" option:

This is not an error but the desired behavior: The quality is not working and no other should be tested, thus the stream can't be played.

Always provide the version of the used players. In order to test if the problem is really caused by StreamBuffRe, right clicking on an playlistentry and selecting "show info" and get the direct video URL there. If the player can't handle the videos, it's not StreamBuffRes problem.

@Zero3K
Copy link
Author

Zero3K commented Mar 5, 2018

It was my Internet Connection. It was having high ping yesterday.

@Zero3K
Copy link
Author

Zero3K commented Mar 6, 2018

One thing I noticed about MPC-HC is that the playback of a Twitch Stream (Calebhart42) was being jerky today.

@Zero3K
Copy link
Author

Zero3K commented Mar 6, 2018

Did you figure out how to fix any of the issues that it is having?

@Felmachersoft
Copy link
Owner

Only post something here if you are sure the problem is on StreamBuffRe and not MPCs side.

So far I figured the last one out and fixed it:

  1. Closing MPC-BE can cause sending an invalid time for the current stream corrupting the Playlistentry and making it unplayable ( for now just remove and read the entry).

The others so far:

  1. Livestreams take some time to load sometimes
  2. Closing MPC-BE directly makes it hang for a short time. (Could be an MPC-BE problem)

Problems on MPC side, can't fix.

  1. The "play in running player" option is not working as intendent due to the way new streams are opened in MPC-BE.

This can only be handled if MPCs slave mode is used which I haven't yet get to work.

  1. The name of the stream is not shown in MPC-BEs title bar (could be fixed with the hack from above).

Will do the hack.

  1. Resizing and moving player window can fail in certain cases (needs more testing to find which cases these are)

The actual reason is the web control of MPC is not responding (sometimes it works if you wait a bit, but in the end the only real fix is the usage of the slave mode)

  1. The end of Streams is not yet detected, could be problematic for auto play.

Should be easy, just not done yet.

  1. Settings another Audio device is possible but will most likely fail due to an MPC-BE specific error (at least on my machines...). Maybe I remove the setting from the PlayerProfile.

I don't see any way to handle this. The audio device can be changed when using the MPC Audio renderer, but I don't see a way to change it via remote control or starting parameter.

@Zero3K
Copy link
Author

Zero3K commented Mar 6, 2018

I don't think the developers of MPC-BE care about supporting a 3rd party program's plugin. You'll need to post on the forum post regarding MPC-BE at https://forum.doom9.org/showthread.php?t=165890&page=258 yourself if you want to see the issues fixed.

@Felmachersoft
Copy link
Owner

I don't care about 3rd party software either. If the player can't do stuff so it be. The main player is and will be MPV anyway. I won't invest too much time into this, it is a nice feature but nothing necessary.

@Zero3K
Copy link
Author

Zero3K commented Mar 7, 2018

Here's what one of the developers recently wrote in its forum post:

"Official ways to control the player:

  • keyboard and mouse
  • command line
  • web interface
  • MPCAPI_COMMAND (mpcapi.h)

If something of this does not work correctly, then tell me exactly what.
If there are problems with the playback of the network stream, then try LAV Slplitter Source."

@Zero3K
Copy link
Author

Zero3K commented Mar 7, 2018

I tried LAV Splitter Source with MPC-BE. It works every now and then. Sometimes, it plays the stream that I have playing in another player window when I try to play another stream in the second window while the first stream is opening.

@Felmachersoft
Copy link
Owner

Right now I'm only using the web interface. I guess the MPCAPI_COMMAND interface is the slave mode. I will see if I can get it to work.

The problems with MPC not playing some streams correctly has nothing to do with StreamBuffRe itself thus not belong here. As I stated before, ensure the problem is not caused by MPC by using the direct stream address.

@Zero3K
Copy link
Author

Zero3K commented Mar 8, 2018

  1. Okay.

@Felmachersoft
Copy link
Owner

I finally figured out the problem with slave mode and can finally use it. I hope this helps solving most of the problems concerning remote controlling. I hope to release a new version of the plugin soon and if it works ok, it will be merged into original StreamBuffRe.

The direct link is not working ( send the unresolved link instead ). Test the video and stream with MPV. If MPV handles it correctly this problem is either on MPC side or still #2 .

@Zero3K
Copy link
Author

Zero3K commented Mar 10, 2018

  1. How did you manage to figure out slave mode?
  2. By Issue with having multiple streams open #2, do you mean the issue with having multiple streams playing at one time? I think that StreamBuffRe isn't giving MPC-BE enough time for it to start playing the stream. I have no issues playing them via MPV.

@Felmachersoft
Copy link
Owner

  1. I did use the wrong thread to create the handle.
  2. That could also be the case, slave mode will hopefully make MPC start faster. We will see, if not I can raise the timeout for players to start.

@Zero3K
Copy link
Author

Zero3K commented Mar 10, 2018

  1. Does me being on a SSD make a difference or not?

@Felmachersoft
Copy link
Owner

An SSD is even better because it will make start the programs on it faster. But HDD or SSD doesn't make the create difference here.

@Zero3K
Copy link
Author

Zero3K commented Mar 11, 2018

Have you tested the changes that you made yet?

@Felmachersoft
Copy link
Owner

Ok, I tested the slave mode in depth with MPC-BE and MPC-HC, the results:

  1. I decided that MPC-BE is not stable enough (doesn't open streams sometimes, loads them very slow... ), so I will focus on MPC-HC from now on (though the remote control should be the same for both thus interchangeable).

  2. MPC-HC (1.7.13.0 64bit) seems to have a problem in the way slave mode is implemented. Everything works besides the message telling StreamBuffRe the current position in the stream. It is "|||http://localhost:55557/|206.600" (last entry is the amount of seconds of the full video, the current position is missing, MPC-BE instead correctly includes the current position).

  3. Slave mode does not support some features the web interface provides. The important ones for StreamBuffRe are:

  • Can't directly set volume (only change the current loudness by +/- 5 )
  • Can't set the window style (normal, compact, minimal)
  • Can't set separated audio and video streams (necessary for many youtube videos, this can't be done via webinterface either, but via command line parameters which can only be used of only one Player instance is running)

Conclusion: I want to use slave mode and webinterface at the same time to overcome the downsides of each one.

The current problem: The webinterface works a short time and then refuses the connection. I'm unsure of the cause, but I guess it's on StreamBuffRes side (Calling 'http://localhost:port/variables.html' every 100 milliseconds might be a bit too much for MPC-HC or StreamBuffRe ).

I will test other versions of MPC-HC to see if the problem with the slave modes missing current position and the webinterface also occur.

@Zero3K
Copy link
Author

Zero3K commented Mar 19, 2018

I am home from Arizona now. I hope that the new build of the plugin is available for downloading soon.

@Zero3K
Copy link
Author

Zero3K commented Mar 21, 2018

Any more news?

@Felmachersoft
Copy link
Owner

I still hope to make the remote control for MPC-HC more stable and some more testing is necessary, but I will release a new version of StreamBuffRe this weekend with the current MPC plugin included.

As far as I can see the problem of having multiple MPC instances running but being unable to correctly switch streams (if the new stream has separate audio and video track) while running can't be fixed due to limitations of MPCs remote control interfaces.

@Zero3K
Copy link
Author

Zero3K commented Mar 24, 2018

  1. What about increasing the time out value so that the stream can load in MPC-BE?
  2. Will the fixes you did since the one you put up on Github be included or not?

@Felmachersoft
Copy link
Owner

  1. It is a problem with MPC-BE and can't be handled on StreamBuffRes site. MPC-HC makes it obvious cause it works way better. Officially only MPC-HC will be supported, problems only occurring with MPC-BE and not MPC-HC won't be fixed.
  2. Tomorrow I will release a new StreamBuffRe version, it will include the most up to date version of the plugin, the plugin in this repo will be removed at the same time.

More info will be given here after the update is live.

@Felmachersoft
Copy link
Owner

Please remove the plugin dll from your plugins folder before updating StreamBuffRe, I will add more info here tomorrow.

@Zero3K
Copy link
Author

Zero3K commented Mar 25, 2018

Interesting, MPC-BE is working now. I've just noticed it timing out when watching a stream via MPC-BE when MPC-HC didn't. Maybe that's still an issue with StreamBuffRe itself.

@Felmachersoft
Copy link
Owner

As stated before I guess it is related to #2. Anyway there won't be any pure MPC-BE related fixes.

Due to MPC-HC being supported now, Please create new issues for found bugs concerning MPC-HC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants