libvdpau-sunxi icon indicating copy to clipboard operation
libvdpau-sunxi copied to clipboard

Video panning/jitter observed with hardware acceleration on mplayer using libvdpau-sunxi

Open navjotsingh07 opened this issue 8 years ago • 56 comments

I am working on 1080p MP4 (around 20 Mbps/29.97 fps) video play with hardware acceleration on mplayer that use video output as vdpau and video codecs as ffmpeg12vdpau, ffh264vdpau, ffwmv3vdpau, ffvc1vdpau I already installed libvdpau-sunxi on my debian system. The debian version I am using is 3.4.90+ (wheezy). The hardware is based on Allwinner A20. But when I play video using serial console command: mplayer video1.mp4 I observed panning/jitters on many frames of the video. The audio and video are also out of sync in the first iteration of the video. The out of sync problem happens only in the first iteration of the video; if I play the same video again, the audio-video remains in sync, but the panning/jitters are still there in the video. I tried to troubleshoot the issue with different videos/web forums, but couldn't get success. Since A20 can easily play 30 Mbps/30 fps 1080p videos, I don't understand why my hardware is not playing it smoothly. Is there any kind of specific settings that I need to look upon. Since I am quite new to A20 allwinner based development, so need a direction to fix my issue.

Can anyone help me out to solve the issue?

thanks Nav

navjotsingh07 avatar Jun 27 '16 15:06 navjotsingh07

logs? Do known-to-work videos play? Did you try mpv? Which kernel version are you using? The linux-sunxi one? How is your display output configured? 50Hz, 60Hz?

Regards rellla

rellla avatar Jun 27 '16 18:06 rellla

Hi rellla thanks for the reply. I am using kernel version 3.4.90+ debian wheezy. I set the display output frequency to 1080p 60 Hz in my script.bin file by selecting HDMI as output mode.

My mplayer logs: test.txt

I didn't tried the mpv yet. Will it makes any difference or is it better than mplayer??

thanks Nav

navjotsingh07 avatar Jun 27 '16 19:06 navjotsingh07

What libvdpau-sunxi version do you use? I meant, did you build your kernel yourself? And do other videos work, for example the ones from here http://linux-sunxi.org/Cedrus/libvdpau-sunxi#Playing_video ? Are you working on any prebuilt distro/image? I don't know of mplayer and his versions. I always use mpv.

rellla avatar Jun 27 '16 19:06 rellla

I am using kernel image build by olimex.com. I followed the steps on olimex and made the kernel for my board. I don't know how to check libvdpau-sunxi version??

navjotsingh07 avatar Jun 27 '16 19:06 navjotsingh07

Link?

rellla avatar Jun 27 '16 19:06 rellla

https://github.com/OLIMEX/OLINUXINO/tree/master/SOFTWARE/A20/A20-build-3.4.90

navjotsingh07 avatar Jun 27 '16 19:06 navjotsingh07

And i use this link for libvdpau-sunxi installation on my board: https://github.com/linux-sunxi/libvdpau-sunxi

navjotsingh07 avatar Jun 27 '16 19:06 navjotsingh07

Kernel is not the newest one, but that should not be the issue. For libvdpau-sunxi, you are for sure using some old revision and not the recent master branch. Check that! Did you build it yourself and did you check linux-sunxi.org? And, most important question which one you still didn't answer, are other videos working, esp. the big bunny h264 video? Rellla

rellla avatar Jun 27 '16 19:06 rellla

Yes, the big buck bunny video works fine especially the 1080p/30 fps one. But in many other videos, I am facing the same issue as I discussed before. So I think its not with any of the special video, the problem is somewhere with some kind of settings or so which I don't understand. Will the libvdpau-sunxi version must be same as of the kernel version?? Because I didn't have a look at the branch version which I download for my board..

navjotsingh07 avatar Jun 27 '16 19:06 navjotsingh07

libvdpau-sunxi has nothing to do with kernel version. Go read the wiki and use a recent version. With the olimex link above I still don't know if you use some precompiled version or compiled it by yourself. I can't find any word on vdpau. The only thing I know is, it's an old version and may produce issues with certain video files. Because of the bunny video, it's proved, that hardware acceleration basically works. So, check that first by reading the wiki and building libvdpau-sunxi, than let's go on searching for the issue. Rellla

rellla avatar Jun 27 '16 20:06 rellla

ok let me find out the recent version of the kernel. then will let you know about this. thanks for your help Nav

navjotsingh07 avatar Jun 27 '16 20:06 navjotsingh07

Not of the kernel, libvdpau-sunxi!! You don't need to find out the version. It's too old, because the log of recent ones is different! Read the wiki and build it yourself. Read, otherwise you won't succeed. Rellla

rellla avatar Jun 27 '16 20:06 rellla

Ok, I will work on the libvdpau-sunxi new build. Could you please give me the link to start reading for the new build? thanks

navjotsingh07 avatar Jun 27 '16 20:06 navjotsingh07

Hi Rellla I worked on libvdpau-sunxi new build and tried to play video using mplayer again but it makes no difference with the panning/jittering issue. I am enclosing the mplayer logs: logs.txt

If you want I can post a screenshot of the video so u can have better understanding of what I am trying to explain? And then you might suggest something important which I missed in my built.

thanks Nav

navjotsingh07 avatar Jun 29 '16 20:06 navjotsingh07

How did you build libvdpau-sunxi? You are still using an old Version.

rellla avatar Jun 29 '16 21:06 rellla

I used this link to build libvdpau-sunxi: https://github.com/rellla/libvdpau-sunxi

Remember I am using mplayer not mpv to play my video, so may be thats why the logs are different. My logs indicate the version: [VDPAU SUNXI] VE version 0x1623 opened. Does this correctly indicate the version? If so can you let me know what the version number should be?

I am now trying to build with mpv so that we both are on same page. thanks

navjotsingh07 avatar Jun 30 '16 14:06 navjotsingh07

Hi Rella,

i appreciate all your assistance. If possible can I send you the video I am having issues with and give the the time (in seconds) that the video anomaly occurs? I can find a place to post so that you can download.

I would be really interested to see if the video plays perfectly without (apparent frame loss) on your system.

To be clear most videos have acceptable playback on my system but any video with full screen panning I get what looks like frame skipping and the playback is not smooth. Looks like the video is jumping frames.

Let me know if you think sending the video would be helpful.

navjotsingh07 avatar Jun 30 '16 15:06 navjotsingh07

First you said, you are using https://github.com/linux-sunxi/libvdpau-sunxi, now you say https://github.com/rellla/libvdpau-sunxi ?? Try either https://github.com/linux-sunxi/libvdpau-sunxi/tree/master or maybe https://github.com/linux-sunxi/libvdpau-sunxi/tree/dev Meaning master or dev branch. Then you should have sth. like the following in the logs: [VDPAU SUNXI] VE version 0x1623 opened [VDPAU SUNXI] OSD enabled, using G2D [VDPAU SUNXI] Using display v1.0 (<- if using the dev branch)

If you don't see at least the osd enabled/disabled line, you are not using a recent version. Once you are feeling, you are using a recent version of libvdpau-sunxi, post your syslog and dmesg.

You can link your sample file somewhere, maybe someone else can try. I have no machine running with MPV online atm and can't try. I can just give you the theory. And it should make no difference if you using MPV or mplayer if it basically works.

rellla avatar Jun 30 '16 19:06 rellla

Hey Rellla

One question I believe I am using the latest version. However I will defer to you. One question the line [VDPAU SUNXI] OSD enabled, using G2D does not show up on my console output but is guaranteed due to not using the latest libvdpau-sunxi drivers OR is this due to the fact that I am using the 3.4.90+ kernel and not using Jessie version? Is there another way to determine the driver version I am using to 100% confirm my driver is older?

Since I am not 100% sure that my driver is older (although I trust your expertise) I will not post syslog and dmesg until we can figure out the driver version.

I have rebuilt with the libvdpau driver from the link you confirmed and still do not see this line in my console output.

[VDPAU SUNXI] OSD enabled, using G2D

Please let me know if there is another way to confirm the driver?

Nav

navjotsingh07 avatar Jul 05 '16 14:07 navjotsingh07

Hi nav, this all has nothing to do with the kernel imho.

If you follow https://github.com/linux-sunxi/libvdpau-sunxi/blob/master/device.c#L54 and following, you can conclude, that you have to see exactly one debug line, that comments about OSD.

If you use the dev branch, you have the debug line about the display version, too. https://github.com/linux-sunxi/libvdpau-sunxi/blob/dev/device.c#L86

That is the reason, why i think, you are using an old version. How do you build libvdpau-sunxi? What are the exact steps on console to get the libvdpau-sunxi.so.1 into the right directory?

rellla

rellla avatar Jul 05 '16 15:07 rellla

Please let me know if there is another way to confirm the driver?

Just add some debugging prints, and you will know for sure that libvdpau-sunxi had been really built by you and loaded correctly.

ssvb avatar Jul 05 '16 15:07 ssvb

Let me tell you the steps i followed:

For the prerequisites:

libvdpau >= 1.1 libcedrus (https://github.com/linux-sunxi/libcedrus) pixman (http://www.pixman.org) libcsptr (https://github.com/Snaipe/libcsptr) gcc >= 4.6

the libvdpau 1.1. is already been installed and verified by me using: ldconfig -p | grep libvdpau It shows: libvdpau.so.1 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libvdpau.so.1 libvdpau.so.1 (libc6,hard-float) => /usr/local/lib/libvdpau.so.1 libvdpau.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libvdpau.so libvdpau.so (libc6,hard-float) => /usr/local/lib/libvdpau.so

Then for libcedrus: I followed the same link https://github.com/linux-sunxi/libcedrus and my ldconfig -p | grep libcedrus shows: libcedrus.so.1 (libc6,hard-float) => /usr/local/lib/libcedrus.so.1 libcedrus.so (libc6,hard-float) => /usr/local/lib/libcedrus.so

Then i build necessary dependencies: apt-get install gettext xserver-xorg-dev xserver-xorg xutils-dev
psmisc libxcb-screensaver0-dev libxcb-randr0-dev libxcb-dpms0-dev libxcb-icccm4-dev
libx11-xcb-dev libxcb-ewmh-dev libasound2-dev libxcb-xv0 libxcb-keysyms1 libxcb-util0
libxcb-shm0 libfreetype6-dev libfontconfig1-dev alsa-base libcap-dev libjpeg62-turbo-dev
x11-xserver-utils liblockdev1-dev libudev-dev libxrandr-dev python-dev swig libpixman-1-0 libpixman-1-dev

My ldconfig -p | grep libpixman shows: libpixman-1.so.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libpixman-1.so.0 libpixman-1.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libpixman-1.so

gcc 4.6 is already been there in my file system.

For libcsptr: cd /usr/local/src/ git clone https://github.com/Snaipe/libcsptr.git cd libcsptr mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. make make install

Then i follow: git clone https://github.com/rellla/libvdpau-sunxi.git cd libvdpau-sunxi make make install

I found ldconfig -p | grep libvdpau_sunxi.so.1 shows libvdpau_sunxi.so.1 in directory /usr/local/lib/vdpau .

Is it the right way to check the installed libvdpau-sunxi??

These are the steps I followed to install libvdpau-sunxi. I am not sure if these are correct steps or not??

thanks Nav

navjotsingh07 avatar Jul 05 '16 15:07 navjotsingh07

Seems ok so far. Please test this branch https://github.com/rellla/libvdpau-sunxi/tree/navtemp

You should see "Hello nav!" when libvdpau is opened.

rellla

rellla avatar Jul 05 '16 16:07 rellla

Hi Rellla thanks for assisting me with test libvdpau-sunxi.

these are my logs afetr installing libvdpau-sunxi from the branch u want me to test:

mpv player logs:

Compiled without libass.
There will be no OSD and no text subtitles.
Playing: /root/seven10.mp4
 (+) Video --vid=1 (*) (h264)
 (+) Audio --aid=1 --alang=eng (*) (aac)
[VDPAU SUNXI] VE version 0x1623 opened.
[VDPAU SUNXI] vdp_output_surface_put_bits_native called but unimplemented!
AO: [alsa] 48000Hz stereo 2ch float
Using hardware decoding (vdpau).
VO: [vdpau] 1920x1<4>[DISP] layer allocated: 0,102
[  699.659928] [DISP] layer allocated: 0,102
080 vdpau
[VDPAU SUNXI] Presentation time not supported
AV: 00:00:41 / 00:03:48 (18%) A-V:  0.001

mplayer logs:

MPlayer2 UNKNOWN (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing video1.mp4.
Detected file format: QuickTime/MPEG-4/Motion JPEG 2000 format (libavformat)
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang eng
VIDEO:  [H264]  1920x1080  24bpp  29.970 fps  10032.1 kbps (1224.6 kbyte/s)
Clip info:
 major_brand: mp42
 minor_version: 0
 compatible_brands: mp42mp41
 creation_time: 2016-06-01 20:45:15
Load subtitles in .
[VDPAU SUNXI] VE version 0x1623 opened.

Forced video codec: ffmpeg12vdpau
Forced video codec: ffh264vdpau
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264vdpau] vfm: ffmpeg (FFmpeg H.264 (VDPAU))
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 189.4 kbit/12.33% (ratio: 23671->192000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
Starting playback...
Movie-Aspect is undefined - no prescaling applied.
VO: [vdpau] 1920x1080 => 1920x1080 H.264 VDPAU acceleration  [fs]
<4>[DISP] layer allocated: 0,102
[  538.069327] [DISP] layer allocated: 0,102
[vdpau] Got display refresh rate 60.000 Hz.
[vdpau] If that value looks wrong give the -vo vdpau:fps=X suboption manually.
[VDPAU SUNXI] Presentation time not supported
A: 101.6 V: 101.7 A-V:  0.000 ct: -0.000   0/  0 54%  9%  7.7% 0 0

But I don't see "Hello nav!" anywhere?? Is libvdpau opens when mpv or mplayer starts??

thanks Nav

navjotsingh07 avatar Jul 06 '16 13:07 navjotsingh07

I can't help but wonder if @navjotsingh07 is actually installing his self-compiled versions of the libraries in a different location than the libraries he already had in his system, thereby having multiple versions of the libraries installed and the applications using the old ones...

WereCatf avatar Jul 06 '16 15:07 WereCatf

@navjotsingh07 definitely uses some old version. You may build it right and do a "make install" but it's not used. You have to see the following with the said branch:

[VDPAU SUNXI] VE version 0x1623 opened [VDPAU SUNXI] Hello nav!

Do a find / -name libvdpau* and tell us the output...

rellla avatar Jul 06 '16 15:07 rellla

@rellla and @WereCatf

The output of find / -name libvdpau* :

/usr/share/doc/libvdpau-dev /usr/share/doc/libvdpau1

/usr/local/lib/vdpau/libvdpau_trace.so /usr/local/lib/vdpau/libvdpau_trace.la /usr/local/lib/vdpau/libvdpau_sunxi.so /usr/local/lib/vdpau/libvdpau_trace.so.1.0.0 /usr/local/lib/vdpau/libvdpau_trace.so.1 /usr/local/lib/vdpau/libvdpau_sunxi.so.1 /usr/local/lib/libvdpau.so /usr/local/lib/libvdpau.so.1.0.0 /usr/local/lib/libvdpau.la /usr/local/lib/libvdpau.so.1

/usr/lib/arm-linux-gnueabihf/vdpau/libvdpau_trace.so.1.0.0 /usr/lib/arm-linux-gnueabihf/vdpau/libvdpau_trace.so.1 /usr/lib/arm-linux-gnueabihf/vdpau/libvdpau_sunxi.so.1 /usr/lib/arm-linux-gnueabihf/libvdpau.so /usr/lib/arm-linux-gnueabihf/libvdpau.so.1.0.0 /usr/lib/arm-linux-gnueabihf/libvdpau.so.1

/var/cache/apt/archives/libvdpau-dev_0.4.1-7_armhf.deb /var/lib/dpkg/info/libvdpau1:armhf.symbols /var/lib/dpkg/info/libvdpau1:armhf.postinst /var/lib/dpkg/info/libvdpau1:armhf.list /var/lib/dpkg/info/libvdpau-dev:armhf.list /var/lib/dpkg/info/libvdpau1:armhf.postrm /var/lib/dpkg/info/libvdpau1:armhf.conffiles /var/lib/dpkg/info/libvdpau1:armhf.shlibs /var/lib/dpkg/info/libvdpau1:armhf.md5sums /var/lib/dpkg/info/libvdpau-dev:armhf.md5sums

navjotsingh07 avatar Jul 06 '16 16:07 navjotsingh07

The one which are in directory /usr/lib/arm-linux-gnueabihf/ are of date Aug 2012. I think mplayer or mpv picks the libvdpau-sinxi and libvdpau from this directory, thats why its not showing up the logs that Rellla was talking about. Now how I can un-install the old version and put the new version??

navjotsingh07 avatar Jul 06 '16 16:07 navjotsingh07

Just delete them. Maybe do a ldconfig afterwards.

rellla avatar Jul 06 '16 18:07 rellla

Hi

I replace them with the new drivers and now I am getting the mplayer logs as:

In the first iteration of the a looping video, the logs are:

MPlayer2 UNKNOWN (C) 2000-2012 MPlayer Team mplayer: could not connect to socket mplayer: No such file or directory Failed to open LIRC support. You will not be able to use your remote control.

Playing seven10.mp4. Detected file format: QuickTime/MPEG-4/Motion JPEG 2000 format (libavformat) [lavf] stream 0: video (h264), -vid 0 [lavf] stream 1: audio (aac), -aid 0, -alang eng VIDEO: [H264] 1920x1080 24bpp 29.970 fps 10032.1 kbps (1224.6 kbyte/s) Clip info: major_brand: mp42 minor_version: 0 compatible_brands: mp42mp41 creation_time: 2016-06-01 20:45:15 Load subtitles in . rc = 0 result == 0 is triggered lednovideoplaying: pattern = 2 interval = 1 [VDPAU SUNXI] VE version 0x0000 opened [VDPAU SUNXI] OSD enabled, using G2D!

Forced video codec: ffmpeg12vdpau
Forced video codec: ffh264vdpau
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 189.4 kbit/12.33% (ratio: 23671->192000)
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample) Starting playback... Movie-Aspect is undefined - no prescaling applied. VO: [vdpau] 1920x1080 => 1920x1080 H.264 VDPAU acceleration [fs] <4>[DISP] layer allocated: 0,102 [ 23.274683] [DISP] layer allocated: 0,102 <4>[DISP] layer allocated: 0,103 [ 23.281793] [DISP] layer allocated: 0,103 [vdpau] Got display refresh rate 60.000 Hz. [vdpau] If that value looks wrong give the -vo vdpau:fps=X suboption manually.

In the 2nd iteration of loopvideo, the logs are:

MPlayer2 UNKNOWN (C) 2000-2012 MPlayer Team mplayer: could not connect to socket mplayer: No such file or directory Failed to open LIRC support. You will not be able to use your remote control.

Playing seven10.mp4. Detected file format: QuickTime/MPEG-4/Motion JPEG 2000 format (libavformat) [lavf] stream 0: video (h264), -vid 0 [lavf] stream 1: audio (aac), -aid 0, -alang eng VIDEO: [H264] 1920x1080 24bpp 29.970 fps 10032.1 kbps (1224.6 kbyte/s) Clip info: major_brand: mp42 minor_version: 0 compatible_brands: mp42mp41 creation_time: 2016-06-01 20:45:15 Load subtitles in . [VDPAU SUNXI] VE version 0x1623 opened [VDPAU SUNXI] OSD enabled, using G2D!

Forced video codec: ffmpeg12vdpau Forced video codec: ffh264vdpau Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders AUDIO: 48000 Hz, 2 ch, s16le, 189.4 kbit/12.33% (ratio: 23671->192000) AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample) Starting playback... Movie-Aspect is undefined - no prescaling applied. VO: [vdpau] 1920x1080 => 1920x1080 H.264 VDPAU acceleration [fs] 4>[DISP] layer allocated: 0,102 [ 63.334667] [DISP] layer allocated: 0,102 [vdpau] Got display refresh rate 60.000 Hz. [vdpau] If that value looks wrong give the -vo vdpau:fps=X suboption manually

Why it is showing VE version 0x0000 opened in the first iteration and VE version 0x1623 opened in second iteration??

And there is no difference in Video Playback, even I tried MPV player also. The Video panning/jitters still observed whenever I am using a video that has fullscreen panning and also when video bit rate is 20MB/s+

Now what to do to make the playback smooth?? Suggest something now.

thanks Nav

navjotsingh07 avatar Jul 06 '16 19:07 navjotsingh07