Mpv, Mplayer

From Elvanör's Technical Wiki
Revision as of 15:36, 22 September 2023 by Elvanor (talk | contribs)
Jump to navigation Jump to search

Listening to Internet Radios

  • Some Internet radios use the rtsp:// streaming protocol. VLC supports this, but Amarok does not, because the Xine engine has no RTSP support yet (although it seems to have basic support for *some* RTSP implementations according to a Xine bugzilla entry).
  • Until suppport has been implemented in Xine, use VLC rather than Amarok (or other applications based on the Xine backend) to listen to Internet radios. Amarok works well with HTTP streaming.
  • Amarok however support WMA format / codecs. It is the streaming part that causes troubles.

mpv / ffmpeg

  • smplayer supports mpv as a backend (better to use mpv in 2023, in comparison to Mplayer).
  • ffmpeg can crash (segfault) if built with optimizations. Building ffmpeg with COMMON_FLAGS="-O0 -pipe" (instead of -O2) can solve this issue.

VAAPI

  • VAAPI is an acceleration API, similar to VDPAU but more supported. It is available both on Intel and nVidia cards, but with nVidia cards you need to emerge media-libs/nvidia-vaapi-driver and set the LIBVA_DRIVER_NAME environment variable to "nvidia". It does not seem by default to correctly choose the nvidia driver, at least with current versions.
  • You will also need to set the nvidia-drm.modeset=1 kernel module parameter (on Grub).
  • If VAAPI works, the vainfo tool will report it.
  • smplayer then needs to be configured: Settings -> Performance -> Decoding and choose vaapi for Hardware decoding.

Mplayer

  • Note that mplayer binary contains a bundled version of ffmpeg / libavcodec. Thus it does not link to ffmpeg package on Gentoo (actually it does not even need this package).
  • An excellent GUI for mplayer is smplayer (Qt 4 based).

Accelerating mplayer

  • Playing back 1080p (Full HD) videos require quite a bit of CPU power. Thus it is necessary to use all cores of the processor (one will not be enough), or to use the video card to decode the video. In Gentoo there are currently two options to accelerate mplayer.
  • First and best option is to add the vdpau USE flag to mplayer, which will enable decoding on nvidia cards if you have a GeForce of the 8000 series or later. You can then use VDPAU acceleration with the following options:
mplayer -vo vdpau -vc ffh264vdpau file.mkv

Or add those lines to ~/.mplayer/config:

vo=vdpau,xv
vc=ffh264vdpau,ffvc1vdpau,ffmpeg12vdpau,ffwmv3vdpau
  • If your video card is too old, the best is to try the experimental mplayer-mt (multithreaded) branch which will make use of all your cores. At the moment (August 2009), the branch is not merged back into main trunk and is not available in an official Gentoo package. You can try the ebuild at this page. Load mplayer in the following way:
mplayer-mt -lavdopts threads=3 file.mkv