Jump to content
funwithmedia

Idea: VLC Plugin (for easier Resume when using VLC as External Player in Emby Theater)

Recommended Posts

funwithmedia

This post (https://emby.media/community/index.php?/topic/35769-resume-is-not-working-with-mpc-hc-in-mbt/) got me thinking about VLC (my preferred player). I've already posted a Feature Request for a manual entry option (https://emby.media/community/index.php?/topic/43209-fr-option-for-external-players-to-prompt-for-stop-time/), which the good Emby folks hope to add in the future. But I have an idea for how we could partially automate this via a plugin, for users using VLC in particular.

 

VLC has a HTTP Interface which can enable us to find out Duration (ie, total time of the currently playing item) and Elapsed time (ie, how much has been already played). I will paste an example of the XML output at the bottom of this post. We should be able to easily parse the <time> node to get the Elapsed time, and the <length> node to get the duration (both appear to be in Seconds). And then if that data has been stored in Emby for a given item, we can use the VLC Command Line --start-time=seconds to launch VLC, telling VLC to go to that point in the video.

 

A significant caveat though is that if the user is using VLC to play a full DVD rip VIDEO_TS folder (which I am a big fan of, for the DVD menu support), then --start-time is likely to not produce the desired results (because DVD's vary in how they're authored, and so the time won't get applied to correct portion of the DVD. I think that in most cases it won't actually hurt anything, and perhaps in some cases the desired result will be achieved. But my thinking is that when clicking Play, ET can display some sort of message along the lines of "You stopped your video at ~34 minutes (out of 1 hour and 55 minutes total run time). Emby will attempt to resume at your stopping point, but you may have to manually go to the 34 minute mark (depending on the media format)." And then the user would click "Proceed" and VLC would launch. This way, they know where to fast forward (or jump ahead via chapters) if they're using a format (eg, VIDEO_TS folder rips) that doesn't lend itself to easy resuming.

 

I am also exploring if there is any way to get the DVD "title" currently being played (note, this is not the movie title, but "title" as referring to the section within the DVD structure), but I'm not optimistic about being able to access that. If that is accessible, however, then it would actually be possible to construct a command line to resume the ripped DVD at the correct position, which would be rather nifty. :)

 

I am a alright programmer (I work mostly with HTML, JavaScript, PHP, CSS/SCSS, and a little VBA and other assorted Windows-centric languages), but am brand new to Emby. If the above proposed plugin interests folks, is anyone interested in collaborating on bringing this about? I could likely handle any JavaScript-related elements of pulling the data from VLC (via the VLC HTTP Interface) and parsing the XML data, but I don't know anything (yet) about how to get that into the appropriate places within Emby so that Emby is storing the data. As a side note, I figure we'll poll the XML page periodically (eg, every 60 seconds, perhaps?), and I have some additional thoughts on underlying logic for how to do things (eg, we'll want to handle the fact that a VIDEO_TS DVD folder can have multiple "titles"/videos and so be careful we don't overwrite our Elapsed Time when the user is just in the DVD menu or something -- perhaps we'd prompt the user after they exit VLC as to whether they want to update their Resume Position with the new data or keep the old data [which we could display for comparison]?).

 

Thoughts?

:)

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<root>

<fullscreen>false</fullscreen>
<aspectratio>default</aspectratio>
<audiodelay>0</audiodelay>
<apiversion>3</apiversion>
<currentplid>4</currentplid>
<time>54</time>
<volume>256</volume>
<length>6943</length>
<random>false</random>
<audiofilters>
  <filter_0></filter_0></audiofilters>
<rate>1</rate>
<videoeffects>
  <hue>0</hue>
  <saturation>1</saturation>
  <contrast>1</contrast>
  <brightness>1</brightness>
  <gamma>1</gamma></videoeffects>
<state>paused</state>
<loop>false</loop>
<version>2.2.4 Weatherwax</version>
<position>0.0079024126753211</position>
<repeat>false</repeat>
<subtitledelay>0</subtitledelay>
<equalizer></equalizer>
<information>
  <category name="meta"><info name='filename'>\\PATH\TO\MY\DVD\VIDEO_TS</info></category>
  <category name='Stream 0'><info name='Display resolution'>720x480</info><info name='Type'>Video</info><info name='Frame rate'>29.970029</info><info name='Decoded format'>Planar 4:2:0 YUV</info><info name='Codec'>MPEG-1/2 Video (mpgv)</info><info name='Resolution'>720x480</info></category>
  <category name='Stream 1'><info name='Bitrate'>192 kb/s</info><info name='Type'>Audio</info><info name='Channels'>Stereo</info><info name='Sample rate'>48000 Hz</info><info name='Language'>English</info><info name='Codec'>A52 Audio (aka AC3) (a52 )</info></category>
  <category name='Stream 3'><info name='Display resolution'>720x480</info><info name='Type'>Video</info><info name='Frame rate'>29.970029</info><info name='Decoded format'>Planar 4:2:0 YUV</info><info name='Codec'>MPEG-1/2 Video (mpgv)</info><info name='Resolution'>720x480</info></category>
  <category name='Stream 15'><info name='Type'>Subtitle</info><info name='Description'>Closed captions 2</info><info name='Codec'>cc2 </info></category>
  <category name='Stream 13'><info name='Type'>Audio</info><info name='Language'>Spanish</info><info name='Codec'>A52 Audio (aka AC3) (a52 )</info></category>
  <category name='Stream 5'><info name='Codec'>DVD Subtitles (spu )</info><info name='Type'>Subtitle</info></category>
  <category name='Stream 9'><info name='Type'>Subtitle</info><info name='Language'>English</info><info name='Codec'>DVD Subtitles (spu )</info></category>
  <category name='Stream 2'><info name='Codec'>MPEG-1/2 Video (mpgv)</info><info name='Type'>Video</info></category>
  <category name='Stream 4'><info name='Bitrate'>192 kb/s</info><info name='Type'>Audio</info><info name='Channels'>Stereo</info><info name='Sample rate'>48000 Hz</info><info name='Language'>English</info><info name='Codec'>A52 Audio (aka AC3) (a52 )</info></category>
  <category name='Stream 12'><info name='Bitrate'>448 kb/s</info><info name='Type'>Audio</info><info name='Channels'>3F2R/LFE</info><info name='Sample rate'>48000 Hz</info><info name='Language'>English</info><info name='Codec'>A52 Audio (aka AC3) (a52 )</info></category>
  <category name='Stream 17'><info name='Type'>Subtitle</info><info name='Description'>Closed captions 4</info><info name='Codec'>cc4 </info></category>
  <category name='Stream 11'><info name='Display resolution'>720x480</info><info name='Type'>Video</info><info name='Frame rate'>29.970029</info><info name='Decoded format'>Planar 4:2:0 YUV</info><info name='Codec'>MPEG-1/2 Video (mpgv)</info><info name='Resolution'>720x480</info></category>
  <category name='Stream 6'><info name='Display resolution'>720x480</info><info name='Type'>Video</info><info name='Frame rate'>29.970029</info><info name='Decoded format'>Planar 4:2:0 YUV</info><info name='Codec'>MPEG-1/2 Video (mpgv)</info><info name='Resolution'>720x480</info></category>
  <category name='Stream 16'><info name='Type'>Subtitle</info><info name='Description'>Closed captions 3</info><info name='Codec'>cc3 </info></category><category name='Stream 14'><info name='Type'>Subtitle</info><info name='Description'>Closed captions 1</info><info name='Codec'>cc1 </info></category>
  <category name='Stream 8'><info name='Codec'>DVD Subtitles (spu )</info><info name='Type'>Subtitle</info></category>
  <category name='Stream 7'><info name='Bitrate'>192 kb/s</info><info name='Type'>Audio</info><info name='Channels'>Stereo</info><info name='Sample rate'>48000 Hz</info><info name='Codec'>A52 Audio (aka AC3) (a52 )</info></category>
  <category name='Stream 10'><info name='Type'>Subtitle</info><info name='Language'>Spanish</info><info name='Codec'>DVD Subtitles (spu )</info></category>
</information>
<stats>
  <lostabuffers>5890</lostabuffers>
<readpackets>0</readpackets>
<lostpictures>518</lostpictures>
<demuxreadbytes>226224489</demuxreadbytes>
<demuxbitrate>1.485878944397</demuxbitrate>
<playedabuffers>4736</playedabuffers>
<demuxcorrupted>0</demuxcorrupted>
<sendbitrate>0</sendbitrate>
<sentbytes>0</sentbytes>
<displayedpictures>25574</displayedpictures>
<demuxreadpackets>0</demuxreadpackets>
<sentpackets>0</sentpackets>
<inputbitrate>0</inputbitrate>
<demuxdiscontinuity>0</demuxdiscontinuity>
<averagedemuxbitrate>0</averagedemuxbitrate>
<decodedvideo>4624</decodedvideo>
<averageinputbitrate>0</averageinputbitrate>
<readbytes>0</readbytes>
<decodedaudio>9955</decodedaudio>
  </stats>
</root>
Edited by funwithmedia

Share this post


Link to post
Share on other sites
Luke

Yes someone could write an Emby Theater plugin that would handle all of the legwork with Vlc params, communicate with the vlc api to support more features, etc.

  • Like 1

Share this post


Link to post
Share on other sites
funwithmedia

Cool -- thanks for the encouragement! :)

Share this post


Link to post
Share on other sites
funwithmedia

@@Luke, or others: Any thoughts/direction on my getting started with developing a plugin? I've seen https://github.com/MediaBrowser/Emby.Theater.Plugins but those all look like they haven't been updated in some time, so I don't know if that is a good reference or not. And it's not clear to me if plugins listed in the forum (https://emby.media/community/index.php?/forum/83-plug-in-descriptions/) include source code or not, or even which would be a good one for me to jump from to adapt into what I'm aiming for. Having some kind of template to start with would definitely help me in wrapping my mind around the ET architecture.

 

No worries though if there's nothing in particular to point me to or recommend -- I just figured it wouldn't hurt to ask. :)

Share this post


Link to post
Share on other sites
Luke

i haven't documented this yet, so you'll need to be handy with javascript. the current external player plugin would be a good example, where you would basically just hardcode most of the methods and config screen towards vlc.

  • Like 1

Share this post


Link to post
Share on other sites
funwithmedia

Oh that would be perfect (the current external player plugin) -- where can I find that? Looking in my local install (C:\Users\USERNAME_REDACTED\AppData\Roaming\Emby-Theater\system\electronapp\plugins which I think corresponds to this: https://github.com/MediaBrowser/emby-theater-windows/tree/master/Emby.Theater/electronapp/plugins)I only see the directshowplayer, which I interpret would be the built-in player. I feel like I must be overlooking something obvious, because I'm not seeing what I'm looking for in either of these searches:

https://github.com/MediaBrowser/emby-theater-windows/search?utf8=✓&q=external

https://github.com/MediaBrowser/emby-theater-electron/search?utf8=✓&q=external

 

It's possible it'll be within my reach to take the existing plugin and develop one specifically for VLC -- I usually do well with that sort of thing. :)

Share this post


Link to post
Share on other sites
Luke

i will get it ready for you so that you can do that. thanks.

  • Like 1

Share this post


Link to post
Share on other sites
funwithmedia

Oh, excellent -- thanks man! And just so you know, it'll probably be Tuesday at the earliest before I can really have a good look at it (I don't have much time left today, sadly), so don't rush on my account. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...