mozilla-plugin-vlc and subtitles

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
auelihein
Blank Cone
Blank Cone
Posts: 12
Joined: 07 Mar 2007 09:40

mozilla-plugin-vlc and subtitles

Postby auelihein » 07 Mar 2007 11:37

Hi everybody,
I am using the mozilla-plugin-vlc to play a streamed video from a distant vlc. The video is a TS(transport stream) format. The problem is that I am unable to switch among all the audio stream of the original video and the worth is that I can't display the subtitles.
I would like to know if a choice among audio streams and subtitles is possible by the mozilla-pulgin-vlc like it is by the real vlc.
Thank you all !
aurelien
Ratatouille team

Spellcoder
Blank Cone
Blank Cone
Posts: 57
Joined: 19 Apr 2006 12:21
Location: Hengelo // The Netherlands
Contact:

Postby Spellcoder » 07 Mar 2007 20:12

If you're using 0.8.6 or newer of the plugin you can use the options to set the starting audio-track and subtitle:

Code: Select all

var options = ':audio-track='+(audioTrack)+' :sub-track='+subtitleTrack; vlc.playlist.clear(); vlc.playlist.add(URI,null,options); // MRL, name, options vlc.playlist.play();
If you're using an 0.9.0 nightly you can switch audio-streams too (not subtitle streams, although I suggested it here: viewtopic.php?t=32397).

Setting an audio-stream

vlc.audio.track = streamID;

Getting a list of available audio-streams:
There's no way to get a list of available audio-streams or which language they are (I requested the feature: viewtopic.php?t=29337), but you can cheat by trying to changing audio stream while playing to see whether VLC will return an error, like this:

Code: Select all

var streamExists = []; // DVD has 8 possible audio streams currentStream = player.playerObj.audio.track; for (var streamID=1; streamID<=8; streamID++) { try { streamExists[streamID] = player.playerObj.audio.track = streamID; } catch(err) { streamExists[streamID] = false; } } player.playerObj.audio.track = currentStream;
Starting an video in 0.9.0

In 0.9.0 nightly the vlc.playlist.add() method is asynchronous (ticked #1083). So it doesn't add the item right away, so you'll have to wait before playing, like this:

Code: Select all

vlc.playlist.clear(); vlc.playlist.add(URI,null,options); // MRL, name, options delayedPlay(); function delayedPlay() { if (vlc.playlist.items.count == 0) { setTimeout('delayedPlay()',50); return; } vlc.playlist.play(); }

edit: changed code to detect audio-streams to start from index 1 and to set the original stream back after it scanned the streams.
Last edited by Spellcoder on 12 Mar 2007 16:38, edited 2 times in total.
my hideout: http://www.spellcoder.nl
my VLC bugreports: https://trac.videolan.org/vlc/query?rep ... spellcoder
likes coding, designing, WoW, VLC&plugin, Amiga's and Mac's & fluffy cats

auelihein
Blank Cone
Blank Cone
Posts: 12
Joined: 07 Mar 2007 09:40

Postby auelihein » 08 Mar 2007 16:26

I would like to thank you a lot for the time spent !!!
Every thing work perfectly now, the mozilla-plugin-vlc is very powerfull!
I would like to know though where you get those informations about the parameters of the mozilla-vlc-plugin.
Thank you in advance
aurelien
Ratatouille team

Spellcoder
Blank Cone
Blank Cone
Posts: 57
Joined: 19 Apr 2006 12:21
Location: Hengelo // The Netherlands
Contact:

Postby Spellcoder » 08 Mar 2007 16:55

This is the official description of the API:
http://www.videolan.org/doc/play-howto/ ... l#id294468

It's not 100% complete/correct though:
  • afaik there's also an .playlist.playItem(itemID) method
  • it doesn't mention .audio.track yet, probably since it's in 0.9.0 nightlies (testversions) and not in stabile version yet
  • doesn't mention method .playlist.add() gives back an ID. You can use this ID if you want to play or remove a specific item from the playlist.

    Code: Select all

    itemID = vlc.playlist.add(URI,null,options); .. vlc.playlist.removeItem( itemID ); or vlc.playlist.playItem( itemID );
  • it says about .playlist.add() : 'All input values must be given as string', but I hear it accepts an array for options too(?)
If you scroll up in the webpage I linked (or use this direct link: http://www.videolan.org/doc/play-howto/ ... l#id291949 ) you can see the list of all (command-line)options you can pass.

I'm thinking about writing some examples or tutorial on my website on basic usage, audio-streams, subtitles, dvd-video, deinterlacing, which bugs to expect and workaround and getting firefox+vlc to run from DVD. I'll do it when I have time and if there's interest in it.
my hideout: http://www.spellcoder.nl
my VLC bugreports: https://trac.videolan.org/vlc/query?rep ... spellcoder
likes coding, designing, WoW, VLC&plugin, Amiga's and Mac's & fluffy cats

auelihein
Blank Cone
Blank Cone
Posts: 12
Joined: 07 Mar 2007 09:40

Postby auelihein » 08 Mar 2007 17:12

your tutorial is a really good idea !
thank you for the documentation, i was blind when i read it before, because of course i already read it.
thank you and let me know if you plan to make your tutorial.
aurelien
Ratatouille team

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Postby Jean-Baptiste Kempf » 08 Mar 2007 18:05

And use the WIki for documentations !
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

auelihein
Blank Cone
Blank Cone
Posts: 12
Joined: 07 Mar 2007 09:40

Postby auelihein » 09 Mar 2007 15:16

I have a big problem,everything was working well, i didn't touch anything and now it doesn't work anymore, i don't understand what is going on!
The problem is that the function

Code: Select all

var itemId = vlc.playlist.add(media_url,null,':audio-track=0 :sub-track=0');
is not recognized anymore
but if I try to use :

Code: Select all

var itemId = vlc.playlist.add(media_url);
It works but i can't choose my subtitleTrack and my audioTrack anymore...
Did i use something forbidden before and disable the function vlc.playlist.add(mrl,name,options)
Thank you for your help.[/code]
Ratatouille team

Spellcoder
Blank Cone
Blank Cone
Posts: 57
Joined: 19 Apr 2006 12:21
Location: Hengelo // The Netherlands
Contact:

Postby Spellcoder » 10 Mar 2007 12:48

I have a big problem,everything was working well, i didn't touch anything and now it doesn't work anymore, i don't understand what is going on!
The problem is that the function

Code: Select all

var itemId = vlc.playlist.add(media_url,null,':audio-track=0 :sub-track=0');
is not recognized anymore
Which version of the plugin do you use?

In case you might use my 'hack' to read which streams are available, you have to remember which track was active and set it back afterwards.
my hideout: http://www.spellcoder.nl
my VLC bugreports: https://trac.videolan.org/vlc/query?rep ... spellcoder
likes coding, designing, WoW, VLC&plugin, Amiga's and Mac's & fluffy cats

auelihein
Blank Cone
Blank Cone
Posts: 12
Joined: 07 Mar 2007 09:40

Postby auelihein » 12 Mar 2007 09:33

I am using the version 0.8.6a of vlc, I guess that the plugin version is the same ;-)
I didn't change anything now it is working on mozilla firefox, but not with internet explorer.
With internet explorer I'm using mv_embed which permits to use a vlc plugin under javascript, i use that too for mozilla and safari
The function vlc.playlist.add doesn't seem to be recognized. I should check if it is not a trouble with the java !
aurélien
Ratatouille team

Spellcoder
Blank Cone
Blank Cone
Posts: 57
Joined: 19 Apr 2006 12:21
Location: Hengelo // The Netherlands
Contact:

Postby Spellcoder » 12 Mar 2007 14:40

I don't know why it would start to fail.
Did find some other interesting stuff though:

A list of all options you can pass to VLC:
http://wiki.videolan.org/index.php/VLC_ ... -line_help

More recent version of the VLC-plugin methods:
http://wiki.videolan.org/Documentation: ... 0.8.5.1.29

And also the newest nightly now supports changing subtitles during playback (thanks to jpsaman).

The first nightly to have this can be found here:
http://nightlies.videolan.org/build/win ... 0312-0000/

I've tested it with some DVD's and it seems to work nicely :).
How to use:

Selecting an subtitle stream
like vlc.audio.track the streamnumber is one higher than if set with the command-line (probably because 0 means 'off')

Code: Select all

vlc.video.subtitle = stream+1
disable subtitle

Code: Select all

vlc.video.subtitle = 0
Last edited by Spellcoder on 12 Mar 2007 17:43, edited 1 time in total.
my hideout: http://www.spellcoder.nl
my VLC bugreports: https://trac.videolan.org/vlc/query?rep ... spellcoder
likes coding, designing, WoW, VLC&plugin, Amiga's and Mac's & fluffy cats

Spellcoder
Blank Cone
Blank Cone
Posts: 57
Joined: 19 Apr 2006 12:21
Location: Hengelo // The Netherlands
Contact:

Postby Spellcoder » 12 Mar 2007 16:35

Ok, by coincidence I also have a case where VLC fails to play back sound.
It might have something to do with trying to start playback before VLC is fully initialized?? In any cause it happened in both 0.8.6, but in 0.9.0 I could force the sound to restart (when playback started) using:

Code: Select all

player.playerObj.audio.track = player.playerObj.audio.track;
Somehow this line made me smile :lol:
Just trying to give you an idea what might cause it...
Don't know if it's any help.
my hideout: http://www.spellcoder.nl
my VLC bugreports: https://trac.videolan.org/vlc/query?rep ... spellcoder
likes coding, designing, WoW, VLC&plugin, Amiga's and Mac's & fluffy cats

Spellcoder
Blank Cone
Blank Cone
Posts: 57
Joined: 19 Apr 2006 12:21
Location: Hengelo // The Netherlands
Contact:

Postby Spellcoder » 12 Mar 2007 18:08

And use the WIki for documentations !
ok, I've noted that .playlist.add gives back a item number, added the missing playlist.playItem(), changed an incorrect note after .remoteItemID, noted .video.subtitle=0 disables the subtitles and also noted .audio.track=0 disables the audio. jpsaman allready wrote .audio.track/.video.subtitle in the wiki (even before he submitted the code for them I see :P)
my hideout: http://www.spellcoder.nl
my VLC bugreports: https://trac.videolan.org/vlc/query?rep ... spellcoder
likes coding, designing, WoW, VLC&plugin, Amiga's and Mac's & fluffy cats

auelihein
Blank Cone
Blank Cone
Posts: 12
Joined: 07 Mar 2007 09:40

Postby auelihein » 13 Mar 2007 09:47

I figured out that i can't use the read/write properties but just the methods implemented and not all of them. They probably just have been implemented in the new mozilla-plugin-vlc. I'm gonna try the vlc 0.9.0 that you gave me.
Thank you again
Ratatouille team

auelihein
Blank Cone
Blank Cone
Posts: 12
Joined: 07 Mar 2007 09:40

Postby auelihein » 13 Mar 2007 11:16

Ok i found the problem, it was just a problem of structure,
Actually we have to do that :

Code: Select all

var audioTrack = 1; var subtitleTrack = 1; var options = new Array(":audio-track="+(audioTrack)+":sub-track="+subtitleTrack); var itemId = vlc.playlist.add(media_url,null,options);
and now I'm able to choose the audio track i want and if i want subtitles,
I will let you know if i have new troubles
Thank you for everything
aurélien
Ratatouille team

auelihein
Blank Cone
Blank Cone
Posts: 12
Joined: 07 Mar 2007 09:40

Postby auelihein » 13 Mar 2007 14:53

Hum i still have a trouble, now internet explorer doesn't stop without any reason but I don't know how to pass parameter, i mean when i wrote :

Code: Select all

var options = new Array('sub-track=0');
Subtitles appear,
when i do :

Code: Select all

var options = new Array('audio-track=0');
the audio track is selected
but i can't do that, all of that doesn't work :

Code: Select all

var options = new Array(':audio-track=0'+':sub-track=0'); var options = new Array('audio-track'=>'0','sub-track'=>'0');
thank you again
aurelien
Last edited by auelihein on 13 Mar 2007 15:58, edited 1 time in total.
Ratatouille team

auelihein
Blank Cone
Blank Cone
Posts: 12
Joined: 07 Mar 2007 09:40

Postby auelihein » 13 Mar 2007 15:58

there we go

Code: Select all

var options = new Array('aspect-ratio='+aspectRatio,'sub-track='+subtitleTrack,'audio-track='+audioTrack);
Ratatouille team

donniewiko
New Cone
New Cone
Posts: 2
Joined: 25 Feb 2008 12:07

Re: mozilla-plugin-vlc and subtitles

Postby donniewiko » 25 Feb 2008 12:42

im bumping this thread, since i havent found any information suitable to my knowledge to implement sub-tracks in my vlc page.

Here is my situation:
I created a site, where ppl can store movies on, and use a different input field to select te movies. This works like a charm.
I want to add the possibility to add subtitles to the movie.

Here is my problem:
I followed all the info posted in this thread, i also tried out the nightly, i read and followed this thread: browser plugin/subtitles but i still cant figure out what to do.

Here is what i tried:
I used both options:

Code: Select all

vlc.video.subtitle=1 and 0.
I made a var with subtitle =

Code: Select all

vlc.video.subtitle="location/file.sub";
i entered

Code: Select all

var options = new Array(":aspect-ratio="+aspectRatio,':sub-track=0');
but i cant get it to work.

i hope someone will help me with this.

thanks in advance.


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 20 guests