[PYTHON] How to play a video while watching the number of frames (Mac)

In many cases, you want to know the number of frames of the scene you are interested in by checking the video frame by frame. Despite the relatively likely demand, recent video players can only display seconds, and even if you look it up, there is no way to do it. I desperately investigated if something could be done and found a response as a measure of pain, so I made a note. Please let me know if there is another good way. Why is there no player who can do such a basic thing? (I wish I could use QuictimePlayer7, but I can't run 32-bit apps now.)

Method

Compile by slightly rewriting the player called mpv. First, download the source code from Git.

All you have to do is add a line to the get_term_status_msg function in player / osd.c. (About the 200th line in the current version)

// Playback position
sadd_hhmmssff(&line, get_playback_time(mpctx), opts->osd_fractions);
saddf(&line, " / ");
sadd_hhmmssff(&line, get_time_length(mpctx), opts->osd_fractions);
sadd_percentage(&line, get_percent_pos(mpctx));

/////////// add to //////////////// line = talloc_asprintf_append(line, " (%d frame)", (int)(mpctx->video_pts * mpctx->tracks[0]->stream->codec->fps+0.5)); /////////// So far ////////////

Then compile and install according to the README. Then, the number of frames will be displayed at the end of the display of the playback time of the terminal. (Paused) V: 00:00:00 / 00:00:03 (21%) (19 frame)

Recommended Posts

How to play a video while watching the number of frames (Mac)
How to calculate the volatility of a brand
How to put a line number at the beginning of a CSV file
How to count the number of elements in Django and output to a template
How to access the contents of a Linux disk on a Mac (but read-only)
How to know the port number of the xinetd service
How to get the number of digits in Python
How to identify the element with the smallest number of characters in a Python list?
[Ubuntu] How to delete the entire contents of a directory
How to find the optimal number of clusters in k-means
How to find the scaling factor of a biorthogonal wavelet
How to connect the contents of a list into a string
How to determine the existence of a selenium element in Python
How to check the memory size of a variable in Python
How to find the memory address of a Pandas dataframe value
How to output the output result of the Linux man command to a file
How to save only a part of a long video using OpenCV
How to get the vertex coordinates of a feature in ArcPy
[NNabla] How to remove the middle tier of a pre-built network
How to check the version of Django
[Python] A program that calculates the number of socks to be paired
How to find out the number of CPUs without using the sar command
[Python] How to put any number of standard inputs in a list
[NNabla] How to add a quantization layer to the middle layer of a trained model
How to create a wrapper that preserves the signature of the function to wrap
How to pass the execution result of a shell command in a list in Python
A simple example of how to use ArgumentParser
How to find the area of the Voronoi diagram
How to mention a user group in slack notification, how to check the id of the user group
Upload a large number of images to Wordpress
Set the number of elements in a NumPy one-dimensional array to a power of 2 (0 padded)
[Circuit x Python] How to find the transfer function of a circuit using Lcapy
Find out how to divide a file with a certain number of lines evenly
[NNabla] How to get the output (variable) of the middle layer of a pre-built network
[python] How to sort by the Nth Mth element of a multidimensional array
Find the number of days in a month
A memorandum of how to execute the! Sudo magic command in Jupyter Notebook
[Numpy, scipy] How to calculate the square root of a semi-fixed definite matrix
Use twitter API to get the number of tweets related to a certain keyword
An introduction to data analysis using Python-To increase the number of video views-
How to make a Raspberry Pi that speaks the tweets of the specified user
[Note] How to create a Mac development environment
How to get a list of files in the same directory with python
[Introduction to Python] How to get the index of data with a for statement
How to display the modification date of a file in C language up to nanoseconds
A script that can perform stress tests according to the number of CPU cores
[Ruby] How to replace only a part of the string matched by the regular expression?
How to check in Python if one of the elements of a list is in another list
Command to check the total number of CPU physical cores / logical cores / physical memory on Mac
Find a guideline for the number of processes / threads to set in the application server
The world's most easy-to-understand explanation of how to make a LINE BOT (1) [Account preparation]
[NNabla] How to add a new layer between the middle layers of a pre-built network
A memo on how to overcome the difficult problem of capturing FX with AI
How to change the generated image of GAN to a high quality one to your liking
Read the Python-Markdown source: How to create a parser
python beginners tried to predict the number of criminals
[Python] A program that counts the number of valleys
How to write a GUI using the maya command
A memo of how to use AIST supercomputer ABCI
A memo to visually understand the axis of pandas.Panel
How to create a submenu with the [Blender] plugin