Modul je psaný pouze pro linuxové prostředí.
mplayer.screenshot(filename, position_time=30, image_path=None, jpeg_name=None, image_quality=100)
- Podrobněji o funkci screenshot.
Změna cesty kam se má screenshot uložit.
import mplayer
ss = mplayer.screenshot('my_video.mkv', image_path='/home/user/Desktop', jpeg_name='my_image_name')
print('Image path:', ss.image_location)
Výstup konzole:
$ test_create_screenshot.py
Image path: /home/user/Desktop/my_image_name.jpg
Použití stejného času který je zapsán dvěma různými způsoby.
Property image_location
nám pak vrátí místo uložení našich screenshotů.
import mplayer
ss = mplayer.screenshot('my_video.mkv', position_time='2:00', jpeg_name='my_img_1')
print('Image path:', ss.image_location)
ss = mplayer.screenshot('my_video.mkv', position_time='120', jpeg_name='my_img_2')
print('Image path:', ss.image_location)
Výstup konzole:
$ test_create_screenshot.py
Image path: /home/user/Desktop/screenshots/my_img_1.jpg
Image path: /home/user/Desktop/screenshots/my_img_2.jpg
mplayer.metadata(filename, meta_name=None)
- Podrobněji o funkci metadata.
import mplayer
sm = mplayer.metadata('my_video.mkv')
print(sm.supported_meta)
print('--------------------')
print(sm.raw_data)
Výstup konzole:
$ test_get_metadata.py
['video_format', 'filename', 'subtitle_lang', 'audio_lang', 'video_height', 'video_length', 'video_width']
--------------------
ID_CHAPTER_ID=0
ID_CHAPTER_0_START=0
ID_CHAPTER_0_END=33617
ID_CHAPTER_0_NAME=00:00:00.000
ID_CHAPTER_ID=1
import mplayer
meta_name = [
'filename',
'audio_lang',
'subtitle_lang',
'video_width',
'video_height',
'video_length',
'video_format'
]
sm = mplayer.metadata('my_video.mkv', meta_name)
print(sm.meta_output)
Výstup konzole:
$ test_get_metadata.py
{'video_height': '720', 'subtitle_lang': ['cze', 'cze'], 'filename': 'my_video.mkv', 'video_format': 'H264', 'video_length': '1345.05', 'video_width': '1280', 'audio_lang': ['cze', 'eng']}
import time
import mplayer
meta_time = mplayer.metadata('my_video.mkv', 'video_length').meta_output['video_length']
print('Video length:', time.strftime("%H:%M:%S", time.gmtime(float(meta_time))))
Výstup konzole:
$ test_get_metadata.py
('Video length:', '00:22:25')
pip install https://github.com/aleskrejcicz/mplayer_callapi_example/zipball/master
BSD