How to extend telnet interface

Discuss your Lua playlist, album art and interface scripts.
JBvidsync
New Cone
New Cone
Posts: 6
Joined: 05 Dec 2014 13:54

How to extend telnet interface

Postby JBvidsync » 05 Dec 2014 13:58

I want to add a new command to the telnet interface. How do you extend the CLI.lua script?

I copied the cli.lua, added my command to the list but on launch of vlc it complained about a nil error on the '?'. I'm guessing that the alias '?' on the help command is an issue when you simply drop a lua in the intf folder. I just copied the seek entry and changed its name. I just wanted to see a new entry when i typed help at the telnet command prompt. I'm guessing I had to compile the lua to luac but the luac.lua instruction didn't work.

When I say extend I'm thinking in terms of Java. I would like to add a new command without editing the existing lua. I realize I may have no choice but wanted to ask.

Thank you

Etoh
Blank Cone
Blank Cone
Posts: 60
Joined: 12 Jan 2013 16:33

Re: How to extend telnet interface

Postby Etoh » 06 Dec 2014 02:28

Start with cli.lua as the base then save it under a radically different filename, e.g. save the copy of cli.lua as foobar.lua. Then run it with an argument like:--extraintf=luaintf --lua-intf=foobar --lua-config "foobar={host='telnet://localhost:4213'}". If that works then try modifying foobar.lua to add the features you want by creating a new function then referring to that function within commands_ordered.

What features are you trying to add?

JBvidsync
New Cone
New Cone
Posts: 6
Joined: 05 Dec 2014 13:54

Re: How to extend telnet interface

Postby JBvidsync » 06 Dec 2014 02:40

I need to add either multiple frame jump (frameN where N is the nunber of frames we want to move forward) or millisecond seek. We found that we need to wait 0.5 seconds (0.3 in actuality but .5 to be safe) between commands sent to vlc over telnet and with a 24fps video it takes 12 seconds to get the paused video to the frame we want in order to sync 16 differently videos to the wall clock.

I'll try your suggestion later tonight and update.

JBvidsync
New Cone
New Cone
Posts: 6
Joined: 05 Dec 2014 13:54

Re: How to extend telnet interface

Postby JBvidsync » 06 Dec 2014 04:24

It may have worked. I'm on a company windows 7 laptop at the moment. When I telnet to 4213 it connects but no prompt is provided. If I close the vlc client the putty telnet window presents a dialog stating the connection was closed. I might be able to get to a Linux box over the weekend to see if that helps otherwise I have to wait until Monday.

I'll update when I can.

Thank you again for the help.

Etoh
Blank Cone
Blank Cone
Posts: 60
Joined: 12 Jan 2013 16:33

Re: How to extend telnet interface

Postby Etoh » 06 Dec 2014 09:53

You should also be able to do more precise seeks using the Syncplay interface set-position command: https://github.com/Uriziel/syncplay/blo ... ncplay.lua - Syncplay (the application that uses the interface) is intended for video syncing, although not with exact-frame accuracy.

JBvidsync
New Cone
New Cone
Posts: 6
Joined: 05 Dec 2014 13:54

Re: How to extend telnet interface

Postby JBvidsync » 06 Dec 2014 13:38

Thanks for the suggestion of syncplay. I did look at that before posting. Unfortunately we are trying to sync 16 different vlc instances each playing their own unique video. Videos that happened to be recorded at the general same wall clock time. I am also but with a requirement that they have < 100 ms sync.

Etoh
Blank Cone
Blank Cone
Posts: 60
Joined: 12 Jan 2013 16:33

Re: How to extend telnet interface

Postby Etoh » 06 Dec 2014 21:15

Thanks for the suggestion of syncplay. I did look at that before posting. Unfortunately we are trying to sync 16 different vlc instances each playing their own unique video. Videos that happened to be recorded at the general same wall clock time. I am also but with a requirement that they have < 100 ms sync.
Syncplay is fine with each playing their own video, but isn't designed specifically for looping videos or achieving frame-perfect synchronisation. However, the interface for it could still be useful.

JBvidsync
New Cone
New Cone
Posts: 6
Joined: 05 Dec 2014 13:54

Re: How to extend telnet interface

Postby JBvidsync » 09 Dec 2014 03:45

I copied the cli.lua file. Renamed the copy to framencli.lua. Copied framencli.lua to the /usr/lib/vlc/lua/intf directory. Other than changing the name of the file cli.lua is unchanged. Launched vlc using :
vlc --extraintf=luaintf --lua-intf=framencli --lua-config "framencli={host='telnet://localhost:4213'}"
I get the following error message:
VLC media player 2.1.4 Rincewind (revision 2.1.4-0-g2a072be)
[0xe1b4a8] [framencli] lua interface: Listening on host "telnet://localhost:4213".
[0xe1b4a8] [framencli] lua interface error: Error loading script /usr/lib/vlc/lua/intf/framencli.lua: /usr/lib/vlc/lua/intf/framencli.lua:797: attempt to call field 'should_die' (a nil value)
[0xbff118] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
Line 797 of the script is:

Code: Select all

while not vlc.misc.should_die() do
My best guess is the misc variables are not initialized when this script is loaded and therefore a nil error is generated but I have no idea what I'm talking about.

When I telnet to 4213 the connection is established but no prompt for password or "Hello Master" message is presented. When I close the vlc gui the connection is closed.

Is there another step to getting this to work?

Thanks again for taking the time to guide me.

Etoh
Blank Cone
Blank Cone
Posts: 60
Joined: 12 Jan 2013 16:33

Re: How to extend telnet interface

Postby Etoh » 09 Dec 2014 13:53

Line 797 of the script is:

Code: Select all

while not vlc.misc.should_die() do
I think you are using an old version of cli.lua as that line was removed in March 2013: http://git.videolan.org/gitweb.cgi/vlc. ... e31aa8ac5f

The latest version of cli.lua might be at http://git.videolan.org/gitweb.cgi/vlc. ... ua;hb=HEAD but I've not double-checked.

JBvidsync
New Cone
New Cone
Posts: 6
Joined: 05 Dec 2014 13:54

Re: How to extend telnet interface

Postby JBvidsync » 10 Dec 2014 01:04

My bad. They are using vlc 2.0.6 on site and I'm using 2.1.4 at home. I grabbed the 2.1.4 version of the source and everything lit up.

Thank you very much for your assistance.

Etoh
Blank Cone
Blank Cone
Posts: 60
Joined: 12 Jan 2013 16:33

Re: How to extend telnet interface

Postby Etoh » 11 Dec 2014 19:27

My bad. They are using vlc 2.0.6 on site and I'm using 2.1.4 at home. I grabbed the 2.1.4 version of the source and everything lit up.

Thank you very much for your assistance.
Glad to hear it works. If you do get a nice video-wall alternative to netsync for VLC working smoothly then it'd be useful for you to share the resulting source code / instructions.


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 12 guests