[Cin] more complete 10bit vaapi encode patches

Terje J. Hanssen terjejhanssen at gmail.com
Fri Nov 15 23:02:30 CET 2024




Den 15.11.2024 22:28, skrev Andrew Randrianasulu:
>
>
> On Sat, Nov 16, 2024 at 12:13 AM Terje J. Hanssen 
> <terjejhanssen at gmail.com> wrote:
>
>
>
>
>     Den 15.11.2024 21:14, skrev Andrew Randrianasulu:
>>
>>
>>     On Fri, Nov 15, 2024 at 11:02 PM Terje J. Hanssen
>>     <terjejhanssen at gmail.com> wrote:
>>
>>
>>         Den 15.11.2024 17:24, skrev Andrew Randrianasulu via Cin:
>>         > Hopefully you can just put "cin_pix_fmt=p010le" in profile
>>         and it will
>>         > be respected
>>         >
>>         > Terje, you only need to apply second patch on top of that
>>         you already
>>         > have.
>>         >
>>         >
>>         I applied the second patch and recompiled.
>>
>>         I started Cingg the usual way without enviroment variable
>>
>>         bin/cin
>>
>>         Which "profile" and how do you mean?
>>
>>         I tried the generic hevc_vaapi.mp4 compression/preset
>>         and added
>>
>>         cin_pix_fmt=p010le
>>
>>         It rendered yuv420p
>>
>>
>>     strange, it worked for me:
>>
>>      bash-5.1$ bin/cin
>>     Cinelerra Infinity - built: Nov 15 2024 10:55:42
>>     git://git.cinelerra-gg.org/goodguy/cinelerra.git
>>     <http://git.cinelerra-gg.org/goodguy/cinelerra.git>
>>     (c) 2006-2019 Heroine Virtual Ltd. by Adam Williams
>>     2007-2020 mods for Cinelerra-GG by W.P.Morrow aka goodguy
>>     2003-2017 mods for Cinelerra-CV by CinelerraCV team
>>     2015-2024 mods for Cinelerra-GG by Cinelerra-GG team
>>
>>     Libav version: Lavc61.3.100
>>
>>     Cinelerra is free software, covered by the GNU General Public
>>     License,
>>     and you are welcome to change it and/or distribute copies of it under
>>     certain conditions. There is absolutely no warranty for Cinelerra.
>>
>>     RenderFarmClient::main_loop: client started
>>     [AVHWDeviceContext @ 0xee693980] Trying to use DRM render node
>>     for device 0.
>>     [AVHWDeviceContext @ 0xee693980] libva: VA-API version 1.19.0
>>     [AVHWDeviceContext @ 0xee693980] libva: Trying to open
>>     /usr/lib/dri/nouveau_drv_video.so
>>     [AVHWDeviceContext @ 0xee693980] libva: Found init function
>>     __vaDriverInit_1_19
>>     [AVHWDeviceContext @ 0xee693980] libva: va_openDriver() returns 0
>>     [AVHWDeviceContext @ 0xee693980] Initialised VAAPI connection:
>>     version 1.19
>>     [AVHWDeviceContext @ 0xee693980] Format 0x3231564e -> nv12.
>>     [AVHWDeviceContext @ 0xee693980] Format 0x30313050 -> p010le.
>>     [AVHWDeviceContext @ 0xee693980] Format 0x36313050 -> unknown.
>>     [AVHWDeviceContext @ 0xee693980] Format 0x30323449 -> yuv420p.
>>     [AVHWDeviceContext @ 0xee693980] Format 0x32315659 -> yuv420p.
>>     [AVHWDeviceContext @ 0xee693980] Format 0x56595559 -> unknown.
>>     [AVHWDeviceContext @ 0xee693980] Format 0x32595559 -> yuyv422.
>>     [AVHWDeviceContext @ 0xee693980] Format 0x59565955 -> uyvy422.
>>     [AVHWDeviceContext @ 0xee693980] Format 0x41524742 -> bgra.
>>     [AVHWDeviceContext @ 0xee693980] Format 0x41424752 -> rgba.
>>     [AVHWDeviceContext @ 0xee693980] Format 0x58524742 -> bgr0.
>>     [AVHWDeviceContext @ 0xee693980] Format 0x58424752 -> rgb0.
>>     [AVHWDeviceContext @ 0xee693980] VAAPI driver: Mesa Gallium
>>     driver 22.1.7 for NV106.
>>     [AVHWDeviceContext @ 0xee693980] Driver not found in known
>>     nonstandard list, using standard behaviour.
>>     [AVHWFramesContext @ 0xd99c30c0] Created surface 0x1.
>>     [AVHWFramesContext @ 0xd99c30c0] Direct mapping possible.
>>     [hevc_vaapi @ 0xee6c6080] Input surface format is p010le.
>>     [hevc_vaapi @ 0xee6c6080] Compatible profile VAProfileHEVCMain10
>>     (18) is not supported by driver.
>>     [hevc_vaapi @ 0xee6c6080] Compatible profile VAProfileHEVCMain10
>>     (18) is not supported by driver.
>>     [hevc_vaapi @ 0xee6c6080] No usable encoding profile found.
>>     FFMPEG::open_encoder  err: Function not implemented
>>     int FFMPEG::open_encoder(const char*, const char*):
>>     open failed hevc_vaapi:/dev/shm/vaapi-test.mp4
>>     Render::render_single: Session finished.
>>     Total excess of backups: -50
>>     [AVIOContext @ 0xd577ae80] Statistics: 196608 bytes read, 0 seeks
>>     [AVIOContext @ 0xef844580] Statistics: 196608 bytes read, 0 seeks
>>     [AVIOContext @ 0xd327f180] Statistics: 294912 bytes read, 0 seeks
>>     [AVIOContext @ 0xd547f980] Statistics: 196608 bytes read, 0 seeks
>>     [AVIOContext @ 0xd59ffec0] Statistics: 18991217 bytes read, 18 seeks
>>     [AVIOContext @ 0xe4e09640] Statistics: 196608 bytes read, 0 seeks
>>     Session time: 0:00:46
>>     Cpu time: user: 0:00:37.109 sys: 0:00:02.595
>>
>>     you changed preset to something else and back to hevc_vaapi.mp4 ?
>>
>>     btw my file bin/ffmpeg/video/hevc_vaapi.mp4 looks like this:
>>
>>     mp4 hevc_vaapi
>>     cin_hw_dev=vaapi
>>     cin_pix_fmt=p010le
>>
>
>     I copied hevc_vaapi.mp4 together with my own presets back from
>     backup after recompiling
>
>     hevc_vaapi.mp4
>
>         mp4 hevc_vaapi
>         cin_hw_dev=vaapi
>
>
>     I the Render compression window I added the last line
>
>         cin_hw_dev=vaapi
>         cin_pix_fmt=p010le
>
>
>
> I do not think  this will work with vaapi especially due to it 
> advertizing only
> vaapi pixel format and me hacking on top of that.
>
>
>     ** rendered 1780 frames in 41.333 secs, 43.065 fps
>
>     ffprobe -hide_banner hd01_hevc_vaapi_10b420.mp4
>       Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568),
>     yuv420p(tv, bt709/unknown/unknown, top coded first (swapped)),
>     1920x1080 [SAR 1:1 DAR 16:9], 11377 kb/s, 25 fps, 25 tbr, 12800
>     tbn (default)
>
>     Tried now also to edit the preset hevc_vaapi.mp4 and added the
>     last line on beforehand:
>
>         mp4 hevc_vaapi
>         cin_hw_dev=vaapi
>         cin_pix_fmt=p010le
>
>     But the same result: yuv420p
>
>
>
> you visited window called Cinelerra: video preset  and changed 
> Compression  to another preset and back as I suggested?


Obviously the cash could not have been fully reset, because now it workes 😎

I customized and added this line also to my dedicated hevc_vaapi presets 
and tested they also worked:

hevc_vaapi_8b420.mp4

    mp4 hevc_vaapi
    cin_hw_dev=vaapi
    cin_pix_fmt=nv12
    format=nv12,hwupload
    profile=main
    # global_quality=22


ffprobe -hide_banner hd01_hevc_vaapi_8b420.mp4
   Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), 
yuv420p(tv, bt709/unknown/unknown, top coded first (swapped)), 1920x1080 
[SAR 1:1 DAR 16:9], 11377 kb/s, 25 fps, 25 tbr, 12800 tbn (default)


hevc_vaapi_10b420.mp4

    mp4 hevc_vaapi
    cin_hw_dev=vaapi
    cin_pix_fmt=p010le
    format=p010le,hwupload
    profile=main10
    # global_quality=22

ffprobe -hide_banner hd01_hevc_vaapi_10b420.mp4
   Stream #0:0[0x1](und): Video: hevc (Main 10) (hev1 / 0x31766568), 
yuv420p10le(tv, bt709/unknown/unknown, top coded first (swapped)), 
1920x1080 [SAR 1:1 DAR 16:9], 11752 kb/s, 25 fps, 25 tbr, 12800 tbn 
(default)



hevc_vaapi_10b422.mp4

    mp4 hevc_vaapi
    cin_hw_dev=vaapi
    cin_pix_fmt=y210le
    format=y210le,hwupload
    profile=rext
    # global_quality=22

ffprobe -hide_banner hd01_hevc_vaapi_10b422.mp4
   Stream #0:0[0x1](und): Video: hevc (Rext) (hev1 / 0x31766568), 
yuv422p10le(tv, bt709/unknown/unknown, top coded first (swapped)), 
1920x1080 [SAR 1:1 DAR 16:9], 13432 kb/s, 25 fps, 25 tbr, 12800 tbn 
(default)



Attached here.


>
>     --------------
>
>     Top of my git log for verification:
>
>     commit 623e2ac7f77d0e5d1359f12d70e34b8c93489686
>     Author: Andrew Randrianasulu <randrianasulu at gmail.com>
>     <mailto:randrianasulu at gmail.com>
>     Date:   Fri Nov 15 19:21:11 2024 +0300
>
>         Hopefully wire up various cin_pix_fmt for vaapi encoder
>
>     commit 4d42448cc128d7d18e34eb97d4234e73b9acb360
>     Author: Andrew Randrianasulu <randrianasulu at gmail.com>
>     <mailto:randrianasulu at gmail.com>
>     Date:   Thu Nov 14 16:18:24 2024 +0300
>
>         yet another 10bit attempt
>
>     commit e5a5a6da907dbcd40d8612bdbfeea1a2a0ae6cc8
>     Author: Andrew Randrianasulu <randrianasulu at gmail.com>
>     <mailto:randrianasulu at gmail.com>
>     Date:   Fri Oct 18 10:07:33 2024 +0300
>
>         Add onevpl support to build system
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20241115/9c5a52ac/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hevc_qsv_8b420.mp4
Type: video/mp4
Size: 94 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20241115/9c5a52ac/attachment-0003.mp4>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hevc_qsv_10b420.mp4
Type: video/mp4
Size: 78 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20241115/9c5a52ac/attachment-0004.mp4>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hevc_qsv_10b422.mp4
Type: video/mp4
Size: 74 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20241115/9c5a52ac/attachment-0005.mp4>


More information about the Cin mailing list