From f8dcda721b524ff413b938ec6efc4d4cd4f2b589 Mon Sep 17 00:00:00 2001 From: KaneBetter Date: Mon, 17 Oct 2022 00:14:06 -0700 Subject: [PATCH 1/7] Used Omxplayer in system 10 --- pvm.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/pvm.py b/pvm.py index 1d842c0..c184b99 100644 --- a/pvm.py +++ b/pvm.py @@ -1,10 +1,21 @@ -import vlc from pythonosc import dispatcher, osc_server, udp_client import socket import argparse +from omxplayer.player import OMXPlayer +from pathlib import Path +from time import sleep +import logging + +logging.basicConfig(level=logging.INFO) +media_log = logging.getLogger("Player 1") + +VIDEO_PATH = "jellyfish720p.mp4" +media = OMXPlayer(VIDEO_PATH, + dbus_name='org.mpris.MediaPlayer2.omxplayer1', args=['--loop']) + +media.pause() + -inst = vlc.Instance('--input-repeat=65535','--video-x=100') -media = inst.media_player_new("zoetrope.mp4") # media = vlc.MediaPlayer("jellyfish720p.mp4") #media.set_fullscreen(True) @@ -26,11 +37,12 @@ def parse_commands(*args): pass if command=="file": global media - media = inst.media_player_new(value) + media = OMXPlayer(value, args=['--loop']) + media.pause() elif command=="start": media.play() elif command=="stop": - media.stop() + media.quit() elif command=="set_position": media.set_position(float(value)) elif command=="fullscreen": @@ -49,8 +61,6 @@ def parse_commands(*args): def main(RECEIVE_PORT): #OSC server # media = inst.media_player_new(FILE) - print("How many video outputs does this media player have?") - print(media.has_vout()) callback = dispatcher.Dispatcher() server = osc_server.ThreadingOSCUDPServer(("", RECEIVE_PORT), callback) print("server now listenning on port "+str(RECEIVE_PORT)) From 776cd40edd3b9c00104421a8d47163b6e8a0163a Mon Sep 17 00:00:00 2001 From: KaneBetter Date: Tue, 18 Oct 2022 18:44:12 -0700 Subject: [PATCH 2/7] Add pvm_omx.py --- pvm.py | 25 ++++++----------- pvm_omx.py | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 17 deletions(-) create mode 100644 pvm_omx.py diff --git a/pvm.py b/pvm.py index c184b99..31e5429 100644 --- a/pvm.py +++ b/pvm.py @@ -1,21 +1,11 @@ + +import vlc from pythonosc import dispatcher, osc_server, udp_client import socket import argparse -from omxplayer.player import OMXPlayer -from pathlib import Path -from time import sleep -import logging - -logging.basicConfig(level=logging.INFO) -media_log = logging.getLogger("Player 1") - -VIDEO_PATH = "jellyfish720p.mp4" -media = OMXPlayer(VIDEO_PATH, - dbus_name='org.mpris.MediaPlayer2.omxplayer1', args=['--loop']) - -media.pause() - +inst = vlc.Instance('--input-repeat=65535','--video-x=100') +media = inst.media_player_new("zoetrope.mp4") # media = vlc.MediaPlayer("jellyfish720p.mp4") #media.set_fullscreen(True) @@ -37,12 +27,11 @@ def parse_commands(*args): pass if command=="file": global media - media = OMXPlayer(value, args=['--loop']) - media.pause() + media = inst.media_player_new(value) elif command=="start": media.play() elif command=="stop": - media.quit() + media.stop() elif command=="set_position": media.set_position(float(value)) elif command=="fullscreen": @@ -61,6 +50,8 @@ def parse_commands(*args): def main(RECEIVE_PORT): #OSC server # media = inst.media_player_new(FILE) + print("How many video outputs does this media player have?") + print(media.has_vout()) callback = dispatcher.Dispatcher() server = osc_server.ThreadingOSCUDPServer(("", RECEIVE_PORT), callback) print("server now listenning on port "+str(RECEIVE_PORT)) diff --git a/pvm_omx.py b/pvm_omx.py new file mode 100644 index 0000000..d23dde8 --- /dev/null +++ b/pvm_omx.py @@ -0,0 +1,80 @@ +from pythonosc import dispatcher, osc_server, udp_client +import socket +import argparse +from omxplayer.player import OMXPlayer +from pathlib import Path +from time import sleep +import logging + +logging.basicConfig(level=logging.INFO) +media_log = logging.getLogger("Player 1") + +VIDEO_PATH = "jellyfish720p.mp4" +media = OMXPlayer(VIDEO_PATH, + dbus_name='org.mpris.MediaPlayer2.omxplayer1', args=['--loop']) + +media.pause() + + +# media = vlc.MediaPlayer("jellyfish720p.mp4") + +#media.set_fullscreen(True) + +# media.play() + +#media.stop() +# def parse_qasm(*args): +# for arg in args: +# print(arg) + +# while True: +def parse_commands(*args): + command = args[1] + print("command: "+command) + if len(args)>2: + value = args[2] + print("value: "+str(value)) + pass + if command=="file": + global media + media = OMXPlayer(value, dbus_name='org.mpris.MediaPlayer2.omxplayer1', args=['--loop']) + media.pause() + elif command=="start": + media.play() + elif command=="stop": + media.quit() + elif command=="set_position": + media.set_position(float(value)) + elif command=="set_rate": + media.set_rate(float(value)) + elif command=="pause": + media.pause() + else: + print("I received command \"%s\" but I don't know what to do with it, yet." % command) + + +def main(RECEIVE_PORT): + #OSC server + # media = inst.media_player_new(FILE) + callback = dispatcher.Dispatcher() + server = osc_server.ThreadingOSCUDPServer(("", RECEIVE_PORT), callback) + print("server now listenning on port "+str(RECEIVE_PORT)) + callback.map("/PVM", parse_commands) + server.serve_forever() + +if __name__ == '__main__': + p = argparse.ArgumentParser() + p.add_argument('--port', type=int, nargs='?', default=8001, help='The port that pvm.py will use to receive control messages. Default port is 8001') + # p.add_argument('--file', nargs='?', default='jellyfish720p.mp4', help='The file that pvm.py will load. Default is jellyfish720p.mp4') + args = p.parse_args() + print('PVM - Pi Video Machine') + print('Omar Costa Hamido 2022') + main(args.port) + + +# UDP_IP = "" +# UDP_PORT = 8000 #add possibility to change this + +# sock = socket.socket(socket.AF_INET, # Internet +# socket.SOCK_DGRAM) # UDP +# sock.bind((UDP_IP, UDP_PORT)) \ No newline at end of file From c3c57b931bb6e1b9fc8ffbe6490c0cc1187d302a Mon Sep 17 00:00:00 2001 From: KaneBetter Date: Tue, 18 Oct 2022 18:44:41 -0700 Subject: [PATCH 3/7] Add shell script for build omxplayer --- build_omxplayer.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 build_omxplayer.sh diff --git a/build_omxplayer.sh b/build_omxplayer.sh new file mode 100755 index 0000000..1d50560 --- /dev/null +++ b/build_omxplayer.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -eou pipefail + +cd /home/pi +git clone https://github.com/KaneBetter/omxplayer.git +cd omxplayer + +sudo apt-get update && sudo apt install -y git libasound2-dev libva2 libpcre3-dev libidn11-dev libboost-dev libdbus-1-dev libssh-dev libsmbclient-dev libssl-dev + +# see https://github.com/popcornmix/omxplayer/issues/731 +sed -i -e 's/git-core/git/g' prepare-native-raspbian.sh +sed -i -e 's/libva1/libva2/g' prepare-native-raspbian.sh +sed -i -e 's/libssl1.0-dev/libssl-dev/g' prepare-native-raspbian.sh +sed -i -e 's/--enable-libsmbclient/--disable-libsmbclient/g' Makefile.ffmpeg + +./prepare-native-raspbian.sh +make ffmpeg + +make -j$(nproc) +make dist +sudo make install \ No newline at end of file From d4b12b9025059062df6c540d93dc09d29ffa42b4 Mon Sep 17 00:00:00 2001 From: KaneBetter Date: Tue, 18 Oct 2022 22:12:04 -0700 Subject: [PATCH 4/7] Add set rate feature --- pvm.py | 1 - pvm_omx.py | 15 ++++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pvm.py b/pvm.py index 31e5429..1d842c0 100644 --- a/pvm.py +++ b/pvm.py @@ -1,4 +1,3 @@ - import vlc from pythonosc import dispatcher, osc_server, udp_client import socket diff --git a/pvm_omx.py b/pvm_omx.py index d23dde8..1cd968c 100644 --- a/pvm_omx.py +++ b/pvm_omx.py @@ -10,10 +10,7 @@ media_log = logging.getLogger("Player 1") VIDEO_PATH = "jellyfish720p.mp4" -media = OMXPlayer(VIDEO_PATH, - dbus_name='org.mpris.MediaPlayer2.omxplayer1', args=['--loop']) - -media.pause() +media = "" # media = vlc.MediaPlayer("jellyfish720p.mp4") @@ -29,6 +26,8 @@ # while True: def parse_commands(*args): + global media + global VIDEO_PATH command = args[1] print("command: "+command) if len(args)>2: @@ -36,17 +35,19 @@ def parse_commands(*args): print("value: "+str(value)) pass if command=="file": - global media media = OMXPlayer(value, dbus_name='org.mpris.MediaPlayer2.omxplayer1', args=['--loop']) media.pause() + VIDEO_PATH = value elif command=="start": media.play() elif command=="stop": - media.quit() + media.stop() elif command=="set_position": media.set_position(float(value)) elif command=="set_rate": - media.set_rate(float(value)) + fps = str(30 * float(value)) + media = OMXPlayer(VIDEO_PATH, dbus_name='org.mpris.MediaPlayer2.omxplayer', args=['--loop','--force-fps', fps]) + media.pause() elif command=="pause": media.pause() else: From 3f50d47782d9f5ac703cdc13b017bfc7a891891f Mon Sep 17 00:00:00 2001 From: KaneBetter Date: Wed, 19 Oct 2022 16:17:45 -0700 Subject: [PATCH 5/7] Added logging format and TODO list --- pvm_omx.py | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/pvm_omx.py b/pvm_omx.py index 1cd968c..424ba04 100644 --- a/pvm_omx.py +++ b/pvm_omx.py @@ -1,34 +1,37 @@ -from pythonosc import dispatcher, osc_server, udp_client -import socket +from pythonosc import dispatcher, osc_server import argparse from omxplayer.player import OMXPlayer -from pathlib import Path -from time import sleep import logging +import sys -logging.basicConfig(level=logging.INFO) -media_log = logging.getLogger("Player 1") +def _init_logger(): + logger = logging.getLogger('PVM') + logger.setLevel(logging.INFO) + handler = logging.StreamHandler(sys.stderr) + handler.setLevel(logging.INFO) + formatter = logging.Formatter("%(asctime)s;%(levelname)s;%(message)s", + "%Y-%m-%d %H:%M:%S") + handler.setFormatter(formatter) + logger.addHandler(handler) + +_init_logger() +_logger = logging.getLogger('PVM') +_logger.info("Logging system initilized!") +# logging example: +# _logger.info('App started in %s', os.getcwd()) +# _logger.debug('App started in %s', os.getcwd()) VIDEO_PATH = "jellyfish720p.mp4" +# TODO: rename the variable media = "" - -# media = vlc.MediaPlayer("jellyfish720p.mp4") - -#media.set_fullscreen(True) - -# media.play() - -#media.stop() -# def parse_qasm(*args): -# for arg in args: -# print(arg) - -# while True: +# TODO: rewrite logging +# TODO: rewrite logic between commands def parse_commands(*args): global media global VIDEO_PATH command = args[1] + _logger.info("Command: %s", command) print("command: "+command) if len(args)>2: value = args[2] @@ -56,7 +59,6 @@ def parse_commands(*args): def main(RECEIVE_PORT): #OSC server - # media = inst.media_player_new(FILE) callback = dispatcher.Dispatcher() server = osc_server.ThreadingOSCUDPServer(("", RECEIVE_PORT), callback) print("server now listenning on port "+str(RECEIVE_PORT)) @@ -66,7 +68,6 @@ def main(RECEIVE_PORT): if __name__ == '__main__': p = argparse.ArgumentParser() p.add_argument('--port', type=int, nargs='?', default=8001, help='The port that pvm.py will use to receive control messages. Default port is 8001') - # p.add_argument('--file', nargs='?', default='jellyfish720p.mp4', help='The file that pvm.py will load. Default is jellyfish720p.mp4') args = p.parse_args() print('PVM - Pi Video Machine') print('Omar Costa Hamido 2022') From 3f1e77f9f9cb1ee38fc0c3763ff18a15ad0114d2 Mon Sep 17 00:00:00 2001 From: KaneBetter Date: Wed, 19 Oct 2022 21:44:56 -0700 Subject: [PATCH 6/7] Added more TODO --- pvm_omx.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pvm_omx.py b/pvm_omx.py index 424ba04..a4aaa35 100644 --- a/pvm_omx.py +++ b/pvm_omx.py @@ -32,28 +32,34 @@ def parse_commands(*args): global VIDEO_PATH command = args[1] _logger.info("Command: %s", command) - print("command: "+command) if len(args)>2: value = args[2] - print("value: "+str(value)) + _logger.info("Value: %s", str(value)) pass + # TODO: Create another python file to control two display if command=="file": - media = OMXPlayer(value, dbus_name='org.mpris.MediaPlayer2.omxplayer1', args=['--loop']) + # TODO: create a isFileSet flag + media = OMXPlayer(value, dbus_name='org.mpris.MediaPlayer2.omxplayer', args=['--loop']) media.pause() VIDEO_PATH = value elif command=="start": + # TODO: if media.can_play() media.play() elif command=="stop": + # TODO: if media.can_stop() media.stop() elif command=="set_position": media.set_position(float(value)) elif command=="set_rate": + # TODO: check isFileSet flag fps = str(30 * float(value)) media = OMXPlayer(VIDEO_PATH, dbus_name='org.mpris.MediaPlayer2.omxplayer', args=['--loop','--force-fps', fps]) media.pause() elif command=="pause": + # TODO: if media.can_pause() media.pause() else: + # TODO: change loggind print("I received command \"%s\" but I don't know what to do with it, yet." % command) From 120723f5fc22b629f649051445e5facd46d52e64 Mon Sep 17 00:00:00 2001 From: KaneBetter Date: Tue, 25 Oct 2022 09:36:32 -0700 Subject: [PATCH 7/7] Remove vlc and change README.md --- README.md | 12 +- doc_vlc_-I_rc.txt | 73 ---- doc_vlc_-h_--advanced.txt | 851 -------------------------------------- pvm.py | 77 ++-- pvm_alt.py | 84 ---- pvm_omx.py | 88 ---- requirements.txt | 8 +- 7 files changed, 56 insertions(+), 1137 deletions(-) delete mode 100644 doc_vlc_-I_rc.txt delete mode 100644 doc_vlc_-h_--advanced.txt delete mode 100644 pvm_alt.py delete mode 100644 pvm_omx.py diff --git a/README.md b/README.md index e2d0c10..12ad0ee 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,12 @@ Pi Video Machine - a scalable, synchronized, and networked-controlled, raspberry ### { This is a work in progress } + +- TODO: rename the variable +- TODO: rewrite logging +- TODO: rewrite logic between commands +- TODO: Create another python file to control two display +- TODO: create a isFileSet flag ## Requirements @@ -82,7 +88,6 @@ Note: this is assuming that you clone this repo on your raspberry pi in the main _ | filename | description ---------: | :----------- | :--------------------------------------------------- **device** | `pvm.py` | main python script, this runs on each pi device -_ | `pvm_alt.py` | (to be removed) alternative main python script, this runs on each pi device. Does not use `python-vlc`, instead controls vlc from a terminal stdin **control** | `max-init.txt` | this file can make control patch setup faster _ | `pvm.maxpat` | main control patch. controls 6 pvm devices at the same time _ | `pvm_control.maxpat` | abstraction with the control patch GUI to be embedded as a bpatcher @@ -90,9 +95,8 @@ _ | `pvm_init.maxpat` | abstraction responsible for parsing _ | `pvm_send.maxpat` | abstraction for OSC sending. Arguments: _ip port_. Attributes: `@ip` `@port` _ | `pvm_warmup.maxpat` | abstraction for interpolating playback rates, to be embedded as a bpatcher _ | `host.py` | (to be removed) control a remote device using a python script instead -**others** | `doc_vlc_-I_rc.txt` | help log from `vlc` interactive mode CLI -_ | `doc_vlc_-h_--advanced.txt` | help log from `vlc` advanced options CLI -_ | `launch.sh` | shell script to start `pvm.py` with one _click_ +**others** | `launch.sh` | shell script to start `pvm.py` with one _click_ +_ | `build_omxplayer.sh` | shell script to build `omxplayer` with one _click_ ## Helpful links diff --git a/doc_vlc_-I_rc.txt b/doc_vlc_-I_rc.txt deleted file mode 100644 index 35cd115..0000000 --- a/doc_vlc_-I_rc.txt +++ /dev/null @@ -1,73 +0,0 @@ -(PVM) MacBook-Pro:PVM user$ vlc -I rc ->help -+----[ CLI commands ] -| add XYZ . . . . . . . . . . . . . . . . . . . . add XYZ to playlist -| enqueue XYZ . . . . . . . . . . . . . . . . . queue XYZ to playlist -| playlist . . . . . . . . . . . . . show items currently in playlist -| search [string] . . search for items in playlist (or reset search) -| delete [X] . . . . . . . . . . . . . . . . delete item X in playlist -| move [X][Y] . . . . . . . . . . . . move item X in playlist after Y -| sort key . . . . . . . . . . . . . . . . . . . . . sort the playlist -| sd [sd] . . . . . . . . . . . . . show services discovery or toggle -| play . . . . . . . . . . . . . . . . . . . . . . . . . . play stream -| stop . . . . . . . . . . . . . . . . . . . . . . . . . . stop stream -| next . . . . . . . . . . . . . . . . . . . . . . next playlist item -| prev . . . . . . . . . . . . . . . . . . . . previous playlist item -| goto, gotoitem . . . . . . . . . . . . . . . . . goto item at index -| repeat [on|off] . . . . . . . . . . . . . . toggle playlist repeat -| loop [on|off] . . . . . . . . . . . . . . . . toggle playlist loop -| random [on|off] . . . . . . . . . . . . . . toggle playlist random -| clear . . . . . . . . . . . . . . . . . . . . . clear the playlist -| status . . . . . . . . . . . . . . . . . . . current playlist status -| title [X] . . . . . . . . . . . . . . set/get title in current item -| title_n . . . . . . . . . . . . . . . . next title in current item -| title_p . . . . . . . . . . . . . . previous title in current item -| chapter [X] . . . . . . . . . . . . set/get chapter in current item -| chapter_n . . . . . . . . . . . . . . next chapter in current item -| chapter_p . . . . . . . . . . . . previous chapter in current item -| -| seek X . . . . . . . . . . . seek in seconds, for instance `seek 12' -| pause . . . . . . . . . . . . . . . . . . . . . . . . toggle pause -| fastforward . . . . . . . . . . . . . . . . . . set to maximum rate -| rewind . . . . . . . . . . . . . . . . . . . . . set to minimum rate -| faster . . . . . . . . . . . . . . . . . . faster playing of stream -| slower . . . . . . . . . . . . . . . . . . slower playing of stream -| normal . . . . . . . . . . . . . . . . . . normal playing of stream -| rate [playback rate] . . . . . . . . . . set playback rate to value -| frame . . . . . . . . . . . . . . . . . . . . . play frame by frame -| fullscreen, f, F [on|off] . . . . . . . . . . . . toggle fullscreen -| info [X] . . information about the current stream (or specified id) -| stats . . . . . . . . . . . . . . . . show statistical information -| get_time . . . . . . . . . seconds elapsed since stream's beginning -| is_playing . . . . . . . . . . . . 1 if a stream plays, 0 otherwise -| get_title . . . . . . . . . . . . . the title of the current stream -| get_length . . . . . . . . . . . . the length of the current stream -| -| volume [X] . . . . . . . . . . . . . . . . . . set/get audio volume -| volup [X] . . . . . . . . . . . . . . . raise audio volume X steps -| voldown [X] . . . . . . . . . . . . . . lower audio volume X steps -| achan [X] . . . . . . . . . . . . set/get stereo audio output mode -| atrack [X] . . . . . . . . . . . . . . . . . . . set/get audio track -| vtrack [X] . . . . . . . . . . . . . . . . . . . set/get video track -| vratio [X] . . . . . . . . . . . . . . . set/get video aspect ratio -| vcrop, crop [X] . . . . . . . . . . . . . . . . set/get video crop -| vzoom, zoom [X] . . . . . . . . . . . . . . . . set/get video zoom -| vdeinterlace [X] . . . . . . . . . . . . . set/get video deinterlace -| vdeinterlace_mode [X] . . . . . . . set/get video deinterlace mode -| snapshot . . . . . . . . . . . . . . . . . . . . take video snapshot -| strack [X] . . . . . . . . . . . . . . . . . set/get subtitle track -| hotkey, key [hotkey name] . . . . . . . . . . simulate hotkey press -| -| vlm . . . . . . . . . . . . . . . . . . . . . . . . . load the VLM -| set [var [value]] . . . . . . . . . . . . . . . . . set/get env var -| save_env . . . . . . . . . . . . save env vars (for future clients) -| alias [cmd] . . . . . . . . . . . . . . . . set/get command aliases -| description . . . . . . . . . . . . . . . . . describe this module -| license . . . . . . . . . . . . . . . . print VLC's license message -| help, ? [pattern] . . . . . . . . . . . . . . . . . a help message -| longhelp [pattern] . . . . . . . . . . . . . . a longer help message -| lock . . . . . . . . . . . . . . . . . . . . lock the telnet prompt -| logout . . . . . . . . . . . . . . exit (if in a socket connection) -| quit . . . . . . . . quit VLC (or logout if in a socket connection) -| shutdown . . . . . . . . . . . . . . . . . . . . . . . shutdown VLC -+----[ end of help ] \ No newline at end of file diff --git a/doc_vlc_-h_--advanced.txt b/doc_vlc_-h_--advanced.txt deleted file mode 100644 index d20a3f3..0000000 --- a/doc_vlc_-h_--advanced.txt +++ /dev/null @@ -1,851 +0,0 @@ -(PVM) MacBook-Pro:PVM user$ vlc -h --advanced -VLC media player 3.0.6 Vetinari (revision 3.0.6-0-g5803e85f73) -Usage: vlc [options] [stream] ... -You can specify multiple streams on the commandline. -They will be enqueued in the playlist. -The first item specified will be played first. - -Options-styles: - --option A global option that is set for the duration of the program. - -option A single letter version of a global --option. - :option An option that only applies to the stream directly before it - and that overrides previous settings. - -Stream MRL syntax: - [[access][/demux]://]URL[#[title][:chapter][-[title][:chapter]]] - [:option=value ...] - - Many of the global --options can also be used as MRL specific :options. - Multiple :option=value pairs can be specified. - -URL syntax: - file:///path/file Plain media file - http://host[:port]/file HTTP URL - ftp://host[:port]/file FTP URL - mms://host[:port]/file MMS URL - screen:// Screen capture - dvd://[device] DVD device - vcd://[device] VCD device - cdda://[device] Audio CD device - udp://[[]@[][:]] - UDP stream sent by a streaming server - vlc://pause: Pause the playlist for a certain time - vlc://quit Special item to quit VLC - - - core program (core) - - Audio - --audio, --no-audio Enable audio - (default enabled) - --gain - Audio gain - --volume-step - Audio output volume step - --volume-save, --no-volume-save - Remember the audio volume - (default enabled) - --spdif, --no-spdif Force S/PDIF support - (default disabled) - --force-dolby-surround {0 (Auto), 1 (On), 2 (Off)} - Force detection of Dolby Surround - --stereo-mode {0 (Unset), 1 (Stereo), 2 (Reverse stereo), 3 (Left), 4 (Right), 5 (Dolby Surround), 6 (Headphones)} - Stereo audio output mode - --audio-desync Audio desynchronization compensation - --audio-replay-gain-mode {none,track,album} - Replay gain mode - --audio-replay-gain-preamp - Replay preamp - --audio-replay-gain-default - Default replay gain - --audio-replay-gain-peak-protection, --no-audio-replay-gain-peak-protection - Peak protection - (default enabled) - --audio-time-stretch, --no-audio-time-stretch - Enable time stretching audio - (default enabled) - -A, --aout {any,auhal,adummy,afile,amem,none} - Audio output module - --role {video,music,communication,game,notification,animation,production,accessibility,test} - Media role - --audio-filter Audio filters - --audio-visual {any,visual,goom,none} - Audio visualizations - --audio-resampler {any,samplerate,ugly,speex_resampler,none} - Audio resampler - - Video - --video, --no-video Enable video - (default enabled) - --grayscale, --no-grayscale - Grayscale video output - (default disabled) - -f, --fullscreen, --no-fullscreen - Fullscreen video output - (default disabled) - --embedded-video, --no-embedded-video - Embedded video - (default enabled) - --xlib, --no-xlib - (default enabled) - --drop-late-frames, --no-drop-late-frames - Drop late frames - (default enabled) - --skip-frames, --no-skip-frames - Skip frames - (default enabled) - --quiet-synchro, --no-quiet-synchro - Quiet synchro - (default disabled) - --keyboard-events, --no-keyboard-events - Key press events - (default enabled) - --mouse-events, --no-mouse-events - Mouse events - (default enabled) - --video-on-top, --no-video-on-top - Always on top - (default disabled) - --video-wallpaper, --no-video-wallpaper - Enable wallpaper mode - (default disabled) - --disable-screensaver, --no-disable-screensaver - Disable screensaver - (default enabled) - --video-title-show, --no-video-title-show - Show media title on video - (default enabled) - --video-title-timeout - Show video title for x milliseconds - --video-title-position {0 (Center), 1 (Left), 2 (Right), 4 (Top), 8 (Bottom), 5 (Top-Left), 6 (Top-Right), 9 (Bottom-Left), 10 (Bottom-Right)} - Position of video title - --mouse-hide-timeout - Hide cursor and fullscreen controller after x milliseconds - Snapshot: - --snapshot-path Video snapshot directory (or filename) - --snapshot-prefix Video snapshot file prefix - --snapshot-format {png,jpg,tiff} - Video snapshot format - --snapshot-preview, --no-snapshot-preview - Display video snapshot preview - (default enabled) - --snapshot-sequential, --no-snapshot-sequential - Use sequential numbers instead of timestamps - (default disabled) - --snapshot-width Video snapshot width - --snapshot-height - Video snapshot height - Window properties: - --width Video width - --height Video height - --video-x Video X coordinate - --video-y Video Y coordinate - --crop Video cropping - --custom-crop-ratios - Custom crop ratios list - --aspect-ratio Source aspect ratio - --autoscale, --no-autoscale - Video Auto Scaling - (default enabled) - --monitor-par Monitor pixel aspect ratio - --custom-aspect-ratios - Custom aspect ratios list - --hdtv-fix, --no-hdtv-fix Fix HDTV height - (default enabled) - --video-deco, --no-video-deco - Window decorations - (default enabled) - --video-title Video title - --align {0 (Center), 1 (Left), 2 (Right), 4 (Top), 8 (Bottom), 5 (Top-Left), 6 (Top-Right), 9 (Bottom-Left), 10 (Bottom-Right)} - Video alignment - --zoom - Zoom video - --deinterlace {0 (Off), -1 (Automatic), 1 (On)} - Deinterlace - --deinterlace-mode {auto,discard,blend,mean,bob,linear,x,yadif,yadif2x,phosphor,ivtc} - Deinterlace mode - -V, --vout {any,macosx,flaschen,caopengllayer,vmem,vdummy,vdummy,yuv,none} - Video output module - --video-filter Video filter module - --video-splitter Video splitter module - - Subpictures - On Screen Display: - --spu, --no-spu Enable sub-pictures - (default enabled) - --osd, --no-osd On Screen Display - (default enabled) - --text-renderer {any,freetype,tdummy,nsspeechsynthesizer,none} - Text rendering module - Subtitles: - --sub-file Use subtitle file - --sub-autodetect-file, --no-sub-autodetect-file - Autodetect subtitle files - (default enabled) - --sub-autodetect-fuzzy - Subtitle autodetection fuzziness - --sub-autodetect-path - Subtitle autodetection paths - --sub-margin Force subtitle position - --sub-text-scale - Subtitles text scaling factor - Overlays: - --sub-source Subpictures source module - --sub-filter Subpictures filter module - Track settings: - --program Program - --programs Programs - --audio-track Audio track - --sub-track Subtitle track - --audio-language Audio language - --sub-language Subtitle language - --menu-language Menu language - --audio-track-id Audio track ID - --sub-track-id Subtitle track ID - --captions {608 (EIA/CEA 608), 708 (CEA 708)} - Preferred Closed Captions decoder - --preferred-resolution {-1 (Best available), 1080 (Full HD (1080p)), 720 (HD (720p)), 576 (Standard Definition (576 or 480 lines)), 360 (Low Definition (360 lines)), 240 (Very Low Definition (240 lines))} - Preferred video resolution - Playback control: - --input-repeat - Input repetitions - --start-time - Start time - --stop-time - Stop time - --run-time - Run time - --input-fast-seek, --no-input-fast-seek - Fast seek - (default disabled) - --rate - Playback speed - --input-list Input list - --input-slave Input slave (experimental) - --bookmarks Bookmarks list for a stream - Default devices: - --dvd DVD device - --vcd VCD device - Network settings: - --mtu MTU of the network interface - --ipv4-timeout - TCP connection timeout - --http-host HTTP server address - --http-port - HTTP server port - --https-port - HTTPS server port - --rtsp-host RTSP server address - --rtsp-port - RTSP server port - --http-cert HTTP/TLS server certificate - --http-key HTTP/TLS server private key - Socks proxy: - --socks SOCKS server - --socks-user SOCKS user name - --socks-pwd SOCKS password - Metadata: - --meta-title Title metadata - --meta-author Author metadata - --meta-artist Artist metadata - --meta-genre Genre metadata - --meta-copyright Copyright metadata - --meta-description - Description metadata - --meta-date Date metadata - --meta-url URL metadata - Advanced: - --file-caching - File caching (ms) - --live-caching - Live capture caching (ms) - --disc-caching - Disc caching (ms) - --network-caching - Network caching (ms) - --cr-average Clock reference average counter - --clock-synchro {-1 (Default), 0 (Disable), 1 (Enable)} - Clock synchronisation - --clock-jitter Clock jitter - --network-synchronisation, --no-network-synchronisation - Network synchronisation - (default disabled) - --input-record-path - Record directory - --input-record-native, --no-input-record-native - Prefer native stream recording - (default enabled) - --input-timeshift-path - Timeshift directory - --input-timeshift-granularity - Timeshift granularity - --input-title-format - Change title according to current media - --lua, --no-lua Disable all lua plugins - (default enabled) - - Decoders - --codec Preferred decoders list - --encoder Preferred encoders list - - Input - --access {any,satip,vcd,vdr,filesystem,filesystem,access_realrtsp,cdda,nfs,access,sdp,http,concat,access_srt,upnp,sftp,imem,attachment,tcp,udp,ftp,imem_access,access_mms,avcodec,none} - Access module - --demux {any,mp4,avi,asf,es,flacsys,nuv,tta,mpc,wav,caf,sid,sap,ogg,live555,mkv,diracsys,smf,adaptive,webvtt,ttml,mod,xa,voc,image,pva,rawvid,gme,nsv,aiff,ts,directory,au,ps,h26x,ty,h26x,mpgv,libbluray,mjpeg,dvdnav,nsc,rawdv,demux_cdg,avcodec,ps,vobsub,demux_stl,stats,es,real,subtitle,vc1,webvtt,rawaud,demuxdump,none} - Demux module - --stream-filter Stream filter module - --demux-filter Demux filter module - - Stream output - --sout Default stream output chain - --sout-display, --no-sout-display - Display while streaming - (default disabled) - --sout-keep, --no-sout-keep - Keep stream output open - (default disabled) - --sout-all, --no-sout-all Enable streaming of all ES - (default enabled) - --sout-audio, --no-sout-audio - Enable audio stream output - (default enabled) - --sout-video, --no-sout-video - Enable video stream output - (default enabled) - --sout-spu, --no-sout-spu Enable SPU stream output - (default enabled) - --sout-mux-caching - Stream output muxer caching (ms) - VLM: - --vlm-conf VLM configuration file - --sap-interval SAP announcement interval - --mux {any,mux_ts,ps,mux_ogg,avi,mpjpeg,mp4,dummy,asf,wav,avcodec,mp4,none} - Mux module - --access_output {any,file,dummy,udp,access_output_livehttp,http,access_output_shout,ftp,access_output_srt,stream_out_chromecast,avcodec,none} - Access output module - --ttl Hop limit (TTL) - --miface Multicast output interface - --dscp DiffServ Code Point - --packetizer {any,speex,rawvideo,aes3,vorbis,theora,lpcm,h264,vc1,mpeg4video,av1,mlp,dirac,cvdsub,flac,spudec,svcdsub,mpegvideo,mpeg4audio,hevc,avcodec,oggspots,dts,a52,mpegaudio,copy,none} - Preferred packetizer list - - Miscellaneous - Special modules: - --vod-server {any,stream_out_rtp,rtsp,none} - VoD server module - Plugins: - --plugins-cache, --no-plugins-cache - Use a plugins cache - (default enabled) - --plugins-scan, --no-plugins-scan - Scan for new plugins - (default enabled) - --keystore Preferred keystore list - - Playlist - Performance options: - -Z, --random, --no-random Play files randomly forever - (default disabled) - -L, --loop, --no-loop Repeat all - (default enabled) - -R, --repeat, --no-repeat Repeat current item - (default disabled) - --play-and-exit, --no-play-and-exit - Play and exit - (default disabled) - --play-and-stop, --no-play-and-stop - Play and stop - (default disabled) - --play-and-pause, --no-play-and-pause - Play and pause - (default disabled) - --start-paused, --no-start-paused - Start paused - (default disabled) - --playlist-autostart, --no-playlist-autostart - Auto start - (default enabled) - --playlist-cork, --no-playlist-cork - Pause on audio communication - (default enabled) - --media-library, --no-media-library - Use media library - (default disabled) - --playlist-tree, --no-playlist-tree - Display playlist tree - (default disabled) - --open Default stream - --auto-preparse, --no-auto-preparse - Automatically preparse items - (default enabled) - --preparse-timeout - Preparsing timeout - --metadata-network-access, --no-metadata-network-access - Allow metadata network access - (default enabled) - --recursive {none,collapse,expand} - Subdirectory behavior - --ignore-filetypes - Ignored extensions - --show-hiddenfiles, --no-show-hiddenfiles - Show hidden files - (default disabled) - --extractor-flatten, --no-extractor-flatten - Flatten files listed by extractors (archive) - (default disabled) - -S, --services-discovery - Services discovery modules - -v, --verbose Verbosity (0,1,2) - -d, --daemon, --no-daemon Run as daemon process - (default disabled) - --pidfile Write process id to file - --color, --no-color Color messages - (default enabled) - --advanced, --no-advanced Show advanced options - (default disabled) - --interact, --no-interact Interface interaction - (default enabled) - --stats, --no-stats Locally collect statistics - (default enabled) - -I, --intf Interface module - --extraintf Extra interface modules - --control Control interfaces - - Hot keys - --hotkeys-y-wheel-mode {-1 (Ignore), 0 (Volume control), 2 (Position control), 3 (Position control reversed)} - Mouse wheel vertical axis control - --hotkeys-x-wheel-mode {-1 (Ignore), 0 (Volume control), 2 (Position control), 3 (Position control reversed)} - Mouse wheel horizontal axis control - --global-key-toggle-fullscreen - Fullscreen - --key-toggle-fullscreen - Fullscreen - --global-key-leave-fullscreen - Exit fullscreen - --key-leave-fullscreen - Exit fullscreen - --global-key-play-pause - Play/Pause - --key-play-pause Play/Pause - --global-key-pause - Pause only - --key-pause Pause only - --global-key-play Play only - --key-play Play only - --global-key-faster - Faster - --key-faster Faster - --global-key-slower - Slower - --key-slower Slower - --global-key-rate-normal - Normal rate - --key-rate-normal Normal rate - --global-key-rate-faster-fine - Faster (fine) - --key-rate-faster-fine - Faster (fine) - --global-key-rate-slower-fine - Slower (fine) - --key-rate-slower-fine - Slower (fine) - --global-key-next Next - --key-next Next - --global-key-prev Previous - --key-prev Previous - --global-key-stop Stop - --key-stop Stop - --global-key-position - Position - --key-position Position - --global-key-jump-extrashort - Very short backwards jump - --key-jump-extrashort - Very short backwards jump - --global-key-jump+extrashort - Very short forward jump - --key-jump+extrashort - Very short forward jump - --global-key-jump-short - Short backwards jump - --key-jump-short Short backwards jump - --global-key-jump+short - Short forward jump - --key-jump+short Short forward jump - --global-key-jump-medium - Medium backwards jump - --key-jump-medium Medium backwards jump - --global-key-jump+medium - Medium forward jump - --key-jump+medium Medium forward jump - --global-key-jump-long - Long backwards jump - --key-jump-long Long backwards jump - --global-key-jump+long - Long forward jump - --key-jump+long Long forward jump - --global-key-frame-next - Next frame - --key-frame-next Next frame - --global-key-nav-activate - Activate - --key-nav-activate - Activate - --global-key-nav-up - Navigate up - --key-nav-up Navigate up - --global-key-nav-down - Navigate down - --key-nav-down Navigate down - --global-key-nav-left - Navigate left - --key-nav-left Navigate left - --global-key-nav-right - Navigate right - --key-nav-right Navigate right - --global-key-disc-menu - Go to the DVD menu - --key-disc-menu Go to the DVD menu - --global-key-title-prev - Select previous DVD title - --key-title-prev Select previous DVD title - --global-key-title-next - Select next DVD title - --key-title-next Select next DVD title - --global-key-chapter-prev - Select prev DVD chapter - --key-chapter-prev - Select prev DVD chapter - --global-key-chapter-next - Select next DVD chapter - --key-chapter-next - Select next DVD chapter - --global-key-quit Quit - --key-quit Quit - --global-key-vol-up - Volume up - --key-vol-up Volume up - --global-key-vol-down - Volume down - --key-vol-down Volume down - --global-key-vol-mute - Mute - --key-vol-mute Mute - --global-key-subdelay-up - Subtitle delay up - --key-subdelay-up Subtitle delay up - --global-key-subdelay-down - Subtitle delay down - --key-subdelay-down - Subtitle delay down - --global-key-subsync-markaudio - Subtitle sync / bookmark audio timestamp - --key-subsync-markaudio - Subtitle sync / bookmark audio timestamp - --global-key-subsync-marksub - Subtitle sync / bookmark subtitle timestamp - --key-subsync-marksub - Subtitle sync / bookmark subtitle timestamp - --global-key-subsync-apply - Subtitle sync / synchronize audio & subtitle timestamps - --key-subsync-apply - Subtitle sync / synchronize audio & subtitle timestamps - --global-key-subsync-reset - Subtitle sync / reset audio & subtitle synchronization - --key-subsync-reset - Subtitle sync / reset audio & subtitle synchronization - --global-key-subpos-up - Subtitle position up - --key-subpos-up Subtitle position up - --global-key-subpos-down - Subtitle position down - --key-subpos-down Subtitle position down - --global-key-audiodelay-up - Audio delay up - --key-audiodelay-up - Audio delay up - --global-key-audiodelay-down - Audio delay down - --key-audiodelay-down - Audio delay down - --global-key-audio-track - Cycle audio track - --key-audio-track Cycle audio track - --global-key-audiodevice-cycle - Cycle through audio devices - --key-audiodevice-cycle - Cycle through audio devices - --global-key-subtitle-revtrack - Cycle subtitle track in reverse order - --key-subtitle-revtrack - Cycle subtitle track in reverse order - --global-key-subtitle-track - Cycle subtitle track - --key-subtitle-track - Cycle subtitle track - --global-key-subtitle-toggle - Toggle subtitles - --key-subtitle-toggle - Toggle subtitles - --global-key-program-sid-next - Cycle next program Service ID - --key-program-sid-next - Cycle next program Service ID - --global-key-program-sid-prev - Cycle previous program Service ID - --key-program-sid-prev - Cycle previous program Service ID - --global-key-aspect-ratio - Cycle source aspect ratio - --key-aspect-ratio - Cycle source aspect ratio - --global-key-crop Cycle video crop - --key-crop Cycle video crop - --global-key-toggle-autoscale - Toggle autoscaling - --key-toggle-autoscale - Toggle autoscaling - --global-key-incr-scalefactor - Increase scale factor - --key-incr-scalefactor - Increase scale factor - --global-key-decr-scalefactor - Decrease scale factor - --key-decr-scalefactor - Decrease scale factor - --global-key-deinterlace - Toggle deinterlacing - --key-deinterlace Toggle deinterlacing - --global-key-deinterlace-mode - Cycle deinterlace modes - --key-deinterlace-mode - Cycle deinterlace modes - --global-key-intf-show - Show controller in fullscreen - --key-intf-show Show controller in fullscreen - --global-key-intf-boss - Boss key - --key-intf-boss Boss key - --global-key-intf-popup-menu - Context menu - --key-intf-popup-menu - Context menu - --global-key-snapshot - Take video snapshot - --key-snapshot Take video snapshot - --global-key-record - Record - --key-record Record - --global-key-zoom Zoom - --key-zoom Zoom - --global-key-unzoom - Un-Zoom - --key-unzoom Un-Zoom - --global-key-wallpaper - Toggle wallpaper mode in video output - --key-wallpaper Toggle wallpaper mode in video output - --global-key-crop-top - Crop one pixel from the top of the video - --key-crop-top Crop one pixel from the top of the video - --global-key-uncrop-top - Uncrop one pixel from the top of the video - --key-uncrop-top Uncrop one pixel from the top of the video - --global-key-crop-left - Crop one pixel from the left of the video - --key-crop-left Crop one pixel from the left of the video - --global-key-uncrop-left - Uncrop one pixel from the left of the video - --key-uncrop-left Uncrop one pixel from the left of the video - --global-key-crop-bottom - Crop one pixel from the bottom of the video - --key-crop-bottom Crop one pixel from the bottom of the video - --global-key-uncrop-bottom - Uncrop one pixel from the bottom of the video - --key-uncrop-bottom - Uncrop one pixel from the bottom of the video - --global-key-crop-right - Crop one pixel from the right of the video - --key-crop-right Crop one pixel from the right of the video - --global-key-uncrop-right - Uncrop one pixel from the right of the video - --key-uncrop-right - Uncrop one pixel from the right of the video - --global-key-random - Random - --key-random Random - --global-key-loop Normal/Loop/Repeat - --key-loop Normal/Loop/Repeat - --global-key-viewpoint-fov-in - Shrink the viewpoint field of view (360°) - --key-viewpoint-fov-in - Shrink the viewpoint field of view (360°) - --global-key-viewpoint-fov-out - Expand the viewpoint field of view (360°) - --key-viewpoint-fov-out - Expand the viewpoint field of view (360°) - --global-key-viewpoint-roll-clock - Roll the viewpoint clockwise (360°) - --key-viewpoint-roll-clock - Roll the viewpoint clockwise (360°) - --global-key-viewpoint-roll-anticlock - Roll the viewpoint anti-clockwise (360°) - --key-viewpoint-roll-anticlock - Roll the viewpoint anti-clockwise (360°) - --global-key-zoom-quarter - 1:4 Quarter - --key-zoom-quarter - 1:4 Quarter - --global-key-zoom-half - 1:2 Half - --key-zoom-half 1:2 Half - --global-key-zoom-original - 1:1 Original - --key-zoom-original - 1:1 Original - --global-key-zoom-double - 2:1 Double - --key-zoom-double 2:1 Double - Jump sizes: - --extrashort-jump-size - Very short jump length - --short-jump-size - Short jump length - --medium-jump-size - Medium jump length - --long-jump-size Long jump length - --global-key-set-bookmark1 - Set playlist bookmark 1 - --key-set-bookmark1 - Set playlist bookmark 1 - --global-key-set-bookmark2 - Set playlist bookmark 2 - --key-set-bookmark2 - Set playlist bookmark 2 - --global-key-set-bookmark3 - Set playlist bookmark 3 - --key-set-bookmark3 - Set playlist bookmark 3 - --global-key-set-bookmark4 - Set playlist bookmark 4 - --key-set-bookmark4 - Set playlist bookmark 4 - --global-key-set-bookmark5 - Set playlist bookmark 5 - --key-set-bookmark5 - Set playlist bookmark 5 - --global-key-set-bookmark6 - Set playlist bookmark 6 - --key-set-bookmark6 - Set playlist bookmark 6 - --global-key-set-bookmark7 - Set playlist bookmark 7 - --key-set-bookmark7 - Set playlist bookmark 7 - --global-key-set-bookmark8 - Set playlist bookmark 8 - --key-set-bookmark8 - Set playlist bookmark 8 - --global-key-set-bookmark9 - Set playlist bookmark 9 - --key-set-bookmark9 - Set playlist bookmark 9 - --global-key-set-bookmark10 - Set playlist bookmark 10 - --key-set-bookmark10 - Set playlist bookmark 10 - --global-key-play-bookmark1 - Play playlist bookmark 1 - --key-play-bookmark1 - Play playlist bookmark 1 - --global-key-play-bookmark2 - Play playlist bookmark 2 - --key-play-bookmark2 - Play playlist bookmark 2 - --global-key-play-bookmark3 - Play playlist bookmark 3 - --key-play-bookmark3 - Play playlist bookmark 3 - --global-key-play-bookmark4 - Play playlist bookmark 4 - --key-play-bookmark4 - Play playlist bookmark 4 - --global-key-play-bookmark5 - Play playlist bookmark 5 - --key-play-bookmark5 - Play playlist bookmark 5 - --global-key-play-bookmark6 - Play playlist bookmark 6 - --key-play-bookmark6 - Play playlist bookmark 6 - --global-key-play-bookmark7 - Play playlist bookmark 7 - --key-play-bookmark7 - Play playlist bookmark 7 - --global-key-play-bookmark8 - Play playlist bookmark 8 - --key-play-bookmark8 - Play playlist bookmark 8 - --global-key-play-bookmark9 - Play playlist bookmark 9 - --key-play-bookmark9 - Play playlist bookmark 9 - --global-key-play-bookmark10 - Play playlist bookmark 10 - --key-play-bookmark10 - Play playlist bookmark 10 - --global-key-clear-playlist - Clear the playlist - --key-clear-playlist - Clear the playlist - --global-key-subtitle-text-scale-normal - Reset subtitles text scale - --key-subtitle-text-scale-normal - Reset subtitles text scale - --global-key-subtitle-text-scale-up - Scale down subtitles text - --key-subtitle-text-scale-up - Scale down subtitles text - --global-key-subtitle-text-scale-down - Scale up subtitles text - --key-subtitle-text-scale-down - Scale up subtitles text - --bookmark1 Playlist bookmark 1 - --bookmark2 Playlist bookmark 2 - --bookmark3 Playlist bookmark 3 - --bookmark4 Playlist bookmark 4 - --bookmark5 Playlist bookmark 5 - --bookmark6 Playlist bookmark 6 - --bookmark7 Playlist bookmark 7 - --bookmark8 Playlist bookmark 8 - --bookmark9 Playlist bookmark 9 - --bookmark10 Playlist bookmark 10 - -h, --help, --no-help print help for VLC (can be combined with --advanced and --help-verbose) - (default disabled) - -H, --full-help, --no-full-help - Exhaustive help for VLC and its modules - (default disabled) - --longhelp, --no-longhelp print help for VLC and all its modules (can be combined with --advanced - and --help-verbose) - (default disabled) - --help-verbose, --no-help-verbose - ask for extra verbosity when displaying help - (default disabled) - -l, --list, --no-list print a list of available modules - (default disabled) - --list-verbose, --no-list-verbose - print a list of available modules with extra detail - (default disabled) - -p, --module print help on a specific module (can be combined with --advanced and - --help-verbose). Prefix the module name with = for strict matches. - --ignore-config, --no-ignore-config - no configuration option will be loaded nor saved to config file - (default enabled) - --reset-config, --no-reset-config - reset the current config to the default values - (default disabled) - --reset-plugins-cache, --no-reset-plugins-cache - resets the current plugins cache - (default disabled) - --version, --no-version print version information - (default disabled) - --config use alternate config file \ No newline at end of file diff --git a/pvm.py b/pvm.py index 1d842c0..870ce00 100644 --- a/pvm.py +++ b/pvm.py @@ -1,56 +1,70 @@ -import vlc -from pythonosc import dispatcher, osc_server, udp_client -import socket +from pythonosc import dispatcher, osc_server import argparse +from omxplayer.player import OMXPlayer +import logging +import sys -inst = vlc.Instance('--input-repeat=65535','--video-x=100') -media = inst.media_player_new("zoetrope.mp4") -# media = vlc.MediaPlayer("jellyfish720p.mp4") +def _init_logger(): + logger = logging.getLogger('PVM') + logger.setLevel(logging.INFO) + handler = logging.StreamHandler(sys.stderr) + handler.setLevel(logging.INFO) + formatter = logging.Formatter("%(asctime)s;%(levelname)s;%(message)s", + "%Y-%m-%d %H:%M:%S") + handler.setFormatter(formatter) + logger.addHandler(handler) -#media.set_fullscreen(True) +_init_logger() +_logger = logging.getLogger('PVM') +_logger.info("Logging system initilized!") +# logging example: +# _logger.info('App started in %s', os.getcwd()) +# _logger.debug('App started in %s', os.getcwd()) -# media.play() +VIDEO_PATH = "jellyfish720p.mp4" +# TODO: rename the variable +media = "" -#media.stop() -# def parse_qasm(*args): -# for arg in args: -# print(arg) - -# while True: +# TODO: rewrite logging +# TODO: rewrite logic between commands def parse_commands(*args): + global media + global VIDEO_PATH command = args[1] - print("command: "+command) + _logger.info("Command: %s", command) if len(args)>2: value = args[2] - print("value: "+str(value)) + _logger.info("Value: %s", str(value)) pass + # TODO: Create another python file to control two display if command=="file": - global media - media = inst.media_player_new(value) + # TODO: create a isFileSet flag + media = OMXPlayer(value, dbus_name='org.mpris.MediaPlayer2.omxplayer', args=['--loop']) + media.pause() + VIDEO_PATH = value elif command=="start": + # TODO: if media.can_play() media.play() elif command=="stop": + # TODO: if media.can_stop() media.stop() elif command=="set_position": media.set_position(float(value)) - elif command=="fullscreen": - # media.set_fullscreen(True) - media.toggle_fullscreen() elif command=="set_rate": - media.set_rate(float(value)) + # TODO: check isFileSet flag + fps = str(30 * float(value)) + media = OMXPlayer(VIDEO_PATH, dbus_name='org.mpris.MediaPlayer2.omxplayer', args=['--loop','--force-fps', fps]) + media.pause() elif command=="pause": + # TODO: if media.can_pause() media.pause() - elif command=="next_frame": - media.next_frame() else: + # TODO: change loggind print("I received command \"%s\" but I don't know what to do with it, yet." % command) def main(RECEIVE_PORT): #OSC server - # media = inst.media_player_new(FILE) - print("How many video outputs does this media player have?") - print(media.has_vout()) callback = dispatcher.Dispatcher() server = osc_server.ThreadingOSCUDPServer(("", RECEIVE_PORT), callback) print("server now listenning on port "+str(RECEIVE_PORT)) @@ -60,16 +74,7 @@ def main(RECEIVE_PORT): if __name__ == '__main__': p = argparse.ArgumentParser() p.add_argument('--port', type=int, nargs='?', default=8001, help='The port that pvm.py will use to receive control messages. Default port is 8001') - # p.add_argument('--file', nargs='?', default='jellyfish720p.mp4', help='The file that pvm.py will load. Default is jellyfish720p.mp4') args = p.parse_args() print('PVM - Pi Video Machine') print('Omar Costa Hamido 2022') main(args.port) - - -# UDP_IP = "" -# UDP_PORT = 8000 #add possibility to change this - -# sock = socket.socket(socket.AF_INET, # Internet -# socket.SOCK_DGRAM) # UDP -# sock.bind((UDP_IP, UDP_PORT)) \ No newline at end of file diff --git a/pvm_alt.py b/pvm_alt.py deleted file mode 100644 index 50655fc..0000000 --- a/pvm_alt.py +++ /dev/null @@ -1,84 +0,0 @@ -import os -import time -from subprocess import PIPE, Popen -from pythonosc import dispatcher, osc_server, udp_client -import socket -import argparse - -cmd1 = "vlc zoetrope.mp4 -I rc" -cmd2 = b"loop\n" - -proc = Popen(cmd1.split(),stdin=PIPE) - -proc.stdin.write(cmd2) -proc.stdin.flush() - -def parse_commands(*args): - # data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes - # data = data.decode('UTF-8').split() - command = args[1] - if len(args)>2: - value = args[2] - pass - if command=="start": - # media.play() - proc.stdin.write(b"play\n") - proc.stdin.flush() - pass - if command=="stop": - # media.stop() - proc.stdin.write(b"stop\n") - proc.stdin.flush() - pass - if command=="set_position": - # media.set_position(float(value)) - cmd = b"seek \"%f\"" % float(value) - proc.stdin.write(cmd) - proc.stdin.flush() - pass - if command=="fullscreen": - # media.set_fullscreen(True) - # media.toggle_fullscreen() - proc.stdin.write(b"fullscreen\n") - proc.stdin.flush() - pass - if command=="set_rate": - # media.set_fullscreen(True) - # media.set_rate(float(value)) - cmd = b"rate \"%f\"" % float(value) - proc.stdin.write(cmd) - proc.stdin.flush() - pass - if command=="pause": - # media.set_fullscreen(True) - # media.pause() - proc.stdin.write(b"pause\n") - proc.stdin.flush() - pass - if command=="next_frame": - # media.set_fullscreen(True) - # media.next_frame() - proc.stdin.write(b"frame\n") - proc.stdin.flush() - pass - else: - print("I received command \"%s\" but I don't know what to do with it, yet." % command) - - -def main(RECEIVE_PORT): - #OSC server - # media = inst.media_player_new(FILE) - callback = dispatcher.Dispatcher() - server = osc_server.ThreadingOSCUDPServer(("", RECEIVE_PORT), callback) - callback.map("/PVM", parse_commands) - server.serve_forever() - -if __name__ == '__main__': - p = argparse.ArgumentParser() - p.add_argument('--port', type=int, nargs='?', default=8001, help='The port that pvm.py will use to receive control messages. Default port is 8001') - # p.add_argument('--file', nargs='?', default='jellyfish720p.mp4', help='The file that pvm.py will load. Default is jellyfish720p.mp4') - args = p.parse_args() - print('PVM - Pi Video Machine') - print('alt version: vlc -I rc') - print('Omar Costa Hamido 2022') - main(args.port) \ No newline at end of file diff --git a/pvm_omx.py b/pvm_omx.py deleted file mode 100644 index a4aaa35..0000000 --- a/pvm_omx.py +++ /dev/null @@ -1,88 +0,0 @@ -from pythonosc import dispatcher, osc_server -import argparse -from omxplayer.player import OMXPlayer -import logging -import sys - -def _init_logger(): - logger = logging.getLogger('PVM') - logger.setLevel(logging.INFO) - handler = logging.StreamHandler(sys.stderr) - handler.setLevel(logging.INFO) - formatter = logging.Formatter("%(asctime)s;%(levelname)s;%(message)s", - "%Y-%m-%d %H:%M:%S") - handler.setFormatter(formatter) - logger.addHandler(handler) - -_init_logger() -_logger = logging.getLogger('PVM') -_logger.info("Logging system initilized!") -# logging example: -# _logger.info('App started in %s', os.getcwd()) -# _logger.debug('App started in %s', os.getcwd()) - -VIDEO_PATH = "jellyfish720p.mp4" -# TODO: rename the variable -media = "" - -# TODO: rewrite logging -# TODO: rewrite logic between commands -def parse_commands(*args): - global media - global VIDEO_PATH - command = args[1] - _logger.info("Command: %s", command) - if len(args)>2: - value = args[2] - _logger.info("Value: %s", str(value)) - pass - # TODO: Create another python file to control two display - if command=="file": - # TODO: create a isFileSet flag - media = OMXPlayer(value, dbus_name='org.mpris.MediaPlayer2.omxplayer', args=['--loop']) - media.pause() - VIDEO_PATH = value - elif command=="start": - # TODO: if media.can_play() - media.play() - elif command=="stop": - # TODO: if media.can_stop() - media.stop() - elif command=="set_position": - media.set_position(float(value)) - elif command=="set_rate": - # TODO: check isFileSet flag - fps = str(30 * float(value)) - media = OMXPlayer(VIDEO_PATH, dbus_name='org.mpris.MediaPlayer2.omxplayer', args=['--loop','--force-fps', fps]) - media.pause() - elif command=="pause": - # TODO: if media.can_pause() - media.pause() - else: - # TODO: change loggind - print("I received command \"%s\" but I don't know what to do with it, yet." % command) - - -def main(RECEIVE_PORT): - #OSC server - callback = dispatcher.Dispatcher() - server = osc_server.ThreadingOSCUDPServer(("", RECEIVE_PORT), callback) - print("server now listenning on port "+str(RECEIVE_PORT)) - callback.map("/PVM", parse_commands) - server.serve_forever() - -if __name__ == '__main__': - p = argparse.ArgumentParser() - p.add_argument('--port', type=int, nargs='?', default=8001, help='The port that pvm.py will use to receive control messages. Default port is 8001') - args = p.parse_args() - print('PVM - Pi Video Machine') - print('Omar Costa Hamido 2022') - main(args.port) - - -# UDP_IP = "" -# UDP_PORT = 8000 #add possibility to change this - -# sock = socket.socket(socket.AF_INET, # Internet -# socket.SOCK_DGRAM) # UDP -# sock.bind((UDP_IP, UDP_PORT)) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index e00c02f..866c143 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,8 @@ +dbus-python==1.3.2 +decorator==5.1.1 +evento==1.0.2 +omxplayer-wrapper==0.3.3 +pathlib2==2.3.7.post1 +pkg-resources==0.0.0 python-osc==1.8.0 -python-vlc==3.0.16120 +six==1.16.0