vlcj: VLC command-line arguments not recognized- Transform

This forum is about all development around libVLC.
amarasum
New Cone
New Cone
Posts: 2
Joined: 09 Dec 2012 04:08

vlcj: VLC command-line arguments not recognized- Transform

Postby amarasum » 09 Dec 2012 04:24

Using the vlcj library, I am attempting to have a flip occur for one of the playing videos.

Using the mediaPlayer().playMedia(mrl, mediaOptions) syntax, I have the arguments loaded within the mediaOptions String[].

However, the arguments that I enter into the mediaOptions are not recognized by VLC. I have tried using a number of different argument forms (VLC seems to have not-so-specific instruction on the exact formatting of arguments). I have used the following forms for the arguments:
  • String[] mediaOptions = {"vout-filter transform","transform-type vflip"};
  • String[] mediaOptions = {"vout-filter=transform","transform-type=vflip"};
  • String[] mediaOptions = {"--vout-filter transform","--transform-type vflip"};
  • String[] mediaOptions = {"--vout-filter=transform","transform-type=vflip"};
  • String[] mediaOptions = {"--transform-type vflip"};
  • String[] mediaOptions = {"--transform-type=vflip"};
None of these seem to work. In fact, none of my arguments of any type seem to work. Except for when I use the noaudio argument:
String[] mediaOptions = {"noaudio"};

The fact that no audio works shows me that the arguments *can* work. However, it makes no sense that none of my other arguments work.
---
The current code is as follows:

Code: Select all

package test; import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent; import uk.co.caprica.vlcj.discovery.NativeDiscovery; public class Example2 implements ActionListener{ private final JFrame frame; private final JPanel contentPane; private final EmbeddedMediaPlayerComponent mediaPlayerComponent; public static void main(String[] args) { new NativeDiscovery().discover(); final String mrl = args[0]; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new Example2().start(mrl); } }); } public Example2() { mediaPlayerComponent = new EmbeddedMediaPlayerComponent(); JButton pause = new JButton("Pause"); pause.setActionCommand("Pause"); pause.addActionListener(this); contentPane = new JPanel(); contentPane.setLayout(new BorderLayout()); contentPane.add(mediaPlayerComponent, BorderLayout.CENTER); contentPane.add(pause, BorderLayout.NORTH); contentPane.setBackground(Color.GRAY); frame = new JFrame("vlcj quickstart"); frame.setLocation(50, 50); frame.setSize(800, 800); frame.setContentPane(contentPane); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } private void start(String mrl) { String[] mediaOptions = {"vout-filter transform","transform-type vflip"}; mediaPlayerComponent.getMediaPlayer().playMedia(mrl, mediaOptions); } public void actionPerformed(ActionEvent e){ if(e.getActionCommand().equals("Pause")){ mediaPlayerComponent.getMediaPlayer().pause(); } } }
What could be happening? And what *is* the correct format for entering arguments for vlcj (Looking at the noaudio example, I see that the double hyphens aren't included).

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: vlcj: VLC command-line arguments not recognized- Transfo

Postby sherington » 09 Dec 2012 10:03

The vlcj method you refer to simply invokes the native libvlc_media_add_option function to pass the supplied options, unmolested, to vlc:

http://www.videolan.org/developers/vlc/ ... 5a29d4c334
The options are detailed in vlc --long-help, for instance "--sout-all". Note that all options are not usable on medias: specifically, due to architectural issues, video-related options such as text renderer options cannot be set on a single media. They must be set on the whole libvlc instance instead.
The emboldened part of the quoted documentation, in terms of vlcj, means: pass the options via the media player factory instead.

amarasum
New Cone
New Cone
Posts: 2
Joined: 09 Dec 2012 04:08

Re: vlcj: VLC command-line arguments not recognized- Transfo

Postby amarasum » 10 Dec 2012 14:56

Okay, so I was able to get the arguments working by passing them into the media player factory when I initialize it:
mediaPlayerFactory = new MediaPlayerFactory("--video-filter=transform", "--transform-type=vflip");

However, I've noticed that any transformation arguments that I make cause my program to crash at startup. I can see that the beginning frame of the video is transformed, but it doesn't play (or causes a crash in libvlccore.5.dylib). Is this related to vlcj? Or libvlc? Or VLC (which plays transformed videos quite fine on this computer).

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: vlcj: VLC command-line arguments not recognized- Transfo

Postby sherington » 10 Dec 2012 18:03

Okay, so I was able to get the arguments working by passing them into the media player factory when I initialize it:
mediaPlayerFactory = new MediaPlayerFactory("--video-filter=transform", "--transform-type=vflip");

However, I've noticed that any transformation arguments that I make cause my program to crash at startup. I can see that the beginning frame of the video is transformed, but it doesn't play (or causes a crash in libvlccore.5.dylib). Is this related to vlcj? Or libvlc? Or VLC (which plays transformed videos quite fine on this computer).
Those upside-down-o-vision options work just fine for me with vlcj on Linux.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 16 guests