JVLC status

This forum is about all development around libVLC.
adanecito
Cone that earned his stripes
Cone that earned his stripes
Posts: 151
Joined: 06 Mar 2007 17:59

Re: JVLC status

Postby adanecito » 09 May 2010 18:00

Hi Sherington,

My remaining lockup issue has been resolved due to a library issue. Many thanks for the help.

-Tony

gnosygnus
Blank Cone
Blank Cone
Posts: 30
Joined: 02 May 2010 19:34

Re: JVLC status

Postby gnosygnus » 09 May 2010 18:50

Do you know if that structure has to be freed natively?
Sorry. I'm new to JNA, and I can't say. I'm assuming that JNA takes care of all garbage collection and freeing memory. I looked through the docs and api now, and can't find any language otherwise. I found this post http://osdir.com/ml/java.jna.user/2008-04/msg00015.html which indicates likewise: "If JNA provides you with memory, it will be automatically freed when the object is GC'd."

Hope this helps...

Logod
New Cone
New Cone
Posts: 9
Joined: 18 May 2010 08:55

Re: JVLC status

Postby Logod » 19 May 2010 13:33

Hi,

First thanks a lot for VLCJ. It’s exactly what I need.

However, it is possible to deactivate the mouse information in the consol.

Code: Select all

MOVE: java.awt.event.MouseEvent[MOUSE_MOVED,(276,399),absolute(523,504),button=0,clickCount=0] on canvas0
Another thing, if the window is resized, after put the video on “pause”, when the video restarts “play”, the screen is expand as the native video size.
Is there a way to maintain or to force the screen size.

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: JVLC status

Postby sherington » 19 May 2010 18:11

However, it is possible to deactivate the mouse information in the consol.

Code: Select all

MOVE: java.awt.event.MouseEvent[MOUSE_MOVED,(276,399),absolute(523,504),button=0,clickCount=0] on canvas0
I needed to add logging to the new versions to help with debugging native crashes, you can disable the logging quite easily:

See http://wiki.apache.org/logging-log4j/Log4jXmlFormat

At it's simplest, change the root priority level in the supplied log4j.xml file to "ERROR".
Another thing, if the window is resized, after put the video on “pause”, when the video restarts “play”, the screen is expand as the native video size.
Is there a way to maintain or to force the screen size.
I'm not sure I understand this, your own application should be controlling the screen size. I play/pause/stop/play again in my own application without any problem. Can you give a bit more explanation as what's going wrong?

BraCa
New Cone
New Cone
Posts: 7
Joined: 24 Apr 2010 16:07

Re: JVLC status

Postby BraCa » 19 May 2010 22:33

sherington, can you tell me how can i save a stream to a file with vlcj?
to do this in command line i do something like this:
vlc -vvv rtp://@239.1.1.1:5004 --sout '#standard{mux="ts",access="file",dst="/home/braca/movie.avi"}'
and now, i need to do something similar but with vlcj..

thanks

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: JVLC status

Postby sherington » 19 May 2010 23:34

sherington, can you tell me how can i save a stream to a file with vlcj?
to do this in command line i do something like this:
vlc -vvv rtp://@239.1.1.1:5004 --sout '#standard{mux="ts",access="file",dst="/home/braca/movie.avi"}'
and now, i need to do something similar but with vlcj..

thanks
I don't really know what these sout strings should look like, but in principle you pass options when you play the media, e.g.

Code: Select all

String mediaUrl = "rtp://@239.1.1.1:5004"; String[] options = {":sout=#standard{mux=ts,access=file,dst=/home/braca/movie.avi"}; mediaPlayer.playMedia(mediaUrl, options);
That worked for me.

The options are ultimately passed to libvlc_media_add_option().

BraCa
New Cone
New Cone
Posts: 7
Joined: 24 Apr 2010 16:07

Re: JVLC status

Postby BraCa » 20 May 2010 11:33

sherington, can you tell me how can i save a stream to a file with vlcj?
to do this in command line i do something like this:
vlc -vvv rtp://@239.1.1.1:5004 --sout '#standard{mux="ts",access="file",dst="/home/braca/movie.avi"}'
and now, i need to do something similar but with vlcj..

thanks
I don't really know what these sout strings should look like, but in principle you pass options when you play the media, e.g.

Code: Select all

String mediaUrl = "rtp://@239.1.1.1:5004"; String[] options = {":sout=#standard{mux=ts,access=file,dst=/home/braca/movie.avi"}; mediaPlayer.playMedia(mediaUrl, options);
That worked for me.

The options are ultimately passed to libvlc_media_add_option().
Thanks, it worked ;)

Logod
New Cone
New Cone
Posts: 9
Joined: 18 May 2010 08:55

Re: JVLC status

Postby Logod » 21 May 2010 08:24

Thanks you Sherington for your quick answers.

You give me the reponse in your sentense
your own application should be controlling the screen size

Logod
New Cone
New Cone
Posts: 9
Joined: 18 May 2010 08:55

Re: JVLC status

Postby Logod » 06 Jun 2010 03:36

Hi Sherington,

Actually I develop a program who can display video and photos. It will be used by biologists for analyses animals.

For this, I need 2 functions, one it’s for go to the next or before frame (in order to place precisely the video to make a snap shop of a particular image).
The other option is to increase the video speed (like VLC does, your video can be display at 2x, 3x,…).

For increase the speed, I think about make a thread how will be actualised every 500 millisecond (for example) end it make an offset of 1000 millisecond from the current time “mediaPlayer.getTime” and the new time “mediaPlayer.setTime”. So this makes a 2x speed.
Is there a better method?


For moving to the next frame, I write this code (I have a similar for going backward).
But it doesn’t work very well (due to the round I suppose). Sometimes I have to click twice to move to the next frame.

Code: Select all

private void goToTheNextFrame(){ // you can only move to a frame if your video is on pause, so I make a Boolean to check it if (this.isPlaying == false){ long longTimeVideo = mediaPlayer.getTime(); float frameRate = mediaPlayer.getFps() ; // calculate the new frame number to the time since the beginning // of the video (in milliseconds) + the time of a frame long newTime = Math.round (longTimeVideo + 1000 / frameRate ); // check if we are not out of the video (for example, we are at the last frame) if (newTime <= this.mediaPlayer.getLength()){ // we move to the new time this.mediaPlayer.setTime(newTime); } } }
I notice in the libvlc (C++) there is a native function for going to the next frame.

https://www.videolan.org/developers/vlc ... 8af6cf833d

I check in the “media_player.c” file :

Code: Select all

void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi ) { input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi ); if( p_input_thread != NULL ) { var_TriggerCallback( p_input_thread, "frame-next" ); vlc_object_release( p_input_thread ); } }
It will be very kind if you can give me advice about how to fix my problem.
Thank you

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: JVLC status

Postby sherington » 06 Jun 2010 09:01

The other option is to increase the video speed (like VLC does, your video can be display at 2x, 3x,…).
Use:

Code: Select all

mediaPlayer.setRate(float rate).
Where 1.0 is normal speed, 2.0 is double speed etc.
For moving to the next frame, I write this code (I have a similar for going backward).
But it doesn’t work very well (due to the round I suppose). Sometimes I have to click twice to move to the next frame.
Next frame is easy because as you have seen there's a native libvlc function to do that, and you can invoke that through the Java bindings.

Code: Select all

mediaPlayer.nextFrame().
For previous frame, I have no idea. There have been some threads in this forum before about why that's not supported (nothing to do with the bindings), so I guess you have to go with your own solution.

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: JVLC status

Postby sherington » 06 Jun 2010 09:03

A small comment...

Code: Select all

private void goToTheNextFrame(){ // you can only move to a frame if your video is on pause, so I make a Boolean to check it if (this.isPlaying == false){
For this part you should be able to use...

Code: Select all

mediaPlayer.isPlaying()
...rather than managing your own boolean.

isPlaying() simply wraps a call to libvlc.

buatcintaku
New Cone
New Cone
Posts: 5
Joined: 17 Apr 2010 13:07

Re: JVLC status

Postby buatcintaku » 09 Jun 2010 10:29

what difference between vlcj and jvlc?

gnosygnu
Blank Cone
Blank Cone
Posts: 45
Joined: 06 Jun 2010 16:06

Re: JVLC status

Postby gnosygnu » 11 Jun 2010 05:27

sherington is probably the best person to answer this, but I'll try to give a few details. Please note that I have not used jvlc, so my details are based on cursory readings.

- both vlcj and and jvlc use jna to call libvlc
- jvlc is inactive. vlcj has active development.
- jvlc uses 1.0/earlier api. vlcj uses 1.1.

Hope this helps.

kryptonite
Blank Cone
Blank Cone
Posts: 52
Joined: 22 May 2009 12:01

Re: JVLC status

Postby kryptonite » 16 Jun 2010 15:07

I have my own java-based vlc player and play from 1 upto 16 (RTSP)streams in independent canvases.
If for some reason the target server is down, I see error messages in stdout from libvlc:
[0x3b337fc] live555 demux error: Failed to connect with rtsp://xx.xx.com:8801/ch03
[0x3b327dc] access_realrtsp access error: cannot connect to xx.xx.com:8801
[0x3b327dc] main access error: Connection failed
[0x3b327dc] main access error: VLC could not connect to "xx.xx.com:8801".
[0x4784154] main input error: open of `rtsp://xx.xx.com:8801/ch03' failed: (null)
[0x4784154] main input error: Your input can't be opened
[0x4784154] main input error: VLC is unable to open the MRL 'rtsp://xx.xx.com:8801/ch03'. Check the log for details.

This process however seems to take quite sometime and my app can get very slow/unresponsive as the number of streams increase.

Questions:
1. Is there something I could do to prevent the slowing down?
2. How do I capture the above error and take required action?

Thanks!

jjreina
Blank Cone
Blank Cone
Posts: 12
Joined: 17 Jun 2010 10:13

Re: JVLC status

Postby jjreina » 17 Jun 2010 23:11

try connecting without putting the port rtsp://address

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: JVLC status

Postby sherington » 22 Jun 2010 19:40

To any vlcj users who may be interested, I made a final 1.1.0 release of vlcj now that vlc 1.1.0 final has been released. Not much has changed if you've been using the recent pre-release 1.1.0x versions.

Please feed back any issues.

http://code.google.com/p/vlcj/

(You also need log4j, jna and the jna platform jars.)

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:

Re: JVLC status

Postby Jean-Baptiste Kempf » 22 Jun 2010 19:49

To any vlcj users who may be interested, I made a final 1.1.0 release of vlcj now that vlc 1.1.0 final has been released. Not much has changed if you've been using the recent pre-release 1.1.0x versions.

Please feed back any issues.

http://code.google.com/p/vlcj/

(You also need log4j, jna and the jna platform jars.)
What about making vlcj the default Java bindings of VLC?
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.

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: JVLC status

Postby sherington » 22 Jun 2010 20:00

What about making vlcj the default Java bindings of VLC?
To be honest, I can't see myself having the spare capacity to move my project and development environment from googlecode+svn to something new.

Al3x4nd3r
New Cone
New Cone
Posts: 7
Joined: 23 Jan 2009 15:36

Re: JVLC status

Postby Al3x4nd3r » 23 Jun 2010 15:11

vlcj contains a simple video player implementation built using Swing/AWT, and I use this for testing.

I have discovered a new issue that I am really struggling to solve. I did not see this issue with vlc 1.0.5, nor with vlc 1.1.0pre2, but it is present when running the same Java code against vlc 1.0.6 and vlc 1.1.0pre3. I'm not saying this is a vlc fault I'm just describing my circumstances.

The problem goes like this...

1. Start the test player
2. Use file or stream dialog to open a media source
3. Video starts playing
4. Use file or stream dialog, this time hit cancel (or choose something, it doesn't matter)
5. => Fatal JVM failure, with the text below dumped to the error console

(If you never start a video playing, you can open and cancel as many dialogs as you want and it doesn't crash.)

Code: Select all

[????????] x11 video output error: X11 request 20.0 failed with error code 3: BadWindow (invalid Window parameter) X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 20 (X_GetProperty) Resource id in failed request: 0x4400042 Serial number of failed request: 2673 Current serial number in output stream: 2673
The fatal JVM failure is most likely as a result of an unhandled exception condition in the native code.

This happens as soon as the dialog box closes, and is 100% repeatable and I have no idea what to do about it.

I can play movie after movie without any issues if I don't use a dialog box and do it programmatically instead.

Anyone have any ideas?
I had this same problem with JVLC. In fact I do not know how to resolve but I managed to identify that this occurs when you give a second dispose () in dialogs (with video playing).

Code: Select all

package br.ufpb.lavid.GTMDA.Commons.GUI.swing; import java.awt.Component; import java.awt.Dialog.ModalityType; import java.awt.HeadlessException; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author alexander */ public class JFileChooserGTMDA extends JFileChooser{ private JDialog meuDialog = null; public JFileChooserGTMDA(String path){ super(path); } public void setFileFilter(String description, String... formats){ setFileFilter(new MyFileFilter(description, formats)); } @Override protected JDialog createDialog(Component parent) throws HeadlessException { this.meuDialog = super.createDialog(parent); meuDialog.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE); meuDialog.setModalityType(ModalityType.APPLICATION_MODAL); meuDialog.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { cancelSelection(); } }); return this.meuDialog; } public JDialog getDialog(){ return meuDialog; } @Override public int showDialog(Component parent, String approveButtonText) throws HeadlessException { return showDialog(parent, approveButtonText, approveButtonText); } /** * Exibe um jFileChooser. * * @param parent a tela pai * @param approveButtonText o nome a ser exibido do botao de aceitacao * @param title o titulo do jFileChooser * * @return esse eu nao entendi (nao fui eu que fiz esse codigo) */ public int showDialog(Component parent, String approveButtonText, String title) throws HeadlessException { if(approveButtonText != null) { setApproveButtonText(approveButtonText); setDialogType(CUSTOM_DIALOG); } meuDialog = createDialog(parent); meuDialog.setTitle(title); rescanCurrentDirectory(); meuDialog.show(); firePropertyChange("JFileChooserDialogIsClosingProperty", meuDialog, null); return CANCEL_OPTION; } @Override public void approveSelection() { meuDialog.setVisible(false); } @Override public void cancelSelection() { setSelectedFile(null); meuDialog.setVisible(false); } private class MyFileFilter extends FileFilter { String description; String[] formats; public MyFileFilter(String description, String... formats) { this.description = description; this.formats = formats; } @Override public boolean accept(File f) { for(String ext : formats) if(f.getName().endsWith('.'+ext)) return true; return f.isDirectory(); } @Override public String getDescription() { return description; } } }
Try this JFileChooser above that overloads where to dispose() of setVisible (false) and you can "solve" the problem.

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: JVLC status

Postby sherington » 23 Jun 2010 16:28

I had this same problem with JVLC. In fact I do not know how to resolve but I managed to identify that this occurs when you give a second dispose () in dialogs (with video playing).

Try this JFileChooser above that overloads where to dispose() of setVisible (false) and you can "solve" the problem.
Very nice workaround, thank you.

Al3x4nd3r
New Cone
New Cone
Posts: 7
Joined: 23 Jan 2009 15:36

Re: JVLC status

Postby Al3x4nd3r » 23 Jun 2010 19:22

Hi sherington, nice work with the VLCJ

I have a project that uses JVLC (a manager flows distributed named Arthron soon I will put screenshots here (Project Page in Portuguese Brazil -> http://www.lavid.ufpb.br/gtmda/arthron.html)). And my biggest difficulty with the JVLC can not I change the video effects (and flow effects) without having to restart the Player. I saw that you can add in VLCJ Marquee and Logo in this way. Its possible do this with the video effects ? (Invert, noise ...) Or Change the transcoding line is this way ?


Sorry for my poor english =)

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: JVLC status

Postby sherington » 23 Jun 2010 20:47

I saw that you can add in VLCJ Marquee and Logo in this way. Its possible do this with the video effects ? (Invert, noise ...) Or Change the transcoding line is this way ?
The marquee and logo is only possible that way because there are new API functions exposed in libvlc 1.1.0. There's nothing that I know about exposed in the libvlc API for those other effects.

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: JVLC status

Postby sherington » 23 Jun 2010 22:05

I had this same problem with JVLC. In fact I do not know how to resolve but I managed to identify that this occurs when you give a second dispose () in dialogs (with video playing).

Try this JFileChooser above that overloads where to dispose() of setVisible (false) and you can "solve" the problem.
Very nice workaround, thank you.
This is a hard problem to pin down since the workaround is not needed with my 1.1 bindings and vlc 1.1.0 - it all works just fine with 1.1.0, and since that's where everyone should be now I guess we can forget about this particular problem.

Al3x4nd3r
New Cone
New Cone
Posts: 7
Joined: 23 Jan 2009 15:36

Re: JVLC status

Postby Al3x4nd3r » 24 Jun 2010 15:44

Hi Again :D

VLCJ tested on MAC as follows:

The VLC was in /Applications/VLC.app

So I copied the lib folder (/Applications/VLC.app/Contents/MacOS/lib) and plugin folder (/Applications/VLC.app/Contents/MacOS/plugins) where the project is running. ( I did this because when I put the reference to where VLC was directly installed to the application closing. )

After that I changed the path of the jna.library as follows:

Code: Select all

Properties p = System.getProperties(); p.setProperty("jna.library.path", p.getProperty("jna.library.path") + File.pathSeparator + "lib");
After I changed the -plugin-path= as follows

Code: Select all

String plugin = "--plugin-path=plugins"; this.mediaPlayerFactory = new MediaPlayerFactory(new String[]{plugin});
I also noticed that the MacMediaPlayer was not implemented then did he behave the same as LinuxMediaPlayer (for testing)

Done that could run videos on MAC, but the image is not drawn on the canvas, but in a window outside the application. Also when I was changing the video gave crash (after several attempts) that the error is given below:

Code: Select all

No accelerated IMDCT transform found get_buffer() failed (stride changed) Invalid memory access of location 0x12e75053000 rip=0x7fff87522120 Java Result: 139
I do not know what I gotta do to develop a MacCanvas (similar to what you did with WindowsCanvas). Do you have any tips?

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: JVLC status

Postby sherington » 24 Jun 2010 16:59

I do not know what I gotta do to develop a MacCanvas (similar to what you did with WindowsCanvas). Do you have any tips?
If I knew what to do I would already have done it. ;-)

I have no Mac platform to test on so I simply can't do it blind. I am relying on a Mac vlcj user to tell me what to do. If someone tells me how, I'll implement it.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 24 guests