Automatic frame rate switching in TV box ensures video output matches the video frame rate in order to avoid skipped frames (judder) from time to time, and makes the videos much smoother to watch, especially to trained eyes.
The problem is that the feature is not always implemented, and/or does not work for all apps. AFRd auto frame rate daemon aims to solve this issue by automatically switching video output to match the video framerate – e.g. 23.976 fps or 59.94 fps – on Android TV boxes powered by one of Amlogic 64-bit processors, be it S905, S905X, S905X2, S912, S905W and other more recent Armv8 processors from the company.
Developed by Andrey Zabolotny (anpaza), AFRd is Linux daemon can be linked to either bionic for Android, or glibc for Linux operating systems, and the source code can be found on Github.
It relies on two techniques to detect the video frame rate, and adequately change video output (HDMI) frame rate:
- Kernel uevent-based notifications available in AmLogic 3.14 kernels up to Kernel 4.9 used in Android 7 and 8. Example of uevent when a 29.976 fps movie is started (FRAME_RATE_HINT contains the info):
- In newer kernels or when uevent notifications are not generated, video decoder notifications emitted at the start and end of playback are used instead. Example of video start:Shell123456add@/devices/vdec.25/amvdec_h264.0ACTION=addDEVPATH=/devices/vdec.25/amvdec_h264.0SUBSYSTEM=platformMODALIAS=platform:amvdec_h264SEQNUM=2786
Since the frame rate is not shown in the data, the daemon will check /sys/class/vdec/vdec_status when the event above is detected:Shell123456789vdec channel 0 statistics:device name : amvdec_h264frame width : 1920frame height : 1080frame rate : 24 fpsbit rate : 856 kbpsstatus : 63frame dur : 4000...
Frame dur is used is not zero, otherwise frame rate data is selected with 23 fps meaning 23.976 fps, 29 is 29.970fps and 59 represents 59.94 fps.
The installation will be easily in Android, as Andrey provides an apk (ru.cobra.zap.afrd-0.3.2.apk) which you can install in your rooted TV box.
Then you can enter the app to enable/disable auto frame rate, and adjust other settings such as preferred frequencies. It’s also possible to directly edit AFDR configuration, and/or control the daemon through an API as explained in details in the Github page.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
|Support CNX Software - Donate via PayPal or cryptocurrencies, become a Patron on Patreon, or buy review samples|