Giter Site home page Giter Site logo

Comments (15)

i-rinat avatar i-rinat commented on July 17, 2024 1

Current versions of VLC don't have the issue. "Fixing" commit was videolan/vlc@c61b433#diff-4e89dea6d2b66dcaac6f076da940fba2L400. Note, they started to compare surfaces geometry with coded width and height from AVCodecContext structure.

Newer VLC versions started to use another bit of VDPAU, so I've added required mockup code in e10ef7a. It doesn't work they way it should work, but should be fine anyway.

from libvdpau-va-gl.

i-rinat avatar i-rinat commented on July 17, 2024

Hi.
There is noticeable artifacts in video at about 00:00:01, perhaps video stream is broken. I've tried to play it though vaapi path in mpv and also through vdpau path with help of libvdpau-va-gl on both mplayer and mpv. And all those were fine, without lockups or error messages. It could be hardware dependent. I tested on Intel HD 4000 (embedded graphics in i7-3632qm processor).

Could you check on your hardware how

mpv --hwdec=vaapi --vo=gl  big_buck_bunny_480p_H264_AAC_25fps_1800K_short.MP4

works, please?

from libvdpau-va-gl.

vincentbernat avatar vincentbernat commented on July 17, 2024

Your command works fine for me:

mpv --hwdec=vaapi --vo=gl  big_buck_bunny_480p_H264_AAC_25fps_1800K_short.MP4
Driver 'gl' has been replaced with 'opengl'!
Playing: big_buck_bunny_480p_H264_AAC_25fps_1800K_short.MP4
 (+) Video --vid=1 (*) (h264)
 (+) Audio --aid=1 --alang=und (*) (aac)
File tags:
 Artist: created with SUPER(C).v2011.bld.49
 Comment: 14:06:42
 Title: big_buck_bunny_480p_surround-fix.avi_041.AVI.MP4
libva info: VA-API version 0.38.1
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_38
libva info: va_openDriver() returns 0
AO: [pulse] 44100Hz stereo 2ch float
Using hardware decoding (vaapi).
VO: [opengl] 854x480 vaapi
AV: 00:00:01 / 00:00:04 (27%) A-V:  0.000

from libvdpau-va-gl.

i-rinat avatar i-rinat commented on July 17, 2024

Then it's a bug in libvdpau-va-gl indeed. I'll try to dig further.

from libvdpau-va-gl.

i-rinat avatar i-rinat commented on July 17, 2024

Oh, I've tried VLC (2.2.2-3+b1, Debian testing), and now can see the same bug. Now there are higher chances to find out what's happening.

from libvdpau-va-gl.

i-rinat avatar i-rinat commented on July 17, 2024

Just to be sure. Does

mpv --hwdec=vdpau --vo=vdpau  big_buck_bunny_480p_H264_AAC_25fps_1800K_short.MP4

show video?

from libvdpau-va-gl.

vincentbernat avatar vincentbernat commented on July 17, 2024

Yes, it works too. So, this may be a bug in VLC?

from libvdpau-va-gl.

i-rinat avatar i-rinat commented on July 17, 2024

Looks like there is an issue in VLC code.
Here is trace output from vlc big_buck_bunny_480p_H264_AAC_25fps_1800K_short.MP4:

VLC media player 2.2.2 Weatherwax (revision 2.2.2-0-g6259d80)
[000000000198bdf8] pulse audio output error: PulseAudio server connection failure: Connection refused
[00000000018b3388] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[VS] Software VDPAU backend library initialized
[VS] {full} vdp_imp_device_create_x11 display=0x7f59b404aee0, screen=0
libva info: VA-API version 0.38.1
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_38
libva info: va_openDriver() returns 0
[VS] libva (version 0.38) library initialized
[VS] {part} VdpVideoSurfaceQueryCapabilities device=1, surface_chroma_type=VDP_CHROMA_TYPE_420
[VS] {part} VdpDecoderQueryCapabilities device=1, profile=VDP_DECODER_PROFILE_H264_MAIN
[VS] {full} VdpGetInformationString
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=854, height=480
[VS] {full} VdpDecoderCreate device=1, profile=VDP_DECODER_PROFILE_H264_MAIN, width=854, height=480, max_references=16
[00007f59d4c08d88] avcodec decoder: Using OpenGL/VAAPI/libswscale backend for VDPAU for hardware decoding.
[VS] {full} VdpDecoderDestroy decoder=23
[VS] {full} VdpVideoSurfaceDestroy surface=2
[VS] {full} VdpVideoSurfaceDestroy surface=3
[VS] {full} VdpVideoSurfaceDestroy surface=4
[VS] {full} VdpVideoSurfaceDestroy surface=5
[VS] {full} VdpVideoSurfaceDestroy surface=6
[VS] {full} VdpVideoSurfaceDestroy surface=7
[VS] {full} VdpVideoSurfaceDestroy surface=8
[VS] {full} VdpVideoSurfaceDestroy surface=9
[VS] {full} VdpVideoSurfaceDestroy surface=10
[VS] {full} VdpVideoSurfaceDestroy surface=11
[VS] {full} VdpVideoSurfaceDestroy surface=12
[VS] {full} VdpVideoSurfaceDestroy surface=13
[VS] {full} VdpVideoSurfaceDestroy surface=14
[VS] {full} VdpVideoSurfaceDestroy surface=15
[VS] {full} VdpVideoSurfaceDestroy surface=16
[VS] {full} VdpVideoSurfaceDestroy surface=17
[VS] {full} VdpVideoSurfaceDestroy surface=18
[VS] {full} VdpVideoSurfaceDestroy surface=19
[VS] {full} VdpVideoSurfaceDestroy surface=20
[VS] {full} VdpVideoSurfaceDestroy surface=21
[VS] {full} VdpVideoSurfaceDestroy surface=22
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {part} VdpVideoSurfaceCreate, device=1, chroma_type=VDP_CHROMA_TYPE_420, width=864, height=480
[VS] {full} VdpDecoderCreate device=1, profile=VDP_DECODER_PROFILE_H264_MAIN, width=864, height=480, max_references=16
[VS] {part} VdpDecoderRender decoder=23, target=24, picture_info=0x7f59b4f7a8c0, bitstream_buffer_count=2
[h264 @ 0x7f59d4c2a0e0] hardware accelerator failed to decode picture
[VS] {part} VdpDecoderRender decoder=23, target=25, picture_info=0x7f59b0045e80, bitstream_buffer_count=2
[h264 @ 0x7f59d4cb6740] hardware accelerator failed to decode picture
[VS] {part} VdpDecoderRender decoder=23, target=26, picture_info=0x7f59a8047920, bitstream_buffer_count=2
[h264 @ 0x7f59d4cfdea0] hardware accelerator failed to decode picture
[VS] {part} VdpDecoderRender decoder=23, target=27, picture_info=0x7f59ac048bc0, bitstream_buffer_count=2
[h264 @ 0x7f59d4d456c0] hardware accelerator failed to decode picture

So, VLC creates video surfaces, then creates decoder, then destroys decoder (id=23), then creates a new set of video surfaces and a new decoder. And then tries to use recently deleted decoder with id 23.

Here is what happens. In VLC 2.2.2 code, in the file /modules/hw/vdpau/avcodec.c there is a function Setup(), which is called at least twice. Once at initial setup, and next time for a frame decoded. First time it gets video size 854x480. Second time it gets actual frame size 864x480 (decoded frame is later cropped to get 854x480). Function detect size change, destroys decoder and creates new. But changing value of sys->context->decoder is not enough, libavcodec could save decoder resource identifier and use it later. Which, probably, the case.

It could be that previous versions of libavcodec allowed such change, but current version doesn't.

from libvdpau-va-gl.

vincentbernat avatar vincentbernat commented on July 17, 2024

Great that you found the source. Would you like me to report the bugs to VLC devs?

from libvdpau-va-gl.

i-rinat avatar i-rinat commented on July 17, 2024

I don't see similar code in VLC's master branch. Most probably they've fixed it already. But on the other hand that version tries to use VDPAU part which is not implemented in libvdpau-va-gl, so I can't be sure.

from libvdpau-va-gl.

vincentbernat avatar vincentbernat commented on July 17, 2024

I have asked one of VLC dev to have a look.

from libvdpau-va-gl.

i-rinat avatar i-rinat commented on July 17, 2024

Also found that mpv tries Constrained Baseline profile, and falls back to software decoding if profile is not available. 8c26e71 fixes that.

from libvdpau-va-gl.

vincentbernat avatar vincentbernat commented on July 17, 2024

Thanks! A release in the next weeks would be welcome (otherwise, I will use a git snapshot).

from libvdpau-va-gl.

i-rinat avatar i-rinat commented on July 17, 2024

Here it is: https://github.com/i-rinat/libvdpau-va-gl/releases/tag/v0.3.6

from libvdpau-va-gl.

vincentbernat avatar vincentbernat commented on July 17, 2024

Thanks, I did upload this new version in Debian. Let's hope they do a VLC release soon. I close this issue.

from libvdpau-va-gl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.