Menu

#1004 Rotation does not work when output is set to gpu or gpu-next, only direct3d

smplayer
open
nobody
9
2024-04-13
2024-01-23
cheater
No

Rotation works under direct3d but not under gpu/gpu-next which is bad because high bitrate videos require gpu decoding. Under gpu/gpu-next nothing happens when I try to rotate. The SMPlayer log produces this sort of messages when I use the keybinding I set for rotation:

[09:43:57:587] BaseGuiPlus::eventFilter: key: QKeySequence("D")
[09:43:57:588] MyActionGroup::itemTriggered: 'rotate_clockwise'
[09:43:57:591] MyActionGroup::itemTriggered: ID: 1
[09:43:57:593] Core::changeRotate: 1
[09:43:57:595] MPVProcess::changeVF: "rotate" false
[09:43:57:597] MPVProcess::sendCommand: "vf remove \"lavfi=[hflip,vflip]\""
[09:43:57:599] MPVProcess::changeVF: "rotate" true
[09:43:57:601] MPVProcess::sendCommand: "vf add \"lavfi=[rotate=PI/2:ih:iw]\""
[09:43:57:930] MPVProcess::parseLine: "[ffmpeg] Impossible to convert between the formats supported by the filter 'mpv_src_in0' and the filter 'auto_scale_0'"
[09:43:57:934] MPVProcess::parseLine: "[lavfi] failed to configure the filter graph"
[09:43:57:936] MPVProcess::parseLine: "Disabling filter lavfi.00 because it has failed."

I've checked and opening the mpv.exe that's supplied with SMPlayer directly and setting a keybinding in input conf to

r cycle-values video-rotate "90" "180" "270" "0"

makes mpv able to rotate correctly.

Could you please be nice enough to fix it pretty quickly as this is really killing SMPlayer usage for me? I would appreciate this a lot.

Discussion

  • Ricardo Villalba

    I can't reproduce this problem in my computer, using smplayer 23.12.
    Do you have the problem with all videos?

     
    • cheater

      cheater - 2024-01-24

      Thanks for the quick reply. Yes, the problem is with all videos. I believe the fact that you can't reproduce it might have to do with the fact that i'm on an AMD APU and you might not be.

      When I removed smplayer.ini, it would let me rotate, but that's only because it wasn't doing hardware decoding, so the framerate was like 2 fps. So I set gpu-next as the video output, turned on HW decoding, and did the following settings:

      performance/hardware decoding setting: d3d11va is the only one that gives me full framerate on high bitrate video. (I believe Auto also defaults to that). d3d11va, Auto (safe) and Auto give me full fps and don't let me rotate.

      d3d11va-copy doesn't give me full framerate but lets me rotate. some other settings (None, auto-copy, auto-copy-safe, dxva2-copy, nvdec, nvdec-copy, cuda, cuda-copy, crystalhd) also let me rotate but they also don't give me full framerate.

      dxva2 gives me full framerate and doesn't let me rotate, and the whole display is green and pink.

      i attached smplayer.ini (i removed some paths from it, MRU, toolbar state binary string, etc, but everything related to perf should still be the same as I normally use)

       
  • Ricardo Villalba

    Ok, I see.

    If I run mpv directly with the rotate filter and dxva2, I also get that error:

    mpv.exe video.mp4 --vo=gpu-next --hwdec=dxva2 --vf-add=lavfi=[rotate=PI/2:ih:iw]
     (+) Video --vid=1 (*) (h264 1280x720 25.000fps)
     (+) Audio --aid=1 --alang=eng (*) (aac 2ch 44100Hz)
    Using hardware decoding (dxva2).
    [ffmpeg] Impossible to convert between the formats supported by the filter 'mpv_src_in0' and the filter 'auto_scale_0'
    [lavfi] failed to configure the filter graph
    Disabling filter lavfi.00 because it has failed.
    AO: [wasapi] 48000Hz stereo 2ch float
    VO: [gpu-next] 1280x720 dxva2_vld[nv12]
    AV: 00:00:02 / 00:04:03 (1%) A-V:  0.000
    
    Exiting... (Quit)
    

    So this is either a bug in mpv or a limitation when using dxva2 and the rotate filter. This is something I can't fix.
    You can try to report the problem to the mpv developers:
    https://github.com/mpv-player/mpv/issues

     
  • cheater

    cheater - 2024-01-26

    ok, but the original post mentions video-rotate and not rotate. when i was looking up how to do this on mpv standalone (i didn't know before) people repeatedly said that video-rotate should be used and not rotate. so why not use video-rotate in SMPlayer?

     
  • cheater

    cheater - 2024-01-26

    so specifically here's the comparison:

    • using a filter - rotation doesn't work, video is still horizontal:
    /c/Program Files/SMPlayer/mpv
    $ ./mpv.exe F:\test.mp4 --vo=gpu-next --hwdec=dxva2 --vf-add=lavfi=[rotate=PI/2:ih:iw]
     (+) Video --vid=1 (*) (h264 1560x892 23.976fps)
     (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
    AO: [wasapi] 48000Hz stereo 2ch float
    Using hardware decoding (dxva2).
    [ffmpeg] Impossible to convert between the formats supported by the filter 'mpv_src_in0' and the filter 'auto_scale_0'
    [lavfi] failed to configure the filter graph
    Disabling filter lavfi.00 because it has failed.
    VO: [gpu-next] 1560x892 dxva2_vld[nv12]
    AV: 00:00:02 / 00:02:17 (2%) A-V:  0.000
    
    Exiting... (Quit)
    
    • using video-rotate - rotation works, video is now vertical:
    /c/Program Files/SMPlayer/mpv
    $ ./mpv.exe F:\test.mp4 --vo=gpu-next --hwdec=dxva2 --video-rotate=90
     (+) Video --vid=1 (*) (h264 1560x892 23.976fps)
     (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
    Using hardware decoding (dxva2).
    AO: [wasapi] 48000Hz stereo 2ch float
    VO: [gpu-next] 1560x892 dxva2_vld[nv12]
    AV: 00:00:01 / 00:02:17 (1%) A-V:  0.000
    
    Exiting... (Quit)
    

    so one important thing would be to figure out how to change the value of video-rotate without restarting mpv. i don't really know how SMPlayer communicates with mpv, but I guess is it's via a socket, so I guess you'd send a socket command.

     
  • cheater

    cheater - 2024-01-26

    (bear in mind that the example in OP shows that video-rotate can be changed during playback, in that case by using a key binding)

     
  • Ricardo Villalba

    Using video-rotate within smplayer has some problems such as not maintaining the aspect ratio so the image it's shown distorted. I think it's not worth it to implement it.

    You can always pass the option --video-rotate in preferences -> advanced -> options for mplayer/mpv.

     
    • cheater

      cheater - 2024-02-01

      hey bud, even though you've had problems implementing it in the past, would you mind taking another look at it? the way you're doing things in SMPlayer right now really is cumbersome. like eg i can only have video equalizer (only works in gpu) or rotation (only works in direct3d).

       
  • cheater

    cheater - 2024-01-26

    "not maintaining the aspect ratio" but you should be able to calculate the aspect ratio yourself. why is that a problem?

    "You can always pass the option --video-rotate in preferences -> advanced -> options for mplayer/mpv."

    thanks, but that doesn't work. i need to be able to rotate the video as it is playing, using keyboard bindings.

     
  • cheater

    cheater - 2024-01-27

    idk what gui toolkit you're using, but i imagine that when you display the image in smplayer you just take the bitmap from mpv and apply it to a rectangle canvas that's part of the smplayer window. you'll have to resize that canvas depending on the size of the image coming in - but that should be the extent of it, i believe.

     
  • cheater

    cheater - 2024-02-12

    hey bud, can you please work on this. I get it that you can't be bothered, but this is a real problem

     
    • Ricardo Villalba

      Check if this works for you:
      In preferences -> advanced -> mplayer/mpv, type this in the video filters field:
      format=fmt=yuv420p

       
      • ooofest

        ooofest - 2024-04-13

        That actually works when using gpu with MPV, thanks.

         

Log in to post a comment.