пт, 27 сент. 2024 г., 12:40 Terje J. Hanssen <terjejhanssen@gmail.com>:


Den 26.09.2024 01:18, skrev Andrew Randrianasulu:


On Thu, Sep 26, 2024 at 2:06 AM Terje J. Hanssen <terjejhanssen@gmail.com> wrote:


Den 25.09.2024 23:22, skrev Andrew Randrianasulu:


чт, 26 сент. 2024 г., 00:16 Terje J. Hanssen <terjejhanssen@gmail.com>:


Den 25.09.2024 21:33, skrev Andrew Randrianasulu:


ср, 25 сент. 2024 г., 18:25 Terje J. Hanssen <terjejhanssen@gmail.com>:


Den 25.09.2024 00:27, skrev Andrew Randrianasulu:
try this git patch, do not forgot to make install again, or put profiles in bin/ffmpeg/video folder manually.

# cd /home/cinelerra/cinelerra-5.1
# mv /home/terje/0001-Qsv-encoders-for-testing.patch .

# git am 0001-Qsv-encoders-for-testing.patch
Applying: Qsv encoders for testing


make install > make_install.log 2&1


make install > make_install.log 2>&1 ?

Sorry. I should cleanup all ">" with Find & Replace in my note, and oversaw here should be two of them in this  command ;(

Now make install went through without faults as I could see, but attach it by email again.

But unhappily, no success with testing Cingg Qsv Rendering.
All attempts so far breaks with the output below:
FFMPEG::open_encoder  err: Internal bug, should not have happened
int FFMPEG::open_encoder(const char*, const char*):
----------
localhost:/home/cinelerra/cinelerra-5.1 # bin/cin
Cinelerra Infinity - built: Sep 23 2024 10:31:07
----------
1)
Loaded hdv09_04.m2t
Render:
Output to file: /Videoklipp/QSV/hdv09_04_h264_qsv.mp4
File format: FFMPEG-mp4
Compression: h264_qsv.mp4
Pixels: qsv

libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_21
libva info: va_openDriver() returns 0
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_21
libva info: va_openDriver() returns 0

FFMPEG::open_encoder  err: Internal bug, should not have happened
int FFMPEG::open_encoder(const char*, const char*):
open failed h264_qsv:/Videoklipp/QSV/hdv09_04_h264_qsv.mp4
Render::render_single: Session finished.
--------------
2a)
Loaded hdv09_04.m2t
Render:
Output to file: /Videoklipp/QSV/hdv09_04_h265_qsv.mp4
File format: FFMPEG-mp4

Compression: h265_qsv.mp4
Pixels: qsv

[hevc_qsv encoder @ 0x7f44e0d0bd80] [Eval @ 0x7f44e57eb6f0] Undefined constant or missing '(' in 'high'
[hevc_qsv encoder @ 0x7f44e0d0bd80] Unable to parse option value "high"
[hevc_qsv encoder @ 0x7f44e0d0bd80] Error setting option profile to value high.
FFMPEG::open_encoder  err: Invalid argument
int FFMPEG::open_encoder(const char*, const char*):
open failed hevc_qsv:/Videoklipp/QSV/hdv09_04_h265_qsv.mp4
Render::render_single: Session finished.

# profile=high
Pixels: qsv (yuv420 isn't available)

Didn't render:
FFMPEG::open_encoder  err: Internal bug, should not have happened
int FFMPEG::open_encoder(const char*, const char*):
open failed hevc_qsv:/Videoklipp/QSV/hdv09_04_h265_qsv.mp4
Render::render_single: Session finished.



----------------
2b)
Compression: h265_qsv.mp4
Pixels: p010le

[hevc_qsv encoder @ 0x7f93dcdb3c00] [Eval @ 0x7f93cbff06f0] Undefined constant or missing '(' in 'high'
[hevc_qsv encoder @ 0x7f93dcdb3c00] Unable to parse option value "high"
[hevc_qsv encoder @ 0x7f93dcdb3c00] Error setting option profile to value high.
FFMPEG::open_encoder  err: Invalid argument
int FFMPEG::open_encoder(const char*, const char*):
open failed hevc_qsv:/Videoklipp/QSV/hdv09_04_h265_qsv.mp4
Render::render_single: Session finished.

Some progress:

# profile=high
Pixels: yuvy422 (yuv420 isn't available)
Settings>Appearance: BT.709/MPEG2

Rendered:
Render::render_single: Session finished.
** rendered 5972 frames in 33.999 secs, 175.652 fps
audio0 pad 64 0 (64)

VLC playback OK

ffprobe -hide_banner hdv09_04_h265_qsv.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'hdv09_04_h265_qsv.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf61.1.100
  Duration: 00:03:58.88, start: 0.000000, bitrate: 3359 kb/s
  Stream #0:0[0x1](und): Video: hevc (Rext) (hev1 / 0x31766568), yuv422p(tv, bt709/unknown/unknown, top coded first (swapped)), 1440x1080 [SAR 4:3 DAR 16:9], 3223 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 129 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]



ah, so it need tv range .. try also with Pixels nv12 (worked for me on mediacodec)

Not really.,
Also the default at first startup, appearance BT.601-PAL/MJPEG, worked, and then ffprobe output
Stream #0:0[0x1](und): Video: hevc (Rext) (hev1 / 0x31766568), yuv422p(pc, bt470bg/unknown/unknown, top coded first (swapped)), 1440x1080 [SAR 4:3 DAR 16:9], 3248 kb/s, 25 fps, 25 tbr, 12800 tbn (default)

I just changed it to BT.701/MPEG which is for HD video, and I also remembed you also suggested this in a previous thread.

Both yuv422 and nv12 work.

But why isn't also the usual yuv420p available for h264 and h265?

not sure, may be qsv library does not support this?

at least I can't see it in source

https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/libavcodec/qsvenc_hevc.c#l399



Possibly also rename h265 to hevc as ffmpeg use?

ok, I'll rename it and add nv12 as default pix format.

can you also see if h264 works with nv12?




 


----------------
3a)
Loaded hdv09_04.m2t
Render:
Output to file: /Videoklipp/QSV/hdv09_04_av1_qsv.mp4
File format: FFMPEG-mp4

Compression: av1_qsv.mp4
Pixels: qsv

FFMPEG::open_encoder  err: Internal bug, should not have happened
int FFMPEG::open_encoder(const char*, const char*):
open failed av1_qsv:/Videoklipp/QSV/hdv09_04_av1_qsv.mp4
Render::render_single: Session finished.
--------------
3b)
Compression: av1_qsv.mp4
Pixels: p010le

[av1_qsv @ 0x7f1c302e7080] Current picture structure is unsupported
[av1_qsv @ 0x7f1c302e7080] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
FFMPEG::open_encoder  err: Function not implemented
int FFMPEG::open_encoder(const char*, const char*):
open failed av1_qsv:/Videoklipp/QSV/hdv09_04_av1_qsv.mp4
Render::render_single: Session finished.
-----------------
4a)
Loaded hd01.mov
Render:
Output to file: /Videoklipp/QSV/hdv09_04_h265_qsv.mp4
File format: FFMPEG-mp4

Compression: h265_qsv.mp4
Pixels: qsv

[hevc_qsv encoder @ 0x7f4b8d6f9ac0] [Eval @ 0x7f4b62ff66f0] Undefined constant or missing '(' in 'high'
[hevc_qsv encoder @ 0x7f4b8d6f9ac0] Unable to parse option value "high"
[hevc_qsv encoder @ 0x7f4b8d6f9ac0] Error setting option profile to value high.
FFMPEG::open_encoder  err: Invalid argument
int FFMPEG::open_encoder(const char*, const char*):
open failed hevc_qsv:/Videoklipp/MOV/hd01_qsv.mp4
Render::render_single: Session finished.

I think you can try to comment out (with #) line with
profile=high. in h265_qsv.mp4

# profile=high
Pixels: qsv (yuv420 isn't available)

Didn't render:
FFMPEG::open_encoder  err: Internal bug, should not have happened
int FFMPEG::open_encoder(const char*, const char*):
open failed hevc_qsv:/Videoklipp/MOV/hd01_qsv.mp4
Render::render_single: Session finished.



You also probably can stick to yuv420p (if available) because qsv implies image already in hw-specifuc format and ffmpeg does not do this conversion for us


--------------------
4b)
Compression: h265_qsv.mp4
Pixels: yuyv422

[hevc_qsv encoder @ 0x7f4ba4070f00] [Eval @ 0x7f4b5bff86f0] Undefined constant or missing '(' in 'high'
[hevc_qsv encoder @ 0x7f4ba4070f00] Unable to parse option value "high"
[hevc_qsv encoder @ 0x7f4ba4070f00] Error setting option profile to value high.
FFMPEG::open_encoder  err: Invalid argument
int FFMPEG::open_encoder(const char*, const char*):
open failed hevc_qsv:/Videoklipp/MOV/hd01_qsv.mp4
Render::render_single: Session finished.

Some progress:

# profile=high
Pixels: yuyv422 (yuv420 isn't available)
Settings>Appearance: BT.709/MPEG2

Rendered:
FFStream::encode_frame: encode failed.
file: /Videoklipp/MOV/hd01_qsv.mp4
  err: Resource temporarily unavailable
FFStream::flush failed
:file:/Videoklipp/MOV/hd01_qsv.mp4
  err: Operation not permitted
Render::render_single: Session finished.
** rendered 1781 frames in 14.617 secs, 121.844 fps
audio0 pad 128 0 (128)

VLC playback OK

ffprobe -hide_banner hd01_qsv.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'hd01_qsv.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf61.1.100
  Duration: 00:01:11.28, start: 0.000000, bitrate: 2744 kb/s
  Stream #0:0[0x1](und): Video: hevc (Rext) (hev1 / 0x31766568), yuv422p(tv, bt709/unknown/unknown, top coded first (swapped)), 1920x1080 [SAR 1:1 DAR 16:9], 2377 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 16 channels, fltp, 378 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]