Monday, December 22, 2014

Install libva-intel-driver to get HW acceleration of VLC player enabled

Today I installed Fedora 21 and updated to latest after adding RPMFusion repo.
However when I played a HD video using VLC player, it seemed that HW acceleration in VLC didn't work.
I executed vainfo command to check the  vaapi status and got some error messages.

[root@student ~]# vainfo 
error: XDG_RUNTIME_DIR not set in the environment.
libva info: VA-API version 0.36.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

After searching google for a solution, I found that installing "libva-intel-driver" package fixes the issue.

[root@student ~]# vainfo 
error: XDG_RUNTIME_DIR not set in the environment.
libva info: VA-API version 0.36.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_36
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.36 (libva 1.4.1)
vainfo: Driver version: Intel i965 driver 
for Intel(R) Haswell Desktop - 1.4.1
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice

Now VLC player uses HW acceleration and the CPU utilization is well under 10%  when a HD video is played. 
I tried selecting "VA-API video decoder via X11" and "VA-API video decoder via DRM" options available under "Hardware-accelerated decoding" in "Input & Codecs Settings" of VLC. It seemed the CPU utilization is almost same for both the methods.

Sunday, December 7, 2014

Get information about movies using perl IMDB::Film module


I got a 3 TB hard disk with a bunch of movies and I wanted to keep all the movies where the IMDB rating is greater than 7 removing all the others. Since there were hundreds of movies, I thought of automating the task.

When I Googled to find out an easier method, I found an article (http://davide.eynard.it/2011/01/20/perl-hacks-automatically-get-info-about-a-movie-from-imdb/) that describes how useful the IMDB::Film (http://search.cpan.org/~stepanov/IMDB-Film-0.53/lib/IMDB/Film.pm) perl module is for my task.

So I wrote a simple Perl script which reads movie title (in <movie name><year><other information> format) from STDIN and prints selected information about the movie to STDOUT.

e.g.:
root@LS-VL406:~/IMDB_Reader# echo 'Star Trek Into Darkness 2013 BRRip XviD AC3-SANTi' | ./GetMovieInfo.pl                     
Star Trek Into Darkness 2013 BRRip XviD AC3-SANTi,Star Trek Into Darkness,2013,movie,7.9,When the crew of the Enterprise is called back home, they find an unstoppable force of terror from within their own organization has detonated the fleet and everything it stands for, leaving our world in a state of crisis. With a personal score to settle, Captain Kirk leads a manhunt to a war-zone world to capture a one-man weapon of mass destruction. As our heroes are propelled into an epic chess game of life and death, love will be challenged, friendships will be torn apart, and sacrifices must be made for the only family Kirk has left: his crew.


This is a very simple Perl script so anyone can modify the script to add whatever information is required for a movie. Also it reads input from STDIN and prints output to STDOUT so that the unix pipe can be used for various pre and post processing such as read a movie list from a file and pipe it to the script.

I have tested this on a system which runs Fedora 20 on it and also on Buffalo linkstation NAS.

The script can be downloaded from here, All the required perl modules are included so that the user does not need to install any additional Perl modules.

https://sites.google.com/site/blogswapoff/IMDB_Reader.tar.gz