树莓派3B+指南(十五)omxplayer的安装与使用

omxplayer的安装与使用

需要用python来控制播放视频,所以就找到了这个播放器,很好用。
看了官网文档,安装使用都写的比较明白了。
官网地址:https://python-omxplayer-wrapper.readthedocs.io/en/latest/#

安装:

pip3 install omxplayer-wrapper

使用:

from omxplayer import OMXPlayer
from pathlib import path
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)
GPIO.setup(40, GPIO.IN)

VIDEO_PATH = Path('my.mp4')
player = OMXPlayer(VIDEO_PATH, args = '-b -o local' )

while Ture:
	if (GPIO.input(40) == GPIO.HIGH):
		break
player.quit()

参数:
这些参数是在终端时候用的,在Python中如何使用,还需要摸索,但是一帮的可以加载args作为参数就能使用。

开始前:

omxplayer --help
Usage: omxplayer [OPTIONS] [FILE]
-h  --help                  Print this help
-v  --version               Print version info
-k  --keys                  Print key bindings
-n  --aidx  index           Audio stream index    : e.g. 1
-o  --adev  device          Audio out device      : e.g. hdmi/local/both
-i  --info                  Dump stream format and exit
-I  --with-info             dump stream format before playback
-s  --stats                 Pts and buffer stats
-p  --passthrough           Audio passthrough
-d  --deinterlace           Force deinterlacing
    --nodeinterlace         Force no deinterlacing
    --nativedeinterlace     let display handle interlace
    --anaglyph type         convert 3d to anaglyph
    --advanced              Allow advanced deinterlace for HD videos
-w  --hw                    Hw audio decoding
-3  --3d mode               Switch tv into 3d mode (e.g. SBS/TB)
-M  --allow-mvc             Allow decoding of both views of MVC stereo stream
-y  --hdmiclocksync         Display refresh rate to match video (default)
-z  --nohdmiclocksync       Do not adjust display refresh rate to match video
-t  --sid index             Show subtitle with index
-r  --refresh               Adjust framerate/resolution to video
-g  --genlog                Generate log file
-l  --pos n                 Start position (hh:mm:ss)
-b  --blank                 Set background to black

播放中:

z   Show Info  
1   Decrease Speed
2   Increase Speed
j   Previous Audio stream
k   Next Audio stream
i   Previous Chapter
o   Next Chapter
n   Previous Subtitle stream
m   Next Subtitle stream
s   Toggle subtitles
d   Subtitle delay -250ms
f   Subtitle delay +250ms
q   Exit Omxplayer
-   Decrease Volume
+   increase Volume
Left Arrow  Seek -30s
Right Arrow Seek +30s
Down Arrow  Seek -600s
Up Arrow    Seek +600s
Space or p  Pasue/Resume

至此就结束了,希望可以帮助到大家!

猜你喜欢

转载自blog.csdn.net/weixin_44086593/article/details/88076399