oaubert / python-vlc

Python vlc bindings
GNU Lesser General Public License v2.1
393 stars 111 forks source link

vlc.Instance.media_new don't apply options and filters (vlc 2.1.5-5) #4

Closed davidonet closed 9 years ago

davidonet commented 9 years ago
import vlc
vlc_instance = vlc.Instance()
player = vlc_instance.media_player_new()
media =vlc_instance.media_new("test.mov", "sub-filter=marq{marquee=Hello}, "vout-filter=invert")
player.set_media(media)
player.start()

show no difference with

media =vlc_instance.media_new("test.mov")
oaubert commented 9 years ago

Hi. This is a libvlc limitation. As mentioned (briefly I admit) in the doc http://olivieraubert.net/vlc/python-ctypes/doc/vlc.Media-class.html#add_option "Not all options affects Media objects: Specifically, due to architectural issues most audio and video options, such as text renderer options, have no effects on an individual media. These options must be set through libvlc_new() instead". I reflected this warning in some other places where it applies too.

RenaKunisaki commented 8 years ago

Unless I'm just missing something, options don't seem to work at all:

#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('GdkX11', '3.0')
from gi.repository import Gtk, GLib, GdkX11
import sys

vlc_options = "vout-filter=invert"
import vlc; VLC = vlc.Instance(vlc_options)

widget = Gtk.DrawingArea()
player = VLC.media_player_new(vlc_options)
def handle_embed(*args):
    win = widget.get_window()
    if sys.platform == 'win32':
        # XXX probably doesn't work
        player.set_hwnd(win.get_hwnd())
    else:
        player.set_xwindow(win.get_xid())
    return True
widget.connect('map', handle_embed)

win = Gtk.Window()
win.connect('delete-event', Gtk.main_quit)
win.add(widget)
win.show_all()

media = VLC.media_new(sys.argv[1], vlc_options)
player.set_media(media)
player.play()

Gtk.main()

Here I pass the options in three separate places and still they aren't applied on any video.

oaubert commented 8 years ago

There are 2 issues in your code:

Try the following:

player = vlc.MediaPlayer(vlc.Instance("--video-filter=invert"))
player.set_mrl(sys.argv[1])
Moidebe commented 6 years ago

Did this work? I am having the same issues and it' incredibly frustrating. I have compiled VLC to run with openMAX IL video output on the Raspberry pi and Raspbian. It runs well from the VLC application but I cannot get it to run with this option from python. I have tried the suggested method above. I have also tried using vlc.libvlc_new( options ) but nothing appears to work. VLC runs but with the default options which is no good. Is it possible to get python-vlc running with '--vout=omxil_vout'? as an option? It appers to just get ignored.