Python VLC MediaPlayer – Getting Height of selected video
In this article, we will see how we can get the height of the MediaPlayer object in the python vlc module. VLC media player is a free and open-source portable cross-platform media player software and streaming media server developed by the VideoLAN project. MediaPlayer object is the basic object in vlc module for playing the video. We can create a MediaPlayer object with the help of MediaPlayer method. We can get the height of the selected video by passing the index of the video, if no index is specified ongoing video height is returned.
In order to do this we will use video_get_height method with the MediaPlayer object
Syntax : media_player.video_get_height(n)
Argument : It takes integer as optional argument
Return : It returns integer
Below is the implementation
Python3
import vlc
import time
media_player = vlc.MediaPlayer()
mrl = "death_note.mkv"
media_player.set_mrl(mrl)
media_player.play()
time.sleep( 5 )
value = media_player.video_get_height( 0 )
print ( "Height at Index 0 : " )
print (value)
|
Output :
Height at Index 0 :
720
Another example
Below is the implementation
Python3
import vlc
import time
media_player = vlc.MediaPlayer()
mrl = "1.mp4"
media_player.set_mrl(mrl)
media_player.play()
time.sleep( 5 )
value = media_player.video_get_height( 0 )
print ( "Height at Index 0 : " )
print (value)
|
Output :
Height at Index 0 :
480
Last Updated :
30 Sep, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...