Python VLC MediaPlayer – Getting FPS
In this article we will see how we can get the fps i.e frame rate per second in 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. Frame rate is the frequency at which consecutive images called frames appear on a display. The term applies equally to film and video cameras, computer graphics, and motion capture systems. Frame rate may also be called the frame frequency, and be expressed in hertz.
In order to do this we will use get_fps method with the MediaPlayer object Syntax : media_player.get_fps() Argument : It takes no argument Return : It returns float
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.get_fps()
print ("Frame Rate per Second : ")
print (value)
|
Output :
Frame Rate per Second :
23.976215362548828
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_cursor()
value = media_player.get_fps()
print ("Frame Rate per Second : ")
print (value)
|
Output :
Frame Rate per Second :
29.969999313354492
Last Updated :
10 Apr, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...